ABINIT/m_pawrhoij [ Modules ]

This module contains the definition of the pawrhoij_type structured datatype,
as well as related functions and methods.
pawrhoij_type variables define rhoij occupancies matrixes used within PAW formalism.

m_pawrhoij/pawrhoij_alloc [ Functions ]

[comm_atom] = communicator over atoms (OPTIONAL)
cplex=1 if rhoij is REAL,2 if COMPLEX
[my_atmtab(:)] = Index of atoms treated by current proc (OPTIONAL)
nspden=number of spin-components for rhoij
nsppol=number of spinorial components for rhoij
nsppol=number of independant spin-components for rhoij
typat(:)=types of atoms
[lmnsize(:)]=array of (l,m,n) sizes for rhoij for each type of atom (OPTIONAL)
must be present if [pawtab] argument is not passed
[ngrhoij]=number of gradients to be allocated (OPTIONAL, default=0)
[nlmnmix]=number of rhoij elements to be mixed during SCF cycle (OPTIONAL, default=0)
[pawtab(:)] <type(pawtab_type)>=paw tabulated starting data (OPTIONAL)
must be present if [lmnsize(:)] argument is not passed
[use_rhoij_]=1 if pawrhoij(:)%rhoij_ has to be allocated (OPTIONAL, default=0)
[use_rhoijp]=1 if pawrhoij(:)%rhoijp has to be allocated (OPTIONAL, default=1)
(in that case, pawrhoij%rhoijselect is also allocated)
[use_rhoijres]=1 if pawrhoij(:)%rhoijres has to be allocated (OPTIONAL, default=0)
[use_rhoijim]=1 if pawrhoij(:)%rhoijim has to be allocated (OPTIONAL, default=0)

m_pawrhoij/pawrhoij_copy [ Functions ]

Copy one pawrhoij datastructure into another
Can take into accound changes of dimensions
Can copy a shared pawrhoij into distributed ones (when parallelism is activated)

INPUTS

keep_cplex= optional argument (logical, default=.TRUE.)
if .TRUE. pawrhoij_out(:)%cplex is NOT MODIFIED,
even if different from pawrhoij_in(:)%cplex
keep_itypat= optional argument (logical, default=.FALSE.)
if .TRUE. pawrhoij_out(:)%ityp is NOT MODIFIED,
even if different from pawrhoij_in(:)%ityp
keep_nspden= optional argument (logical, default=.TRUE.)
if .TRUE. pawrhoij_out(:)%nspden is NOT MODIFIED,
even if different from pawrhoij_in(:)%nspden
mpi_atmtab(:)=--optional-- indexes of the atoms treated by current proc
comm_atom=--optional-- MPI communicator over atoms
pawrhoij_in(:)<type(pawrhoij_type)>= input rhoij datastructure

m_pawrhoij/pawrhoij_gather [ Functions ]

master=master communicator receiving data ; if -1 do a ALLGATHER
comm_atom= communicator
pawrhoij_in(:)<type(pawrhoij_type)>= input rhoij datastructures on every process
with_grhoij : optional argument (logical, default=.TRUE.)
TRUE if pawrhoij%grhoij field is included in the gather operation
with_lmnmix : optional argument (logical, default=.TRUE.)
TRUE if pawrhoij%lmnmix field is included in the gather operation
with_rhoijp : optional argument (logical, default=.TRUE.)
TRUE if pawrhoij%rhoijp and pawrhoij%rhoijselect fields
are included in the gather operation
with_rhoijres : optional argument (logical, default=.TRUE.)
TRUE if pawrhoij%rhoijres field is included in the gather operation
with_rhoijim : optional argument (logical, default=.TRUE.)
TRUE if pawrhoij%rhoijim field is included in the gather operation
with_rhoij_ : optional argument (logical, default=.TRUE.)
TRUE if pawrhoij%rhoij_ field is included in the gather operation

m_pawrhoij/pawrhoij_get_nspden [ Functions ]

Compute the value of nspden (number of spin component) for a pawrhoij datastructure.
This one depends on the number of spinorial components, the number of components
of the density and use of the spin-orbit coupling.

INPUTS

nspden= number of spin-density components
nspinor= number of spinorial components
spnorb= flag: 1 if spin-orbit coupling is activated

m_pawrhoij/pawrhoij_io [ Functions ]

unitfi=Unit number for IO file or netcdf file handler (already opened in the caller).
nsppol_in=Number of independent spin polarizations. Only used for reading.
nspinor_in=Number of spinorial components. Only used for reading.
nspden_in=Number of spin-density components. only used for reading.
nlmn_type(ntypat)= Number of (l,m,n) elements for the paw basis for each type of atom. Only used for reading.
typat(natom) =Type of each atom.
headform=Format of the abinit header (only used for reading as we need to know how to read
the data. Writing is always done using the latest headform.
rdwr_mode(len=*)=String defining the IO mode. Possible values (not case sensitive):
"W"= For writing to unitfi
"R"= For reading from unitfi
"E"= For echoing.
"D"= for debug
[form(len=*)]= String defining the file format. Defaults to Fortran binary mode i.e., "unformatted"
Other possible values are (case insensitive):
"formatted"=For IO on a file open in formatted mode.
"netcdf"=For IO on a netcdf file.
[natinc]=Defines the increment in the loop over natom used for echoing the pawrhoij(natom) datastructures.
If not specified, only the first and the last atom will be printed.

SIDE EFFECTS

pawrhoij(:)<type(pawrhoij_type)>= rhoij datastructure.
if rdwr_mode="W", it will be written on unit unitfi using the file format given by form.
if rdwr_mode="R", pawrhoij will be read and initialized from unit unitfi that has been
opened with form=form.
if rdwr_mode="E", the routines only echoes the content of the structure.

m_pawrhoij/pawrhoij_isendreceive_fillbuffer [ Functions ]

Extract from pawrhoij and from the global index of atoms
the buffers to send in a sending operation
This function has to be coupled with a call to pawrhoij_isendreceive_getbuffer

INPUTS

atm_indx_send(1:total number of atoms)= array for send operation,
Given an index of atom in global numbering, give its index
in the table of atoms treated by current processor
or -1 if the atoms is not treated by current processor
nrhoij_send= number of sent atoms
pawrhoij= data structure from which are extract buffer int and buffer dp

OUTPUT

buf_int= buffer of integers to be sent
buf_int_size= size of buffer of integers
buf_dp= buffer of double precision numbers to be sent
buf_dp_size= size of buffer of double precision numbers

m_pawrhoij/pawrhoij_isendreceive_getbuffer [ Functions ]

Fill a pawrhoij structure with the buffers received in a receive operation
This buffer should have been first extracted by a call to pawrhoij_isendreceive_fillbuffer

INPUTS

atm_indx_recv(1:total number of atoms)= array for receive operation
Given an index of atom in global numbering, give its index
in the table of atoms treated by current processor
or -1 if the atoms is not treated by current processor
buf_int= buffer of receive integers
buf_dp= buffer of receive double precision numbers
nrhoij_send= number of sent atoms

m_pawrhoij/pawrhoij_redistribute [ Functions ]

Redistribute an array of pawrhoij datastructures
Input pawrhoij is given on a MPI communicator
Output pawrhoij is redistributed on another MPI communicator

INPUTS

mpi_comm_in= input MPI (atom) communicator
mpi_comm_out= output MPI (atom) communicator
mpi_atmtab_in= --optional-- indexes of the input pawrhoij treated by current proc
if not present, will be calculated in the present routine
mpi_atmtab_out= --optional-- indexes of the output pawrhoij treated by current proc
if not present, will be calculated in the present routine
natom= --optional-- total number of atoms
----- Optional arguments used only for asynchronous communications -----
RecvAtomProc(:)= rank of processor from which I expect atom (in mpi_comm_in)
RecvAtomList(:)= indexes of atoms to be received by me
RecvAtomList(irecv) are the atoms I expect from RecvAtomProc(irecv)
SendAtomProc(:)= ranks of process destination of atom (in mpi_comm_in)
SendAtomList(:)= indexes of atoms to be sent by me
SendAtomList(isend) are the atoms sent to SendAtomProc(isend)

OUTPUT

[pawrhoij_out(:)]<type(pawrhoij_type)>= --optional--
if present, the redistributed datastructure does not replace
the input one but is delivered in pawrhoij_out
if not present, input and output datastructure are the same.

m_pawrhoij/pawrhoij_unpack [ Functions ]

rhoij(:) <pawrhoij_type)>= input/output datastructure
* In output the rhoij_ array is filled with the values stored in the packed array rhoijp.
* If use_rhoij_/=1, rhoij_ is allocated and the corresponding flag is set to 1.

pawrhoij and pawrhoij_unsym can be identical (refer to the same pawrhoij datastructure).
They should be different only if pawrhoij is distributed over atomic sites
(in that case pawrhoij_unsym should not be distributed over atomic sites).