Main class

class storq.vasp.core.Vasp(label, restart=True, ignore_bad_restart_file=False, atoms=None, scratch=None, exception_handler=<function VaspExceptionHandler>, **kwargs)[source]

Class for doing VASP calculations.

POTCARs can be found in:

  • label (str) – the directory where the calculation files will be and the calculation run.
  • exception_handler (func) – A function for handling exceptions. The function should take the arguments returned by sys.exc_info(), which is the exception type, value and traceback. The default is VaspExceptionHandler.
  • **kwargs

    Any VASP INCAR keyword can be used, e.g., encut=450.

    The tag will be converted to upper case when written, and the value is written depending on its type. E.g. integers, floats and strings are written as they are. True/False is written as .TRUE. and .FALSE. and Python lists/tuples are written as space delimited lists.

    Special kwargs are described in the following.

  • xc (string) – functional to use. It is expanded from Vasp.xc_defaults to the relevant Vasp tags.
  • kpts (list/dict) –
    1. a list with 3 elements containing the k-point mesh divisions
    2. a dictionary containing key-value pairs:
      • size (list)
      • spacing (float)
      • auto (float)
      • list (list)
      • lines (list):
      • gamma (bool): if False use Monkhorst-Pack, else Gamma-centered
      • shift (list): shift of the k-point grid
      • intersections: number of intersections used in line vasp_mode
      • cartesian (bool)
  • setups (list) –

    Special setups for the POTCARS. It is a list of the following items

    (atom_index, suffix) for exampe: (2, '_sv')

    (atom_symbol, suffix) for example ('Zr', '_sv')

    If (atom_index, suffix) is used then only that atom index will have a POTCAR defined by '{}{}'.format(atoms[atom_index].symbol, suffix)

    If (atom_symbol, suffix) is used then atoms with that symbol (except any identified by (atom_index, suffix) will use a POTCAR defined by '{}{}'.format(atom_symbol, suffix)

    This syntax has changed from the old dictionary format. The reason for this is that this sorting must be deterministic. Getting keys in a dictionary is not deterministic.

  • ldau_luj (dict) –

    This is a dictionary to set the DFT+U tags. For example, to put U=4 on the d-orbitals (L=2) of Cu, and nothing on the oxygen atoms in a calculation use:

    ldau_luj={'Cu':{'L': 2, 'U':4.0, 'J':0.0},
              'O': {'L':-1, 'U':0.0, 'J':0.0}},
NEB = 10
NEW = 1
calculation_required(atoms=None, properties=['energy'])[source]

Checks whether a calculation is needed.

Uses the calculators internal state to judge whether a calculation should be run. The result will be influenced by the calculator settings, e.g., whether strict convergence checks are enforced or not.

  • atoms (Atoms) – Required by the ASE interface
  • properties (list) – Required by the ASE interface

True if calculationn needs to be run

Return type:



Checks whether a calculation has converged.

Performs a strict convergence checks in the sense that electronic as well as ionic convergence is explicitly chechked for by comparing their magnitude to EDIFF and EDIFFG.

Returns:True if calculation is converged.
Return type:bool

Check whether a NEB calculation is about to be performed.

Returns:True if we have a NEB calculation.
Return type:bool

Check if VASP finished properly.

If VASP itself is cancelled (batch_walltime or explicitly by user) or encounters certain errors it won’t ouput the typical Voluntary context switch count on the last line.

Returns:True if VASP finished properly.
Return type:bool

Check if VASP’s internal ionic optimization routines converged.

Mainly functions as a support method for check_convergence.

Returns:True if forces are converged.
Return type:bool

Check if any changes exist that require new calculations.

Parameters:atoms (Atoms) – Required by the ASE interface
clone(newdir, set_label=True)[source]

Copy the calculation directory to newdir and set label to newdir.

command = None
config_file = '/root/.config/storq/site.json'

Changes the configuration of the VASP calculator.

Only allows changes to the calculator and not the site configurations relating to the cluster resourse manager. Note that any changes made to the configuration will be written to a database and persist until changed. Note that there exists allowed shorthands for certain options.

Parameters:**kwargs – One or more kwargs corresponding to settings to be changed.
debug = None
default_parameters = {'ismear': 1, 'kpts': {'size': [1, 1, 1], 'gamma': False, 'shift': [0.0, 0.0, 0.0], 'surface': False}, 'lcharg': False, 'lwave': False, 'pp': 'PBE', 'sigma': 0.1, 'xc': 'PBE'}

Describe the parameters used with docstrings in vasp_validate.

get_forces(*args, **kwargs)

Patched force getter.

Wrapped in vasp.tryit.

get_potential_energy(*args, **kwargs)

Patched potential energy getter.

Wrapped in vasp.tryit.

get_property(name, atoms=None, allow_calculation=True)[source]

Get a property from the self.results dict.

This is called by several ASE mandated getters and overwrites the ASE parent method to remove some redudandant parsing.

  • name (str) – Name of the property to get.
  • atoms (Atoms) – Required by the ASE interface.
  • allow_calculation (bool) – Required by the ASE interface (not used).

The object representing the desired result.

Return type:



Determine calculation state based on directory contents.

This method is only responsible for determining the state and does not act upon it. Other methods that cause a transition to a known state should alter the state themselves.

Returns:An integer corresponding to the internal state of the calculator.
Return type:int
get_stress(*args, **kwargs)

Patched stress getter.

Wrapped in vasp.tryit.

implemented_properties = ['energy', 'free_energy', 'forces', 'stress', 'charges', 'dipole', 'magmom', 'magmoms']
name = 'VASP'
ready(*args, **kwargs)

Check if the calculation is ready to be parsed.

The outcome will be heavily dependent on the calculator configuration. For instance if the highest level of convergence check is enabled this will be enforced when checking for readiness.

Returns:True if the calculation is ready.
Return type:bool

Wrapped in vasp.tryit.


Overwrites the ASE parent method to avoid killing self.atoms.


Convenience function to run calculators.


Set working directory.

Note that With regards to the ASE FileIOCalculator interface there is no prefix, only a working directory.

Parameters:label (string) – Absolute or relative path to the VASP calculation directory, i.e. where all input/output files related to VASP are put.
siteconf = None

Generate resort list, and make list of POTCARs to use.

Parameters:atoms (Atoms) – Atoms object to sort
special_kwargs = ['xc', 'pp', 'setups', 'kpts', 'ldau_luj']

Stops the program based on the boolean evaluation of condition.


Get a trajectory.

This reads Atoms objects from vasprun.xml. By default returns all images. If index is an integer, return that image.

Technically, this is just a list of atoms with a SinglePointCalculator attached to them.

This is usually only relevant if you have done a relaxation. If the calculation is an NEB, the images are returned.

Returns:Atoms objects representing the trajectory
Return type:list

Updates calculator.

This is called by any getter that wants to run a calculation. Checks if a calculation is required and if not, whether it is already been parsed.

Parameters:atoms (Atoms) – Required by the ASE interface
version = '1.0.0'

Visualize the calculation.

Parameters:index (int) – Index of a particular snapshot to view.
Return type:ASE gui view of the trajectory.
xc_defaults = {'am05': {'pp': 'LDA', 'gga': 'AM'}, 'b3lyp': {'pp': 'LDA', 'gga': 'B3', 'lhfcalc': True, 'aexx': 0.2, 'aggax': 0.72, 'aggac': 0.81, 'aldac': 0.19}, 'beef-vdw': {'pp': 'PBE', 'gga': 'BF', 'luse_vdw': True, 'zab_vdw': -1.8867, 'lbeefens': True}, 'cx': {'pp': 'PBE', 'gga': 'CX', 'luse_vdw': True, 'aggac': 0.0}, 'gga': {'pp': 'GGA'}, 'hf': {'pp': 'PBE', 'lhfcalc': True, 'aexx': 1.0, 'aldac': 0.0, 'aggac': 0.0}, 'hse03': {'pp': 'LDA', 'gga': 'PE', 'lhfcalc': True, 'hfscreen': 0.3}, 'hse06': {'pp': 'LDA', 'gga': 'PE', 'lhfcalc': True, 'hfscreen': 0.2}, 'lda': {'pp': 'LDA'}, 'm06l': {'pp': 'PBE', 'metagga': 'M06L'}, 'optb86b-vdw': {'pp': 'LDA', 'gga': 'MK', 'luse_vdw': True, 'aggac': 0.0, 'param1': 0.1234, 'param2': 1.0}, 'optb88-vdw': {'pp': 'LDA', 'gga': 'BO', 'luse_vdw': True, 'aggac': 0.0, 'param1': 0.18333333333333335, 'param2': 0.22}, 'optpbe-vdw': {'pp': 'LDA', 'gga': 'OR', 'luse_vdw': True, 'aggac': 0.0}, 'pbe': {'pp': 'PBE'}, 'pbe0': {'pp': 'LDA', 'gga': 'PE', 'lhfcalc': True}, 'pbesol': {'pp': 'LDA', 'gga': 'PS'}, 'revpbe': {'pp': 'LDA', 'gga': 'RE'}, 'revtpss': {'pp': 'PBE', 'metagga': 'RTPSS'}, 'rpbe': {'pp': 'LDA', 'gga': 'RP'}, 'tpss': {'pp': 'PBE', 'metagga': 'TPSS'}, 'vdw-df2': {'pp': 'LDA', 'gga': 'ML', 'luse_vdw': True, 'aggac': 0.0, 'zab_vdw': -1.8867}}
storq.vasp.core.VaspExceptionHandler(calc, exc_type, exc_value, exc_traceback)[source]

Handle exceptions.