calculation

py4vasp.calculation

Provide refinement functions for a the raw data of a VASP calculation run in the current directory.

Usually one is not directly interested in the raw data that is produced but wants to produce either a figure for a publication or some post-processing of the data. calculation contains multiple quantities that enable these kinds of workflows by extracting the relevant data from the HDF5 file and transforming them into an accessible format.

Generally, all quantities provide a read function that extracts the data from the HDF5 file and puts it into a Python dictionary. Where it makes sense in addition a plot function is available that converts the data into a figure for Jupyter notebooks. In addition, data conversion routines to_X may be available transforming the data into another format or file, which may be useful to generate plots with tools other than Python. For the specifics, please refer to the documentation of the individual quantities.

calculation reads the raw data from the current directory and from the default VASP output files. With the Calculation class, you can tailor the location of the files to your needs and both have access to the same quantities.

We demonstrate this setting up some example data in a temporary directory path and changing to it.

>>> import os
>>> from py4vasp import demo
>>> _ = demo.calculation(path)
>>> os.chdir(path)  # change to a temporary directory

Then the two following examples are equivalent:

using calculation object

>>> from py4vasp import calculation
>>> calculation.dos.read()
{'energies': array(...), 'total': array(...), 'fermi_energy': ...}

using Calculation class

>>> from py4vasp import Calculation
>>> calculation = Calculation.from_path(".")
>>> calculation.dos.read()
{'energies': array(...), 'total': array(...), 'fermi_energy': ...}

In the latter example, you could directly provide a path and do not need to have the data in the current directory.

Available quantities

band
The band structure contains the k point resolved eigenvalues.
bandgap
This class describes the band extrema during the relaxation or MD simulation.
born_effective_charge
The Born effective charge tensors couple electric field and atomic displacement.
current_density
Represents current density on the grid in the unit cell.
density
This class accesses various densities (charge, magnetization, …) of VASP.
dielectric_function
The dielectric function describes the material response to an electric field.
dielectric_tensor
The dielectric tensor is the static limit of the dielectric function.
dos
The density of states (DOS) describes the number of states per energy.
effective_coulomb
Effective Coulomb interaction U obtained with the constrained random phase approximation (cRPA).
elastic_modulus
The elastic modulus is the second derivative of the energy with respect to strain.
electron_phonon.bandgap
ElectronPhononBandgap provides access to the electron-phonon bandgap renormalization data and selection utilities.
electron_phonon.chemical_potential
Provides access to the electron-phonon chemical potential data calculated during an electron-phonon calculation.
electron_phonon.self_energy
Access and analyze electron-phonon self-energy data.
electron_phonon.transport
Provides access to electron-phonon transport data and selection utilities.
electronic_minimization
Access the convergence data for each electronic step.
energy
The energy data for one or several steps of a relaxation or MD simulation.
exciton.density
This class accesses exciton charge densities of VASP.
exciton.eigenvector
BSE can compute excitonic properties of materials.
force
The forces determine the path of the atoms in a trajectory.
force_constant
Force constants are the 2nd derivatives of the energy with respect to displacement.
internal_strain
The internal strain is the derivative of energy with respect to displacement and strain.
kpoint
The k-point mesh used in the VASP calculation.
local_moment
The local moments describe the charge and magnetization near an atom.
nics
This class accesses information on the nucleus-independent chemical shift (NICS).
pair_correlation
The pair-correlation function measures the distribution of atoms.
partial_density
Partial charges describe the fraction of the charge density in a certain energy, band, or k-point range.
phonon.band
The phonon band structure contains the q-resolved phonon eigenvalues.
phonon.dos
The phonon density of states (DOS) describes the number of modes per energy.
phonon.mode
Describes a collective vibration of atoms in a crystal.
piezoelectric_tensor
The piezoelectric tensor is the derivative of the energy with respect to strain and field.
polarization
The static polarization describes the electric dipole moment per unit volume.
potential
The local potential describes the interactions between electrons and ions.
projector
The projectors used for atom and orbital resolved quantities.
run_info
Contains information about the VASP run.
stress
The stress describes the force acting on the shape of the unit cell.
structure
The structure contains the unit cell and the position of all ions within.
system
The SYSTEM tag in the INCAR file is a title you choose for a VASP calculation.
velocity
The velocities describe the ionic motion during an MD simulation.
workfunction
The workfunction describes the energy required to remove an electron to the vacuum.