vasppy.calculation module

class Calculation(title, energy, stoichiometry)[source]

Bases: object

class describing a single VASP calculation

Initialise a Calculation object

Parameters:
  • title (Str) – The title string for this calculation.

  • energy (Float) – Final energy in eV.

  • (Dict{Str (stoichiometry) – Int}): A dict desribing the calculation stoichiometry, e.g. { ‘Ti’: 1, ‘O’: 2 }

Returns:

None

scale_stoichiometry(scaling)[source]

Scale the Calculation stoichiometry Returns the stoichiometry, scaled by the argument scaling.

Parameters:

scaling (float) – The scaling factor.

Returns:

Int)): The scaled stoichiometry as a Counter of label: stoichiometry pairs

Return type:

(Counter(Str

delta_E(reactants, products, check_balance=True)[source]

Calculate the change in energy for reactants –> products.

Parameters:
  • reactants (list(vasppy.Calculation)) – A list of vasppy.Calculation objects. The initial state.

  • products (list(vasppy.Calculation)) – A list of vasppy.Calculation objects. The final state.

  • check_balance (bool, optional) – Check that the reaction stoichiometry is balanced. Default is True.

Returns:

(float) The change in energy.

delta_stoichiometry(reactants, products)[source]

Calculate the change in stoichiometry for reactants –> products.

Parameters:
  • reactants (list(vasppy.Calculation) – A list of vasppy.Calculation objects. The initial state.

  • products (list(vasppy.Calculation) – A list of vasppy.Calculation objects. The final state.

Returns:

The change in stoichiometry.

Return type:

(Counter)

energy_string_to_float(string)[source]

Convert a string of a calculation energy, e.g. ‘-1.2345 eV’ to a float.

Parameters:

string (str) – The string to convert.

Return

(float)

import_calculations_from_file(filename, skip_incomplete_records=False)[source]

Construct a list of Calculation objects by reading a YAML file. Each YAML document should include title, stoichiometry, and energy fields, e.g.:

title: my calculation
stoichiometry:
    - A: 1
    - B: 2
energy: -0.1234 eV

Separate calculations should be distinct YAML documents, separated by

Parameters:
  • filename (str) – Name of the YAML file to read.

  • skip_incomplete_records (bool) – Do not parse YAML documents missing one or more of the required keys. Default is False.

Returns:

A dictionary of Calculation objects. For each Calculation object, the title field from the YAML input is used as the dictionary key.

Return type:

(dict(vasppy.Calculation))