The new projector input requires a different approach of selecting
the projectors for each shell. Specifically, for each site/orbital
index defined for a given shell one has to look for the corresponding
input projector (from PROJCAR).
Also, small fixes were required to make 'ferw' array index order
consistent with what is expected in ProjectorShell. This order might
eventually be modified.
Since in the new implementation the projectors produced by VASP
are output only for selected functions it is necessary to check
that input cfg-file specifies only those projectors that were selected
in the INCAR file. The consistency routine checks for every shell
and site/orbital character that a corresponding projector is present
in PROJCAR.
Some necessary modifications to class ElectronicStructure in order
to conform the modified projector input. In particular, the dimensions
of the projector array are now taken directly from the array,
and the old dictionary 'params' is replaced with a list 'proj_params'
containing information on the character of projectors.
Small fixes to accord with the changes of Vaspio:
* 'nspin' is now taken from Eigenval.ispin
* 'nc_flag' is now determined from the value of 'ncdij' read from DOSCAR
* 'ferw' is now taken from Eigenval
This python-parser is a prototype of a future parser that will probably
be using only LOCPROJ (which is going to be modified).
At the moment, one has to use the first line of LOCPROJ to determine
the array dimensions and parse PROJCAR because it contains relevant information
on projectors (such as site and orbital character).
Note that in the previous implementation relying on the binary PLOCAR-file
the Fermi weights were taken from PLOCAR. In the current version of VASP
(>=5.4.1) the Fermi weights can read in from EIGENVAL.
At the moment the file have just been copied from 'c_plocar_io.c'
and most of the old functionality is commented out. Eventually, this
should become a parser of PROJCAR, LOCPROJ written in C for greater
performance on large files.
The files from the original vasp-interface repository are reshuffled in
accord with the directory structure of dft_tools. Some of the directories,
such as 'test' (unit tests for the interface), 'examples' (simple examples for
the development purposes) are temporarily placed into 'python/vasp' directory
to avoid confusion with integral tests and examples of dft_tools.
Import of 'json' is fixed to conform python distributions without
'simplejson'.
Also, the full path is used for 'converter_tools' for the moment while
'vasp_converter' is not part of 'dft_tools'.
It seems that not all distributions of python come with a 'simplejson' module.
Now, if this module is not found the import falls back to module 'json'.
At the moment, symmetries are not supported by the interface.
Instead, some dummy parameters are generated and the symmetry is turned off.
'misc_input' is only partially implemented because it contains
some data which is not required for the correct functioning of DftTools.
This preliminary version is untested and might not even run.
Here, almost all relevant input (apart from symmetries and miscellaneous)
is implemented and conventions adpoted in DftTools are accomodated.
Method 'nelect_window()' now correctly takes into account a subset
of bands selected by the energy window.
Also, the number of electrons is now output to a '*.grX' file.
The data for a projected shell (output to a '*.pgX' file) contains
now the ion sort corresponding to this shell.
Also, 'check_data_consistency()' was fixed by correcting the
reference to list 'type_of_ion' (which is now copied to ElectronicStructure).
Added a check to 'check_data_consistency()' that verifies
that each shell contains only one sort of ions.
Also added a non-functioning test (implementation is commented)
for the function.
It requires a full set of VASP files for an example with multiple atom sorts.
'read_data()' is a generator interpreting a file as a sequence of
floats. Lines starting with '#' are ignored.
'read_header_and_data()' reads the header string until a line
"# END ...", initializes a generator 'read_data()', and returns
them.
'vasp_converter.py' is based on the existing 'wien2k_converter.py'.
Methods 'read_header_and_data()' and 'read_data()' for reading input files
are added. The first method returns a JSON-header and a generator 'read_data()'
returning floats from the plain-data part of the file.
'main()' now calls a function 'output_as_text()' responsible for storing
both a ctrl- and plo-files ('ctrl_output()' and 'plo_output()', respectively).
Added function 'ctrl_ouput()' which stores data common for all correlated
shells into a file '<basename>.ctrl'.
At the moment, only a very basic header is output.
The signature of 'plo_output()' is also modified to include an instance
of class 'ElectronicStructre' containing important information on
the lattice structure, Efermi, and k-points.
Parsing of two optional parameters (BASENAME and EFERMI) from section [General] from the config-file
is implemented. If this section is not found the parameters are set to their
default values, which is 'vasp' for BASENAME and nothing for EFERMI.
Appropriate test is added to the 'inpconf' test suite.
A description of the output file formats is added to the documentation.
In particular, the outline of JSON headers for projector-group (*.plog<Ng>)
and control (*.ctrl) files are given.
The names of the test suites have been prefixed with an underscore
to avoid name conflicts with corresponding modules.
Also an attempt to make a scan of all tests has been made by
creating a 'test_all.py' script that is supposed to discover all
test cases and run them. Unfortunately, this does not work as expected
because many tests use input files assumed to be found in the current
directory, which is not true if the tests are run from a different
(parent) directory.
This can be fixed by either forcing the change of directory (but it
seems that 'unittest' does not have this functionality) or
prepending input file names with the current module directory.
Subroutine 'kpoints_output()' is added to 'plotools.py' and is invoked
from 'main.py'.
K-points are output in a separate file <basename>.kpoints that is
common to all PLO groups. If present, tetrahedron data is also stored.
Generation and orthogonalization of PLOs should be separated
because some quantities (such as the LDA density matrix) are calculated
using the original raw projectors.
The orthogonalization routine is now called from 'main.py'.
In the previous commit the calculation of 'nelect' was implemented
incorrectly. The sum over k-points must also contain k-weights
and a spin factor (2.0 for ns = 1).
The calculation of 'nelect' is now implemented as a separate method
of ProjectorGroup.
Output of PLO groups into a text file is added to 'plo_output()'.
The file format is provisional and can change in future versions.
Also, an attribute 'nelect' providing the number of electrons in
the selected energy window is added to ProjectorGroup.