Calculation

class py4vasp.Calculation(*args, **kwargs)

Manage access to input and output of single VASP calculation.

The calculation module always reads the VASP calculation from the current working directory. This class gives you a more fine grained control so that you can use a Python script or Jupyter notebook in a different folder or rename the files that VASP produces.

To create a new instance, you should use the classmethod from_path() or from_file() and not the constructor. This will ensure that the path to your VASP calculation is properly set and all features work as intended. The two methods allow you to read VASP results from a specific folder other than the working directory or a nondefault file name.

With the Calculation instance, you can access the quantities VASP computes via the attributes of the object. The attributes are the same provided by the calculation module. You can find links to how to use these quantities below.

Examples

>>> calc = Calculation.from_path("path_to_your_calculation")
>>> calc.dos.plot()         # to plot the density of states
>>> calc.magnetism.read()   # to read the magnetic moments
>>> calc.structure.print()  # to print the structure in a POSCAR format

from_file(file_name)

Set up a Calculation from a particular file.

from_path(path_name)

Set up a Calculation for a particular path and so that all files are opened there.

path()

Return the path in which the calculation is run.

INCAR

The INCAR file of the VASP calculation.

KPOINTS

The KPOINTS file of the VASP calculation.

POSCAR

The POSCAR file of the VASP calculation.

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.

CONTCAR

CONTCAR contains structural restart-data after a relaxation or MD simulation.

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.

elastic_modulus

The elastic modulus is the second derivative of the energy with respect to strain.

energy

The energy data for one or several steps of a relaxation or MD simulation.

fatband

BSE fatbands illustrate the 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.

magnetism

The local moments describe the charge and magnetization near an atom.

pair_correlation

The pair-correlation function measures the distribution of atoms.

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.

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.

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.

topology

The topology of the crystal describes the ions of a crystal and their connectivity.

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.

property INCAR

The INCAR file of the VASP calculation.

property KPOINTS

The KPOINTS file of the VASP calculation.

property POSCAR

The POSCAR file of the VASP calculation.

classmethod from_file(file_name)

Set up a Calculation from a particular file.

Typically this limits the amount of information, you have access to, so prefer creating the instance with the from_path() if possible.

Parameters:

file_name (str of pathlib.Path) – Name of the file from which the data is read.

Returns:

A calculation accessing the data in the given file.

Return type:

Calculation

classmethod from_path(path_name)

Set up a Calculation for a particular path and so that all files are opened there.

Parameters:

path_name (str or pathlib.Path) – Name of the path associated with the calculation.

Returns:

A calculation associated with the given path.

Return type:

Calculation

path()

Return the path in which the calculation is run.