Fermi weights are output next to eigenvalues. They will be needed
for the calculation of the KS density matrix in the charge
self-consistency implementation.
The part responsible for generating a mapping between the shell/ions
and block projector matrices has now been relocated to a separate
method 'get_block_matrix_map()'. This simplifies the source code
and makes testing easier.
The mapping for NORMION = True has been implemented.
Also, the orthogonalization loop has been fixed. First of all,
orthogonalization should be done separately for each block map 'bl_map'.
Second, one has to take into account that the orbital dimensions of the
block matrix can vary from block to block. To make that the overlap
matrix is non-singular one, thus, has to pass to
'orthogonalize_projector_matrix()' only a view of a submatrix of 'pmat'
corresponding to the current block.
Two tests to check the simplest cases have been added.
The implementation of the mapping of a set of projectors (belonging
to different shells and ions) onto a block matrix in the
orthogonalization routine has been generalized. Now, an implementation
of the choice between the full orthogoanlization and per-site one
is straightforward: it is just a matter of defining a proper mapping.
The mapping scheme itself is described in the doc-string of method
'ProjectorGroup.orthogonalize()'
There was a very nasty bug in the preparation of the block matrix
'p_mat'. The point is that this matrix is created once for all k-points
with the band dimension being the maximum possible. However, only
a part of the matrix is used at every k-point but the orthogonalization
is done for the whole matrix. The problem was that if the number of
bands for a given k-point was smaller than that for the next k-point
them for the next k-point some part of 'p_mat' still contained data from
the previous step, which messed up the orthonormalization. Now, 'p_mat'
is set to zero at each step of the loop.
Also, property 'nion' was added to ProjectorShell since it is used
very often.
First of all, suite '_plotools' is now split into three separate suites
'_plotools', '_proj_shell', '_proj_group', following the changes made
into the structure of the code.
Second, the two tests in 'test_projshells.py' have been fixed to conform
to the recent modifications in the code and input files.
Added missing import of ProjectorGroup and ProjectorShell to
'plotools.py'.
Moved separate routines 'orthogonalize_projector_matrix()'
and 'select_bands()' into class ProjectorGroup because these
routines are anyway not used elsewhere outside this class.
The classes ProjectorShell and ProjectorGroup are now defined in
different source files. This makes 'plotools.py' only contain
routines that control the data flows, including consistency checks
and output.
Matrices parsed by the config-parser are interpreted as transformation
matrices for each ion in the shell. If only one matrix is defined
(by TRANSFORM) it is copied for every ion.
Whether a matrix is real or complex is derived from its dimensions
consistently with other parameters of the shell (such as 'nm = 2*l + 1').
Transformation matrices are stored as complex in any case.
TRANSFILE option provides a filename containing transformation
matrices for all ions of a projected shell.
The parser simply reads the numbers into a 2d-array which is left
for interpretation at a later stage.
It was incorrect to ascribe VASP atomic sort to corr_shell['sort'],
the latter having a different meaning. According to the terminology of
Wien2k a sort determines an equivalence class of atoms.
Since the implementation at the moment does not support symmetries
the atom index is now used as a 'sort' index to make sure that all shells
remain inequivalent.
If option DOSMESH is specified a projected DOS for each shell
will be output. Energy mesh parameters are given in DOSMESH as
DOSMESH = [EMIN EMAX] N_POINTS
The parameters in the brackets [] are optional. If only the number
of points is specified the energy range is taken to be the same
as the projection energy window.
When PROJCAR is read it assigns the orbitals by their corresponding
labels. These labels are now added to the dictionary 'proj_params'.
Although they are not used currently they can be handy when it comes
to identifying the character of the orbitals.
Also, the order of orbital labels for p- and d-orbitals was changed
to conform to the convention of the old PROCAR file.
Added a function that allows one to get the non-interacting projected DOS for
newly generated projectors. The DOS is calculated with analytical tetrahedron
integration added previously.
At the moment, the DOS is generated and output for debugging purposes
after the projectors are generated. Eventually, there should be an
option in the input config file requesting the output of DOS for a given
energy mesh.
There was an inconsistency in the convention on the position of the
subarray corresponding to projectors within the selected window.
In some cases the subarray was defined from 0 to ib_max, in other cases
it was from 'ib1 - ib_min' to 'ib2 - ib_min'.
Now the global convention is that the projectors for a given window
are stored in a slice '0:ib_max', where 'ib_max = ib2 - ib1 + 1'.
There was a mess with indices 'ib_min', 'ib_max' indicating the
selected window. First of all their old names 'nb_min', 'nb_max' were
confusing and because of that they were sometimes incorrectly used as
the maximum size of the window and sometimes as a maximum band index.
Now the convention is more clear: 'ib_min', 'ib_max' correspond to the
minimum/maximum band indices (in terms of original VASP indices) and
'nb_max == ib_max - ib_min + 1' is the maximum number of bands within
the window.
Added output of density and overlap matrices to plotools.py.
If one defines a very large window (spanning all bands) one can
compare this output with the one produced by 'debug_density_matrix()'
in class ElectronicStructure.
For a small window, the overlap gives an idea of symmetry-related
degeneracies and of how strong the states are going to be renormalized
by the orthogonalization routine.
The new method in ElectronicStructure allows one to output
denisty and overlap matrices originating from the raw projectors
read from PROJCAR (LOCPROJ). This output is mainly intended for debug purposes.
Added a check to 'vaspio.py' testing that the number of columns
implies that the Fermi weights are present in EIGENVAL. This check ensures
that the new format (starting from VASP 5.4) of the file is used.
Corresponding test is added to the suite.
Added 'rpath.py' module to determine the current directory.
Also fixed the test example for EIGENVAL: VASP 5.4 uses a format
with Fermi weights output (unlike previous versions).
Originally, the tests worked only when run from their respective
directory. If one tries to run them from another directory (which happens
when test discovery is used) the tests were not able to find the input files.
Now, a dummy module 'rpath' is added to all tests whose sole role is
to obtain the current path.
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.
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.
The documentation has been slightly rewritten and extended to follow
the recent changes. The modifications include:
- ProjectorSet class is now replaced by ProjectorShell
- the workflow has been refined
- the electronic structure part is represented by class ElectronicStructure
A method 'density_matrix()' for evaluating a density matrix of a given shell
has been added to class ProjectorShell. It requires an ElectronicStructure
object as an input an by default produces a site- and spin-diagonal
part of the density matrix using the Fermi-weights obtained directly from VASP.
Ideally, this density matrix should coincide with the one calculated
within VASP itself (inside the LDA+U module).
Corresponding sanity test has been added, which shows only that the
calculation does not crash. Real numerical tests are needed.
Class ElectronicStructure is intended for the internal representation
of the band structure and raw projector data from VASP.
In addition, its purpose is to perform a simple consistency check
of the input VASP data (as they are read from different files).
When a ProjectorShell is created it creates a view of the full
projector array with orbital 'ilm' and band 'ib' indices interchanged.
The reason for this is that this corresponds more naturally to the
definition of the projector P_{m\nu} and also allows for multiplications
of projector matrices without additional transposition.
The tests have been modified accordingly.
A preliminary test suite for class 'ProjectorGroup' was added.
Currently, only a simplest test is performed testing that
after the input is processed the resulting projectors selected
within a given energy window are corret.
The problem was that when one shell was specified without an explicit
group the created automatic group was lacking the default values for
parameters 'normalize' and 'normion'. The current design, however,
assumes that they must always be set.
A single-file test suite for 'inpconf.py' is split into several files,
each containing a separate TestCase class. In addition, all test cases
are derived from class ArrayTestCase (in turn derived from TestCase)
which contains a numpy-array equality method.
I also described how one can read a self energy form a data
file. However, this needs to be tested and also included
in the reference manual. Maybe the function should move
back into sumk_dft_tools!?
There was an obious typo in the formula for cell volume
vol_c = a * b * c * numpy.sqrt(1 + 2 * c_al * c_be * c_ga - c_al ** 2 - c_be ** 2 - c_ga ** 2),
where instead of 'c_be ** 2' there was 'c_be * 82'.
* recompute maps every time SK called rather than saving them
* user saves and feeds in chemical potential and dc manually
* set_dc sets dc to known values (eg from previous calculations) while calc_dc computes them
* find_mu -> calc_mu to match API for other functions
They take (block,inner)_sumk -> (block,inner)_solver,
and encode all the information contained in map, map_inv,
and map_ind. These functions will be cleaned up soon.
* hamiltonians contains functions to create basic hamiltonians
* Us are now computed by a compact python script
* solver_multiband sets up the local problem for LDA+DMFT