[Pw_forum] Bader analysis, part II

Paolo Giannozzi giannozz at nest.sns.it
Wed Oct 8 12:00:22 CEST 2003


On Wednesday 01 October 2003 22:27, Steven Kirk wrote:

> Firstly, thank you for your responses to my previous enquiry regarding
> Bader analysis of the results produced by PWSCF.
>
> I am strongly considering writing some code to add this capability to,
> for example, the PP program from PWSCF.

consider yourself strongly encouraged. Once upon a time somebody tried 
to implement some Bader-analysis stuff. I heard that one problem specific 
to pseudopotentials is that the assumption that the charge density has 
maxima only on atoms is no longer true. I don't think this is a major problem,
though. Also the presence of the augmentation charge in the ultrasoft case
shouldn't be a problem.

> I would be very grateful if any of the participants on this list or the
> developers can point me to an appropriate location in the code
> where it  would be possible to 'splice in' this capability.

"where", among the postprocessing codes. Start from a template like 
the one attached, add a line to PP/Makefile, for instance:

bader.x: $(PPOBJS) bader.o
	$(LD) -o baders.x bader.o $(PPOBJS) $(PWOBJS) $(MODULES) $(LDFLAGS)
(the first character is a tabulator!!!)

"how", it's another story. The meaning of the relevant variables is (should
 be) described (sort of) in PW/pwcom.f90; other info is spread throughout 
the code. Try the "monkey style": look how things are done in the code 
and imitate!!!

Paolo

-- 
Paolo Giannozzi             e-mail:  giannozz at nest.sns.it
Scuola Normale Superiore    Phone:   +39/050509412
Piazza dei Cavalieri 7      Fax:     +39/050509417, 050563513     
I-56126 Pisa, Italy         Office:  Lab. NEST, Via della Faggiola 19
-------------- next part --------------
!
!-----------------------------------------------------------------------
program bader
  !-----------------------------------------------------------------------
  use pwcom
  use becmod
  use io_files, only: nd_nmbr, prefix, tmp_dir
#ifdef __PARA
  use para, only: me
  use io_global, only: ionode_id
  use mp, only: mp_bcast
#endif
  implicit none
  !
  character(len=256) :: outdir
  integer :: ios
  namelist / inputpp / outdir, prefix
  !
  call start_postproc (nd_nmbr)
  !
  !   set default values for variables in namelist
  !
  prefix = 'pwscf'
  outdir = './'
  !
#ifdef __PARA
  if (me == 1)  then
#endif
  read (5, inputpp, err = 200, iostat = ios)
200 call errore ('bader', 'reading inputpp namelist', abs (ios) )
  !
  tmp_dir = trim(outdir)
  !
#ifdef __PARA
  end if
  !
  ! ... Broadcast variables
  !
  CALL mp_bcast( tmp_dir, ionode_id )
  CALL mp_bcast( prefix, ionode_id )
#endif
  !
  !   Now allocate space for pwscf variables, read and check them.
  !
  call read_file
  call openfil
  call init_us_1
  !
  call do_what_i_need
  !
  call stop_pp
  stop
end program bader
!
!-----------------------------------------------------------------------
subroutine do_what_i_need
  !-----------------------------------------------------------------------
  !
  !    This routine does this and that
  !
#include "machine.h" 
  (may or may not be needed, it makes no harm)
#ifdef __PARA
  use para, only: me
#endif
  use pwcom
  implicit none
  ... local variables here

  ...calculate ...

#ifdef __PARA
  if (me == 1) then
#endif
  ... write results to output ...
#ifdef __PARA
  endif
#endif
  !
  return
end subroutine do_what_i_need


More information about the users mailing list