atlas.active_learning.md package

Molecular dynamics simulation utilities.

Submodules

atlas.active_learning.md.ase_calculators module

Custom ASE calculators for ATL active learning.

class atlas.active_learning.md.ase_calculators.ATLSafeCalculatorWrapper(calculator, max_energy_threshold_per_atom, atoms=None, **kwargs)

Bases: Calculator

A wrapper around an ASE calculator that checks for unphysical energies (too high, NaN, or Inf) or forces (NaN or Inf) and raises UnphysicalStateError to allow for graceful termination of MD.

calculate(atoms: Atoms, properties, system_changes)

Perform the calculation.

This method calls the wrapped calculator and then checks the results.

get_property(name, atoms=None, allow_calculation=True)

Get a property from the calculator.

This ensures that even direct calls like atoms.get_potential_energy() go through the check if a calculation is triggered.

implemented_properties: list[str] = None

Properties calculator can handle (energy, forces, …)

exception atlas.active_learning.md.ase_calculators.UnphysicalStateError

Bases: Exception

Custom exception raised when unphysical energies or forces are detected.

atlas.active_learning.md.atl_process_structure module

Script to run MACE MD simulations, descriptor generation and extrapolation checks.

This script is part of ATLAS’s active learning loop, and is used to combine in one single calculation job the acquisition of the MD trajectory, the generation of the descriptors followed by performing any extrapolation checks, filtering the MD trajectory if necessary.

atlas.active_learning.md.atl_process_structure.check_traj_in_domain(concave_hull: ndarray, descriptor_dict: dict, hull_scale_factor: float = 0.0) tuple[ndarray, ndarray, ndarray, list | ndarray | None]

Check if the generated descriptors are inside the precomputed concave hull.

Parameters:
  • concave_hull (np.ndarray) – Concave hull of the latent space for the database, corresponding to its convex or concave hull.

  • descriptor_dict (dict) –

    Descriptor dictionary containing the descriptors for each frame. The structure is as follows: ```python {

    uuid: {

    ‘latent_space’: np.ndarray, ‘descriptors’: np.ndarray, ‘is_extrapolating’: np.ndarray,

    }

  • hull_scale_factor (float, optional) – Tolerance percentage to enlarge the concave hull. For example, 0.1 adds 10% tolerance. Default is 0.0.

Returns:

  • np.ndarray – Array containing the descriptors that are inside the concave hull.

  • np.ndarray – Array containing the descriptors that are outside the concave hull.

  • np.ndarray – Array containing boolean values showing if the frame is inside the concave

atlas.active_learning.md.atl_process_structure.define_allowed_stages(md_stages: dict, current_al_step: int, init_structure: Atoms) list[int]

Define allowed MD stages based on the current active learning step.

Parameters:
  • md_stages (dict) – Dictionary containing the MD stages settings.

  • current_al_step (int) – Current active learning iteration step.

  • init_structure (Atoms) – Initial structure object, used to determine the type from its info dict, one of: ‘bulk’, ‘surface’ or ‘cluster’

Returns:

List of allowed stage names.

Return type:

list[int]

atlas.active_learning.md.atl_process_structure.limit_md_frames(md_traj: Atoms, md_params: dict)

Limit the number of frames in the MD trajectory.

Parameters:
  • md_traj (Atoms) – MD trajectory.

  • md_params (dict) – Dictionary containing the ATL settings for MD.

Returns:

  • list – List containing the MD trajectory with the limited number of frames.

  • list – Mask containing the indices of the frames that were kept.

atlas.active_learning.md.atl_process_structure.simple_extrapolation_check(curr_it_db_max: ndarray, curr_it_db_min: ndarray, descriptor_dict: dict)

Apply a basic extrapolation check based on the maximum and minimum values of the descriptors for the entire database.

Parameters:
  • curr_it_db_max (np.ndarray) – Maximum value for the descriptors for the entire database.

  • curr_it_db_min (np.ndarray) – Minimum value for the descriptors for the entire database.

  • descriptor_dict (dict) – Descriptor dictionary containing the descriptors for each frame.

Returns:

Updated descriptor dictionary with the extrapolation check applied.

Return type:

dict

atlas.active_learning.md.md_utils module

Utilities for molecular dynamics.

class atlas.active_learning.md.md_utils.CoexistenceMDTemperatureLogger(dyn: ~typing.Any, atoms: ~ase.atoms.Atoms, logfile: ~typing.IO | str, header: bool = True, stress: bool = False, peratom: bool = False, mode: str = 'a', comm=<ase.parallel.MPI object>)

Bases: IOContext

Class for logging molecular dynamics simulations.

Parameters:
  • dyn (The dynamics. Only a weak reference is kept.)

  • atoms (The atoms.)

  • logfile (File name or open file, "-" meaning standard output.)

  • stress=False (Include stress in log.)

  • peratom=False (Write energies per atom.)

  • mode="a" (How the file is opened if logfile is a filename.)

Module contents

MD simulation utilities including safe calculator wrapper.