ABINIT/dsksta [ Functions ]

This routine evaluates the amount of disk space required by the _KSS file.

INPUTS

dimlmn(natom*usepaw)=Number of nlm partial waves for each atom.
ishm=Number of G-shells to be saved in _KSS file.
mpsang=Max angular momentum +1 for pseudos.
natom=Number of atoms in the unit cell.
nbandkss=Number of desired bands to be saved in _KSS file
nkpt=Number of k points.
npwkss=Number of desired G-vectors to be saved in _KSS file.
nspinor=Number of spinorial components.
nsppol=Number of independent spin polarizations.
ntypat=Number of type of atoms.
nsym2=Number of symmetries in space group, without INV
usepaw=1 if PAW.

ABINIT/m_io_kss [ Modules ]

Copyright (C) 1999-2018 ABINIT group (MG, MT, VO, AR, LR, RWG, MM, XG, RShaltaf)
This file is distributed under the terms of the
GNU General Public License, see ~abinit/COPYING
or http://www.gnu.org/copyleft/gpl.txt .
For the initials of contributors, see ~abinit/doc/developers/contributors.txt .

ABINIT/memkss [ Functions ]

This routine evaluates the additional amount of memory required
by routine 'outkss'.

INPUTS

mband=maximum number of bands
mgfft=maximum size of 1D FFTs
mproj=maximum dimension for number of projection operators for each
angular momentum for nonlocal pseudopotential
mpsang= 1+maximum angular momentum for nonlocal pseudopotentials
mpw=maximum dimensioned size of npw.
natom=number of atoms in cell.
ngfft(18)=contain all needed information about 3D FFT, see ~abinit/doc/variables/vargs.htm#ngfft
nkpt=number of k points.
nspinor=number of spinorial components of the wavefunctions
nsym=number of symmetries in space group
ntypat=number of types of atoms in unit cell.

m_io_kss/gshgg_mkncwrite [ Functions ]

This routine builds <G|H|G'> matrix elements for all (G, G').
starting from the knowledge of the local potential on the real-space FFT mesh.
It can also perform the direct diagonalization of the Kohn-Sham Hamiltonian
for a given k-point and spin. This a debugging tool

m_io_kss/k2gamma_centered [ Functions ]

Helper function to translate a set of wavefunctions from the k-centered G-sphere
to the Gamma-centered G-sphere used for GW calculations.

INPUTS

npw_k=Number of planewaves in the k-centered basis set.
kss_npw=Number of planewaves in the Gamma-centered G-sphere.
nspinor=Number of spinorial component.
nbandksseff=Number of bands in input-output arrays.
[icg]=Shift to be used when accessing the cg array. 0 if not specified (usually k_index).
[eig_vec(2,npw_k*nspinor,nbandksseff)]=wavefunctions defined on the k-centered G-sphere.
[cg(2,ikg+1:ikg+npw_k*nspinor*nbandksseff)]=wavefunctions defined on the k-centered G-sphere.
ngfft(18)=Info on the FFT.
MPI_enreg<MPI_type>=Structure gathering info on the parallelization.
istwf_k
ecut
gbig(3,kss_npw)
kg_k(3,npw_k)
gmet(3,3)
kpoint(3)

OUTPUT

wfg(2,kss_npw*nspinor,nbandksseff)=Wavefunctions in the Gamma-centered representation.

NOTES

1) icg is used only if cg is present.
2) cg and eig_vec are mutually exclusive. One and only one can be passed to the routine.

This piece of code has been extracted from outkss.F90. The implementation is consistent
with the KSS file formata (Fortran version) but it presents two design flaws.
1) Pseudo with more that one projector per l-channel are not supported.
2) Ordering of dimensions in vkb and vkbd is not optimal. We are not programming C!!!

npwkss = Input: Initial guess for the number of G-vectors required. Use 0 to have the
full list of G-vectors that form a closed shell.
Output: Actual number of G-vectors that form a set of closed shells
gvec_kss(:,:) = Input: null pointer. Output: gvec_kss(3,npwkss), list of G-vectors (closed shells)
ierr=Status error

m_io_kss/outkss [ Functions ]

This routine creates an output file containing the Kohn-Sham electronic Structure
for a large number of eigenstates (energies and eigen-functions).
The resulting file (_KSS) is needed for a GW post-treatment.
The routine drives the following operations:
- Re-ordering G-vectors according to stars (sets of Gs related by symmetry operations).
A set of g for all k-points is created.
- Creating and opening the output "_KSS'" file
- Printing out output file header information...
... and, for each k-point:
According to 'kssform', either
- Re-computing <G|H|G_prim> matrix elements for all (G, G_prim).
Diagonalizing H in the plane-wave basis.
or - Taking eigenvalues/vectors from congugate-gradient ones.
- Writing out eigenvalues and eigenvectors.

* This routine is maintained for legacy reasons. Abinit8 is not able to read KSS files
anymore hence KSS files should be used only to interface Abinit with external codes
that are still using the old KSS format.
* The routine can be time consuming (in particular when computing
<G|H|G_prim> elements for all (G, G_prim)) (kssform=1).
So, it is recommended to call it once per run...
* The IO code is not parallelized and this represents a serious bottleneck when np is large.
* when kssform==1, the routine RE-computes all Hamiltonian terms.
So it is equivalent to an additional electronic SC cycle.
(This has no effect is convergence was reach...
If not, eigenvalues/vectors may differs from the congugaste gradient ones)
* The KB form factors and derivatives are not calculated correctly if there are
pseudos with more than one projector in an angular momentum channel.
* In the ETSF output format (Dtset%iomode == 3), the complete symmetry set
is output. So, if reading programs need only the symmorphic symmetries, they
will need to remove themselves the non-symmorphic ones.
* There exists two file formats:
kssform==1 diagonalized file _KSS in real(dp) is generated.
kssform==3 same as kssform=1 but the wavefunctions are not diagonalized
(they are taken from conjugate-gradient ones)
Old kssform=0 and kssform=2 are obsolete and no longer available
TESTS
* ETSF_IO output is tested in tests/etsf_io/t02.

m_io_kss/write_kss_header [ Functions ]

Write the header of the KSS file either using plain Fortran-IO or netcdf with ETSF-IO format.
Returns the unit number to be used for further writing.
It should be executed by master node only.

INPUTS

filekss(len=fnlen)=The name of the KSS file.
kss_npw=Number of planewaves used for the wavefunctions in the KSS files.
ishm=Max number of shells written on file
shlim(ishm)=The cumulative number of G"s in each shell.
nbandksseff=Number of bands to be written.
mband=The maximum number of bands treated by abinit.
nsym2=Number of symmetry operations to be written on the header.
symrel2(3,3,nsym2)=The symmetry operations in real space to be written.
tnons2(3,nsym2)=The fractional translations associateed to symrel2.
gbig(3,kss_npw)=The set of G-vectors for the KSS wavefunctions (Gamma-centered)
Hdr<hdr_type>=The abinit header.
Dtset <dataset_type>=all input variables for this dataset
Psps<pseudopotential_type>=Structure gathering info on the pseudopotentials.
iomode=Input variables specifying the fileformat. (0-->Fortran,3-->netcdf with ETSF-IO format).
occ(mband*nkpt*nsppol)=The occupation factors.

m_io_kss/write_kss_wfgk [ Functions ]

Write the Gamma-centered wavefunctions and energies on the KSS file for a single k-point.
(Only the master node should call this routine).

INPUTS

kss_unt=The unit number of the file
ikpt=The index of the k-point
isppol=The spin index.
nspinor=number of spinorial components (on current proc)
kss_npw=Number of planewaves used for the wavefunctions in the KSS files.
npw_k=Number of plane-waves in the k-centered basis set.
nbandksseff=Number of bands to be written.
natom=Number of atoms.
Psps<Pseudopotential_type>=Structure gathering pseudopotential data.
kpoint(3)=The k-points in reduced coordinates.
ene_k(nbandksseff)=Energies at this k-point
occ_k(nbandksseff)=Occupation factors at this k-point.
rprimd(3,3)=dimensional primitive translations for real space (bohr).
gbig(3,kss_npw)=The set of G-vectors for the KSS wavefunctions (Gamma-centered)
wfg(2,kss_npw*nspinor,nbandksseff)=The wavefunction Fourier coefficients.
iomode=Input variables specifying the fileformat. (0-->Fortran,3--> netcdf with ETSF-IO format).

m_io_kss/write_vkb [ Functions ]

Writes the KB form factors and derivates on file for a single k-point.
Supports plain Fortran IO and netcdf with ETSF-IO format

INPUTS

kss_unt=The unit number of the file
ikpt=The index of the k-point
kpoint(3)=The k-point in reduced coordinates.
kss_npw=Number of planewaves used for the wavefunctions in the KSS files.
npw_k=Number of planewaves at this k-point in the k-centered basis set used in abinit (ecut).
ecut=cutoff energy used in abinit.
rprimd(3,3)=dimensional primitive translations for real space (bohr).
Psps<Pseudopotential_type>=Datatype gathering data on the Pseudopotentials.
iomode=Input variables specifying the fileformat. (0-->Fortran,3-->netcdf with ETSF-IO).
gbig(3,kss_npw)=Set of G-vectors used in the KSS file.