The main part of the vasptools module is the class VaspRun which provides methods in order to deal with VASP calculations outputs. vasptools contains the following submodules :
- vasptools.vasprun : contains the VaspRun class which is the core part of the module.
- vasptools.dos : density of states output functions
- vasptools.bands : energy bands output functions
- vasptools.utils : operations on CHGCAR file
- vasptools.atom : an atom class
All above submodules are loaded whith vasptools. The VaspRun class is loaded in the vasptools namespace.
In the following, run will refer to a VaspRun object instanced as :
>>> import vasptools
>>> run = vasptools.VaspRun("vasprun.xml")
VASP calculation class
Parameters: |
|
---|
Examples :
>>> import vasptools
>>> run = vasptools.vasprun.VaspRun()
>>> run = vasptools.VaspRun()
>>> run = vasptools.VaspRun("dos.xml")
Variables: | eFermi (float) – Energy of the Fermi level in eV. |
---|
Variables: | allMotsClefs (dict) – dictionary of all parameters of the calculation. |
---|
Example :
>>> run.allMotsClefs["ENCUT"]
500.0
Variables: | INCAR (dict) – dictionary of all parameters of the INCAR file. |
---|
Return type: | string |
---|---|
Returns: | Return the value of the parameter ‘flag’. |
Parameters: | flag (string) – name of the parameter. |
See listerMotsClefs() which return the list of parameters name.
>>> run.valeurMotClef("ENCUT")
ENCUT = 500.0
500.0
>>> encut = run.valeurMotClef("ENCUT")
ENCUT = 500.0
>>> encut
500.0
Parameters value can also be obtained from allMotsClefs class atribute, see allMotsClefs.
>>> run.allMotsClefs("ENCUT")
500.0
Print all parameters of the calculation.
See also valeurMotClef().
Print parameters present in the INCAR file
>>> run.printINCAR()
# fichier INCAR du calcul
NELMIN = 6 ENCUT = 500.0 ISTART = 0
SYSTEM = "Cu2O PREC = medium ISIF = 3
IBRION = 2 EDIFFG = -0.01 EDIFF = 1e-06
Print atomic data
>>> run.printAtomsData()
# system :
* atom number : 6
* type number : 2
* atom list : Cu, Cu, Cu, Cu, O, O
# Atom types :
Atom Cu :
weight : 63.546
Valence electrons : 11
type : 1
Pseudopotential : PAW_PBE Cu 05Jan2001
Atom O :
weight : 16.0
Valence electrons : 6
type : 2
Pseudopotential : PAW_PBE O 08Apr2002
Read total DOS and projected DOS into vasprun.xml.
Return type: | [bool, bool] |
---|---|
Returns: | The first element is True if total DOS was read and the second element is True if projected DOS were read. |
The following attribute are available after using this method :
- total DOS is stored in a list object called : dosTotale
- projected DOS are stored in a list object called : dosPartielles
- abscissa of the DOS are stored in a list object called : energiesDOS
- Fermi level energy is stored in : eFermi
Example :
>>> run.lectureDOS()
# Lecture de la densité d'états
* ISPIN = 1
* densité d'états totale
* densités d'états partielles
[True, True]
Variables: | energieDOS (list) – Abscissa of the density of states. |
---|
>>> run.energiesDOS
[-19.7886, -19.6826, -19.5765, ..., 11.8109, 11.917, 12.023]
Variables: | dosTotale[spin][energy][i] (list) – total DOS. |
---|
Index of dosTotale are :
- spin index (0 is spin up, 1 is spin down)
- energy index (0 to len(run.energiesDOS))
- i index (0 the DOS, 1 is the integrated DOS)
The following loop gives the dos of spin up:
>>> [dos[0] for dos in run.dosTotale[0]]
The following loop gives the integrated dos of spin down :
>>> [dos[1] for dos in run.dosTotale[1]]
Variables: | dosPartielles[iat][spin][energy][i] (list) – Projected DOS |
---|
Index of dosTotale are:
- atom index (0 to Natoms)
- spin index (0 is spin up, 1 is spin down)
- energy index (0 to len(run.energiesDOS))
- i index
i index take values :
- 0 to 2 if DOS is l-projected (s, p, d)
- 0 to 8 if DOS is lm-projected (s, py, pz, px, dxy, dyz, dz2, dxz, dx2-y2)
Variables: | DOSTotaleLue (bool) – True if total DOS has been already read |
---|
Variables: | DOSPartiellesLues (bool) – True if projected DOS have been already read |
---|
Read energy bands into vasprun.xml.
Return type: | bool |
---|---|
Returns: | Return True if energy bands are read. |
Energy bands are stored into bands attribute.
Variables: | bands[spin][k][bands][i] (list) – Energy bands |
---|
Index of bands are :
- spin index (0 is spin up, 1 is spin down)
- k points index (0 to number of k points)
- bands index (0 to NBANS - 1)
- i index : 0 energy, 1 ocupency
The number of k points along a line of the reciprocal space is Ndivision. k-points are listed for each line of the reciprocal space successively and store in listePoinstK.
The number of bands, NBANS, can be obtain with valeurMotClef() or directly with allMotsClefs.
Read k-points used for the calculation.
Return type: | bool |
---|---|
Returns: | True if k points are read. |
Variables: | pointsKLues (bool) – True if k points have been already read. |
---|
Variables: | listePointsK[k][i] (list) – List of all k-points. |
---|
Index of listePointsK :
- index of the k-point.
- coordinate of the k-point in the reciprocal space (i = 0 to 2).
Variables: | typePointsK (string) – Name of the method used to generate the kpoints grid (gamma, listgenerated ...) |
---|
The following attributes are relevant only in the case of k-points generated along line of the reciprocal space, that is typePointsK equal listgenerated.
Variables: | directionsPointsK[l][i] (list) – Coordinates of the first and the last k-points on each line of the reciprocal space along which energy bands are computed. |
---|
Index of directionPointsK
- l is the line of the reciprocal space index
- i is the index upon k-points coordinates : 0 to 2 for the first k-points of the line and 3 to 5 for the last k-points of the line.
Example, if you compute energy bands from (1/2, 1/2, 1/2) to Gamma and from Gamma to (0,1/2,0) :
>>> run.directionPointsK
[[0.5, 0.5, 0.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.5, 0.0],
Variables: | Ndivision (int) – Number of k-points along a line of the reciprocal space. |
---|
Read initial structure of the calculation.
Parameters: | verbose (bool) – verbosity of the method. |
---|---|
Return type: | crystal, see crystal. |
Returns: | A crystal object |
The initial structure is initialStructure.
Read final structure of the calculation.
Parameters: | verbose (bool) – verbosity of the method. |
---|---|
Return type: | crystal, see crystal. |
Returns: | A crystal object |
The final structure is finalStructure.
This module contains functions in order to print projected DOS into files or in order to print or plot total DOS.
All functions take only one arguments : a VaspRun object.
Plot total DOS using matplotlib.pyplot.
Parameters: | run (VaspRun) – A VaspRun object corresponding to a DOS calculation. |
---|
Print the total DOS into a file.
Parameters: | run (VaspRun) – A VaspRun object corresponding to a DOS calculation. |
---|---|
Return type: | list |
Returns: | list of created files |
Output file name for the total DOS is totalDOS.dat for non spin polarized calculations and totalDOS_up.dat or totalDOS_down.dat for spin polarized calculations.
Print projected DOS to files with one file per atom.
Parameters: | run (VaspRun) – A VaspRun object corresponding to a DOS calculation. |
---|---|
Return type: | list |
Returns: | list of created files |
Output file names are projectedDOS_X_N.dat for non spin polarized calculations where X is the atom name and N is the atom number in the structure. For spin polarized calculations, output file names are projectedDOS_up_X_N.dat or projectedDOS_down_X_N.dat.
This module contains functions in order to plot energy bands or to print them into files.
All functions take only one arguments which is a VaspRun object.
Plot total DOS using matplotlib.pyplot.
Parameters: | run (VaspRun) – A VaspRun object corresponding to a bands calculation |
---|
Print energy bands into file.
Parameters: |
|
---|---|
Return type: | list |
Returns: | list of created files |
If parDirection is False (default), output file names are bands.dat or bands_up.dat and bands_down.dat for spin polarized calculations. If parDirection is True, one file is created for each line of the reciprocal space along which energy bands were computed. If X is the index of the lines of the reciprocal space, the output file names are bands_dirX.dat or bands_dirX_up.dat and bands_dirX_down.dat for spin polarized calculations.
This module contains functions in order to do simple operations (split, arithmetic) on charge density.
Read up + down and up - down densities in a CHGCAR file.
Parameters: |
|
---|---|
Return type: | list |
Returns: | The up + down and the up - down densities |
Read CHGCAR1 and CHGCAR2 files and do the following linear operation
CHGCAR_sum = fact1 * CHGCAR1 + fact2 * CHGCAR2
Parameters: |
|
---|---|
Return type: | list |
Returns: | The result of the linear operation. |
Operation is done on the first density of the CHGCAR file, namely the up + down density.
Atom class is used in order to manage atomic data. Default is an hydrogen atom.
Parameters: |
|
---|
Variables: | name (string) – Atom name |
---|
Variables: | atomType (int) – Atom type |
---|
Variables: | Ne (int) – Number of valence electrons |
---|
Variables: | w (float) – Atomic weight |
---|
Variables: | pseudo (string) – Pseudopotential used for core electrons. |
---|