ASEWrappers package

Submodules

ASEWrappers.DataContainer module

class ASEWrappers.DataContainer.DataTrajectory(initial_atomic_structure)[source]

Bases: object

append(frame)[source]
Parameters:

frame (Frame)

storeTxtFile()[source]
class ASEWrappers.DataContainer.Frame(time, data_dict)[source]

Bases: object

property keys
property vals

ASEWrappers.atomic_structure module

class ASEWrappers.atomic_structure.AtomicStructure(atoms, supercells=[1, 1, 1], special_label=None, label=None)[source]

Bases: object

Wrapper for the ASE atoms object and a Potential.

This class provides a way to represent an atomic structure inluding its potential. It provides methods to compute relevant instantaneous quantities as well as some conveniance features for a better MD workflow.

Parameters:

atoms (ase.Atoms)

_atoms

The underlying atoms object

Type:

ASE Atoms

_label

A unique hashlabel for the structure

Type:

str

property cell

3×3 cell matrix defining the simulation cell.

Type:

numpy.ndarray

property cellpar

Cell parameters (a, b, c, α, β, γ).

Type:

numpy.ndarray

cohesive_energy(potential_energy=None)[source]

Compute the cohesive energy per atom.

Cohesive energy is defined as the difference between the sum of isolated atomic energies and the bulk structure energy, divided by the number of atoms:

E_coh = (Σ E_atom − E_bulk) / N

Parameters:

potential_energy (float, optional) – Bulk structure potential energy (eV). If not provided, it is computed automatically.

Returns:

Cohesive energy per atom (eV/atom).

Return type:

float

computeMSD(orig_struct)[source]

Compute mean-square displacement relative to a reference structure.

Parameters:

orig_struct (AtomicStructure) – Reference configuration.

Returns:

Mean-square displacement (Ų).

Return type:

float

Raises:

TypeError – If orig_struct is not an AtomicStructure.

computeNearestNeighbour()[source]

Compute the mean nearest-neighbor distance.

Returns:

Mean nearest-neighbor distance (Å).

Return type:

float

Raises:

ValueError – If nearest neighbors cannot be found for an atom.

property forces

Forces acting on each atom (eV/Å).

Raises:

RuntimeError – If no potential calculator is defined.

Type:

numpy.ndarray

classmethod fromFile(path, pbc=[True, True, True], supercells=[1, 1, 1], potential=None)[source]

Creates a AtomicStructure object directly from a structure file

Parameters:
  • path (str) – Path to the file containing the crystal structure

  • pbc (Bool) – Whether to use periodic boundary conditions or not

  • supercells (list[int]) – Number of supercells to use in each direction

  • potential (Potential) – Interatomic potential to use

getAtoms()[source]

Unsafe helper: return the underlying ASE Atoms object.

Returns:

Raw Atoms object (use with caution).

Return type:

ase.Atoms

property get_all_distances

Pairwise atomic distances (Å).

Type:

numpy.ndarray

property get_atomic_numbers

Atomic numbers of all atoms.

Type:

numpy.ndarray

property get_cell

Return the cell matrix.

Type:

numpy.ndarray

property internal_pressure

Compute internal pressure using atomic units internally. Instantaneous: P = (1/3V) [ 2 N E_kin + sum_i r_i · f_i ] Returns a mean over the instantaneous frames in the trajectory Unit: ev/Å^3

Returns:

Internal pressure

Return type:

P (float)

property kinetic_energy

Total kinetic energy (eV).

Raises:

RuntimeError – If no potential calculator is defined.

Type:

float

property label

Label of the given structure

Returns:

label of the structure

Return type:

(str)

property lattice_constant

Average in-plane lattice constant (Å).

Type:

float

property masses

Atomic masses (amu).

Type:

numpy.ndarray

property positions

Positions of all atoms

Return type:

list[Atoms]

property potential

Potential that is used

Returns:

The structures potential

Return type:

(Potential)

property potential_energy

Total potential energy of the structure (eV).

Raises:

RuntimeError – If no potential calculator is defined.

Type:

float

setVelocitiesMB(temperature_K)[source]

Assign velocities from a Maxwell–Boltzmann distribution.

The procedure removes net linear and angular momentum.

Parameters:

temperature_K (float) – Target temperature in Kelvin.

property stress

Stress tensor in Voigt notation (eV/ų).

Raises:

RuntimeError – If no potential calculator is defined.

Type:

numpy.ndarray

property symbols

Chemical symbols of all atoms.

Type:

list[str]

property temperature

Instantaneous temperature (K).

Type:

float

property total_energy

Total energy (potential + kinetic) in eV.

Raises:

RuntimeError – If no potential calculator is defined.

Type:

float

property velocities

Atomic velocities (Å/fs).

Type:

numpy.ndarray | None

property volume

Volume of the cell (ų).

Type:

float

ASEWrappers.contextManager module

ASEWrappers.contextManager.suppress_cpp_output()[source]

ASEWrappers.integrator module

class ASEWrappers.integrator.BerendsenNPTIntegrator(timestep, temperature_K, pressure, compressibility)[source]

Bases: Integrator

Berendsen NPT integrator (NPT ensemble).

property ensemble

Thermodynamic ensemble (NPT).

Type:

str

class ASEWrappers.integrator.Integrator(timestep)[source]

Bases: object

Base class for all molecular dynamics integrators.

This class defines the common interface for ASE-based integrators, including timestep handling, attachment of callback functions, and running integration loops.

attach(attachment, interval)[source]

Attach a callback function to the integrator.

Parameters:
  • attachment (callable) – Function executed every interval steps.

  • interval (int) – Number of steps between calls.

clearData()[source]

Reset stored atoms and clear attachment list.

property ensemble

Thermodynamic ensemble associated with the integrator.

Type:

str

run(atomic_structure, steps)[source]

Run the integrator on the provided atomic structure.

Parameters:
  • atomic_structure (AtomicStructure) – Structure to integrate.

  • steps (int) – Number of MD steps to perform.

class ASEWrappers.integrator.IsotropicMTKNPTIntegrator(timestep, temperature_K, pressure, tdamp, pdamp)[source]

Bases: Integrator

MTK NPT integrator with isotropic cell fluctuations (NPT ensemble).

property ensemble

Thermodynamic ensemble (NPT).

Type:

str

class ASEWrappers.integrator.LangevinIntegrator(timestep, temperature_K, friction)[source]

Bases: Integrator

Langevin molecular dynamics integrator (NVT ensemble).

property ensemble

Thermodynamic ensemble (NVT).

Type:

str

class ASEWrappers.integrator.VelocityVerletIntegrator(timestep)[source]

Bases: Integrator

Velocity-Verlet molecular dynamics integrator (NVE ensemble).

property ensemble

Thermodynamic ensemble (NVE).

Type:

str

ASEWrappers.potential module

class ASEWrappers.potential.EMTPotential[source]

Bases: Potential

Effective Medium Theory (EMT) potential.

getASEPotentialCalculator()[source]

Return the EMT ASE calculator.

Returns:

EMT calculator instance.

Return type:

ase.calculators.emt.EMT

class ASEWrappers.potential.LennardJonesPotential(atomic_numbers, sigmas, epsilons, rc=None)[source]

Bases: Potential

Lennard-Jones pair potential.

getASEPotentialCalculator()[source]

Create an ASE Lennard-Jones calculator.

Returns:

ASAP LJ calculator instance.

Return type:

ase.Calculator

class ASEWrappers.potential.MACEPotential(model_path='/home/runner/work/Isacks-Co/Isacks-Co/SourceCode/MACEModels/mace-mpa-0-medium.model')[source]

Bases: Potential

MACE machine-learning interatomic potential.

getASEPotentialCalculator()[source]

Load and return the MACE ASE calculator.

Includes internal environment variable settings and warning suppression.

Returns:

MACE calculator instance.

Return type:

mace.calculators.MACECalculator

class ASEWrappers.potential.Potential[source]

Bases: object

Base class for interatomic potentials.

This abstract interface defines the structure for all potentials that can produce ASE-compatible calculator objects.

getASEPotentialCalculator()[source]

Return an ASE calculator object.

Returns:

ASE-compatible calculator, or None if not implemented by the subclass.

Return type:

ase.Calculator | None

Module contents