autojob.harvest.harvesters namespace

Submodules

autojob.harvest.harvesters.bader module

Bader charge analysis harvesting utilities.

This module defines the harvest_bader_results() and parse_acf() functions and the BaderAnalysis class. harvest_bader_results() and parse_acf() can be used to parse Bader analysis data. The BaderAnalysis class is the data model for Bader analysis data.

Example

from pathlib import Path from autojob.harvest.harvesters.bader import harvest_bader_results

outputs = harvest_bader_results(Path.cwd())

class autojob.harvest.harvesters.bader.BaderAnalysis[source]

Bases: TypedDict

Bader change analysis data.

Variables:
  • positions (list[list[float]]) – The positions of each Bader volume.

  • min_dist (list[float]) – A list of floats specifying the minimum distances between each Bader volume and its nearest neighbor.

  • charge (list[float]) – A list of floats specifying the charge containing in each Bader volume.

  • atomic_volume (list[float]) – A list of floats specifying the size (in cubic Angstroms) of each Bader volume.

  • charge_transfer (list[float] | None) – A list of floats specifying the net number of electrons in each Bader volume. Positive values indicate net negative charge for the atom centered in the Bader volume.

  • vacuum_charge (float) – The system’s vacuum charge.

  • vacuum_volume (float) – The system’s vacuum volume.

  • nelectrons (float) – The total number of electrons in the system.

atomic_volume: list[float]
charge: list[float]
charge_transfer: list[float] | None
min_dist: list[float]
nelectrons: float
positions: list[list[float]]
vacuum_charge: float
vacuum_volume: float
autojob.harvest.harvesters.bader.harvest_bader_results(src: str | Path) BaderAnalysis[source]

Harvest VASP-derived Bader charge analysis results from a directory.

Parameters:

src – The path to a directory containing Bader calculation files. The directory must contain the ACF.dat file and, if charge transfer is desired, the vasprun.xml file as well.

Returns:

A BaderAnalysis object.

Warning

When calculating charge transfer, this method assumes that the order of charge volumes identified by the Bader program corresponds to that of the atomic positions found in the vasprun.xml file.

autojob.harvest.harvesters.bader.parse_acf(src: str | Path) BaderAnalysis[source]

Parse the Bader output file (ACF.dat).

Parameters:

src – The path to a directory containing Bader calculation files.

Returns:

A dictionary containing the location, charge, volume, and minimum distance (to other Bader volumes) for each Bader volume found by the Bader program. The dictionary also contains the vacuum charge, vacuum volume, and total number of electrons in the charge density.

autojob.harvest.harvesters.ddec6 module

DDEC6 charge analysis harvesting utilities.

This module defines the get_ddec6_index_map() and harvest_ddec6_results() functions and the DDEC6Analysis class. get_ddec6_index_map() and harvest_ddec6_results() can be used to parse DDEC6 charge data. DDEC6Analysis is the data model for DDEC6 charge analysis data.

Example

from pathlib import Path from autojob.harvest.harvesters.ddec6 import harvest_ddec6_results

outputs = harvest_ddec6_results(Path.cwd())

class autojob.harvest.harvesters.ddec6.BondOrders[source]

Bases: TypedDict

Bond order information between a “primary” atom and other atoms.

Variables:
bond_order_sum: float
bonded_to: list[BondedToDict]
element: <lambda>, return_type=str, when_used=always)]
class autojob.harvest.harvesters.ddec6.BondedToDict[source]

Bases: TypedDict

Bond order information between a primary atom and another atom.

This dictionary assumes knowledge of the primary atom.

Variables:
  • index (int) – The index of the non-primary atom.

  • element (pymatgen.core.periodic_table.Element) – The element of the non-primary atom.

  • bond_order (float) – The order of the bond between the primary atom and the atom specified by the "index" and "element" keys.

  • direction (tuple[float, float, float]) – The direction of the bond between the primary atom and the atom specified by the "index" and "element" keys.

  • spin_polarization (float) – The spin polarization of the bond between the primary atom and the atom specified by the "index" and "element" keys.

bond_order: float
direction: tuple[float, float, float]
element: <lambda>, return_type=str, when_used=always)]
index: int
spin_polarization: float
class autojob.harvest.harvesters.ddec6.DDEC6Analysis[source]

Bases: TypedDict

DDEC6 analysis data.

Variables:
  • partial_charges (list[float]) – A list of floats representing the partial charges.

  • spin_moments (list[float]) – A list of floats representing the first spin moments.

  • dipoles (list[list[float]]) – A list of floats representing the dipoles.

  • rsquared_moments (list[float]) – A list of floats representing the second spin moments.

  • rcubed_moments (list[float]) – A list of floats representing the third spin moments.

  • rfourth_moments (list[float]) – A list of floats representing the fourth spin moments.

  • bond_order_dict (dict[int, autojob.harvest.harvesters.ddec6.BondOrders]) – A dictionary mapping atomic indices to bond order dictionaries. Each bond order dictionary maps atomic indices to bond order information between other atoms. The keys are the indices of the “primary” atoms mentioned in the class docstrings of BondedToDict and BondOrders.

bond_order_dict: dict[int, BondOrders]
dipoles: list[list[float]]
partial_charges: list[float]
rcubed_moments: list[float]
rfourth_moments: list[float]
rsquared_moments: list[float]
spin_moments: list[float]
autojob.harvest.harvesters.ddec6.get_ddec6_index_map(src: str | Path, *, tol: float = 0.001) list[int][source]

Map DDEC6 structure indices to ASE structure indices.

The ASE index of the atom at index i in the DDEC6 structure can be found as follows:

index_map = get_ddec6_index_map(dir_name) index = index_map[i]

Parameters:
  • src – The directory containing a calculation.

  • tol – The maximum allowed deviation in atomic positions in Angstroms.

autojob.harvest.harvesters.ddec6.harvest_ddec6_results(src: str | Path) DDEC6Analysis[source]

Harvest DDEC6 charge analysis results from a directory.

Parameters:

src – The directory of the completed calculation.

Returns:

A DDEC6Analysis dictionary.

Warning

The success of this function depends on whether get_ddec6_index_map() accurately maps the indices of the structure identified by the pymatgen ChargemolAnalysis runner.

autojob.harvest.harvesters.default module

Default calculation harvesting utilities.

This module defines the harvest_default_calculator_results() function which can be used as a default harvester for calculations.

Example

from pathlib import Path from autojob.harvest.harvesters.espresso import harvest_default_calculator_results

outputs = harvest_default_calculator_results(Path.cwd())

autojob.harvest.harvesters.default.harvest_default_calculator_results(src: str | Path) dict[str, Any][source]

Harvest calculation results from a directory using a default method.

Parameters:

src – The directory from which to load the calculation results.

Returns:

A dictionary containing calculation results.

Note

If SETTINGS.STRICT_MODE is true, this method may re-raise one of AttributeError, FileNotFound, or KeyError.

autojob.harvest.harvesters.espresso module

Espresso calculation harvesting utilities.

This module defines the harvest_espresso_results() function which can be used to harvest Quantum Espresso results from a directory.

Example

from pathlib import Path from autojob.harvest.harvesters.espresso import harvest_espresso_results

outputs = harvest_espresso_results(Path.cwd())

autojob.harvest.harvesters.espresso.harvest_espresso_results(src: str | Path) dict[str, Any][source]

Harvest Quantum Espresso calculation results from a directory.

Parameters:

src – The directory containing the Espresso (PWscf) output files.

Returns:

A dictionary containing Espresso calculation outputs.

Warning

That a calculation has converged must be confirmed manually as the value of the "converged" key is always set to False.

autojob.harvest.harvesters.gaussian module

Gaussian calculation harvesting utilities.

This module defines the harvest_gaussian_results() function which can be used to harvest Gaussian results from a directory.

Example

from pathlib import Path from autojob.harvest.harvesters.gaussian import harvest_gaussian_results

outputs = harvest_gaussian_results(Path.cwd())

autojob.harvest.harvesters.gaussian.harvest_gaussian_results(src: str | Path) dict[str, Any][source]

Harvest Gaussian calculation results from a directory.

Note that all quantities other than the final energy are reported in atomic units (Hartree/Bohr).

Parameters:

src – The directory containing the Gaussian output files.

Returns:

A dictionary containing Gaussian calculation outputs.

autojob.harvest.harvesters.gpaw module

GPAW calculation harvesting utilities.

This module defines the harvest_gpaw_results() function which can be used to harvest GPAW results from a directory.

To ensure that outputs can be harvested from a directory, the GPAW log file should be named with GPAW_LOG or GPAW_LOG should be set to the value of GPAW output file.

>>> from autojob.harvest.harvesters.gpaw import GPAW_LOG
>>> from autojob.tasks.calculation import CalculationInputs

>>> calc_inputs = CalculationInputs(
...     calculator="gpaw",
...     calc_params={
...         "mode": "pw",
...         "txt": GPAW_LOG,
...     },
... )

Example

from pathlib import Path from autojob.harvest.harvesters.gpaw import harvest_gpaw_results

outputs = harvest_gpaw_results(Path.cwd())

autojob.harvest.harvesters.gpaw.harvest_gpaw_results(src: str | Path) dict[str, Any][source]

Harvest GPAW calculation results from a directory.

Parameters:

src – The directory containing the GPAW output file.

Returns:

A dictionary containing GPAW calculation outputs.

Warning

That a calculation has converged must be confirmed manually as the value of the "converged" key is always set to False.

autojob.harvest.harvesters.vasp module

VASP calculation harvesting utilities.

This module provides the harvest_vasp_results() and get_output_atoms() functions for retrieving calculation outputs and output atoms from the directory of a VASP calculation.

Example

from pathlib import Path from autojob.harvest.harvesters.vasp import get_output_atoms from autojob.harvest.harvesters.vasp import harvest_vasp_results

outputs = harvest_vasp_results(Path.cwd()) atoms = get_output_atoms(Path.cwd())

autojob.harvest.harvesters.vasp.get_output_atoms(src: str | Path, alt_filename_index: int | None = None, input_atoms: Atoms | None = None) Atoms[source]

Retrieve an Atoms object representing the output structure.

This function also copies tags and constraints from the input structure in the case that the output structure must be read from a non-ASE file (e.g., vasprun.xml).

Parameters:
  • src – The directory from which to retrieve the output structure.

  • alt_filename_index – An integer pointing to which alternative structure file should be used. This number will be used to index ALTERNATE_OUTPUT_STRUCTURES.

  • input_atoms – An Atoms object representing the corresponding input structure.

Returns:

An Atoms object representing the output structure.

autojob.harvest.harvesters.vasp.harvest_vasp_results(src: str | Path) dict[str, Any][source]

Harvest VASP calculation results from a directory.

Parameters:

src – The directory from which to load VASP outputs.

Returns:

A dictionary with, at minimum, the required keys to initialize a autojob.calculation.calculation.Calculation but also with same keys as an instance of emmet.core.tasks.OutputDoc and additional keys mapping to a dictionary representation of a pymatgen.io.vasp.outputs.Vasprun object and a dictionary representation of a pymatgen.electronic_structure.dos.CompleteDos object.