matcalc._neb module

NEB calculations.

class MEP(structures: list[Structure], energies: list[float])[source]

Bases: object

Minimum Energy Path dataclass for NEB calculations.

Stores MEP results in a data-efficient format where labels are stored once, and only fractional coordinates and lattices vary between images.

Initialize MEP from structures and energies.

Parameters:
  • structures – List of pymatgen Structures.

  • energies – List of energies for each image.

as_dict() dict[str, Any][source]

Convert MEP to a data-efficient dictionary representation.

Returns:

  • “labels”: List of species strings (stored once)

  • ”lattice”: Lattice matrix as a 3x3 array (only if same for all images)

  • ”images”: List of dictionaries, each containing:
    • ”lattice”: Lattice matrix as a 3x3 array (only if different per image)

    • ”frac_coords”: Fractional coordinates for the image

    • ”energy”: Energy for the image

Return type:

Dictionary with

energies: list[float][source]

Energy for each image.

frac_coords: list[ndarray][source]

Fractional coordinates for each image.

classmethod from_dict(d: dict[str, Any]) MEP[source]

Reconstruct MEP from a dictionary representation.

Parameters:

d – Dictionary with keys “labels” and “images” as returned by as_dict(). May also contain “lattice” at top level if same for all images.

Returns:

MEP instance reconstructed from the dictionary.

get_lattices_list() list[ndarray][source]

Get lattices as a list, expanding a single lattice if needed.

get_structures() list[Structure][source]

Get all images as a list of pymatgen Structures.

Returns:

List of Structure objects, one for each image in the MEP.

labels: list[Species][source]

Species labels for all atoms (same for all images).

lattices: ndarray | list[ndarray][source]

Lattice matrix(ces). If a single array, applies to all images. If a list, one per image.

class NEBCalc(calculator: Calculator | str, *, optimizer: str | Optimizer = 'BFGS', traj_folder: str | None = None, interval: int = 1, climb: bool = True, fmax: float = 0.1, method: str = 'improvedtangent', max_steps: int = 1000, **kwargs: Any)[source]

Bases: PropCalc

NEB calculator.

Initialize the instance of the class.

Parameters:
  • calculator (Calculator | str) – An ASE calculator object used to perform energy and force calculations. If string is provided, the corresponding universal calculator is loaded.

  • optimizer (str | Optimizer, optional) – The optimization algorithm to use. Defaults to “BFGS”.

  • traj_folder (str | None, optional) – The folder to save trajectory information. Defaults to None.

  • interval (int, optional) – The interval for recording trajectory information. Defaults to 1.

  • climb (bool, optional) – Whether to perform climbing image nudged elastic band (CI-NEB). Defaults to True.

  • fmax (float, optional) – The maximum force tolerance for convergence. Defaults to 0.1.

  • max_steps (int, optional) – The maximum number of optimization steps. Defaults to 1000.

  • **kwargs (Any) – Additional keyword arguments.

Returns:

None

_abc_impl = <_abc._abc_data object>[source]
calc(structure: Structure | Atoms | dict[str, Any]) dict[str, Any][source]

Calculate the energy barrier using the nudged elastic band method.

Parameters:

structure (-) – A dictionary containing the images with keys ‘image0’, ‘image1’, etc. Must be of type dict.

Returns:

  • “barrier” (float): The energy barrier of the reaction pathway.

  • ”force” (float): The force exerted on the atoms during the NEB calculation.

  • ”mep” (MEP): An MEP dataclass containing the images and their respective energies.

Return type:

dict

calc_images(start_struct: Structure, end_struct: Structure, *, n_images: int = 7, interpolate_lattices: bool = False, autosort_tol: float = 0.5) dict[str, Any][source]

Calculate NEB images between given start and end structures.

Parameters:
  • start_struct (Structure) – Initial structure.

  • end_struct (Structure) – Final structure.

  • n_images (int) – Number of images to calculate (default is 7).

  • interpolate_lattices (bool) – Whether to interpolate lattices between start and end structures (default is False).

  • autosort_tol (float) – Tolerance for autosorting the images (default is 0.5).

Returns:

NEB calculation object containing the interpolated images.

Return type:

NEBCalc