MDClasses module

class MDClasses.EquilibriumRun(settings)[source]

Bases: MDBase

Equilibration molecular dynamics run.

Runs the integrator until a fixed number of steps is reached or until an equilibrium condition is satisfied. The equilibrium criterion depends on the ensemble: - NVT: potential energy stability - other ensembles: internal pressure stability

run(atomic_structure, num_steps, init_vel=True, store_traj=True, check_conv=False)[source]

Run an equilibration simulation.

Parameters:
  • atomic_structure (AtomicStructure) – Structure to equilibrate (modified in-place).

  • num_steps (int) – Maximum number of MD steps.

  • init_vel (bool, optional) – If True, initialize velocities from a Maxwell–Boltzmann distribution.

  • store_traj (bool, optional) – If True, write an ASE trajectory file.

  • check_conv (bool, optional) – If True, check for equilibrium and stop early if satisfied.

Returns:

The equilibrated structure.

Return type:

AtomicStructure

class MDClasses.MDBase(settings)[source]

Bases: object

Base class for molecular dynamics run types.

Provides shared utilities for different MD workflows, including: - sampling scalar quantities from an AtomicStructure - storing sampled data in a DataTrajectory - attaching ASE trajectory writers to an integrator

This class is not intended to be used directly, but to be subclassed by concrete MD run implementations.

integrator

ASE-style integrator used to advance the simulation.

sample_data

Names of quantities to sample during the run.

Type:

list or None

run_type

Name of the run mode, used for output file naming.

Type:

str or None

class MDClasses.SampleRun(settings)[source]

Bases: MDBase

Production MD run for sampling thermodynamic and structural quantities.

Samples selected quantities at every MD step and stores them in a DataTrajectory, which is written to disk at the end of the run.

Parameters:

settings (SimulationSettings)

run(atomic_structure, num_steps, store_traj=False)[source]

Run a sampling simulation.

Parameters:
  • atomic_structure (AtomicStructure) – Structure to simulate (modified in-place).

  • num_steps (int) – Number of MD steps to run.

  • store_traj (bool, optional) – If True, write an ASE trajectory file.

Return type:

None

class MDClasses.StretchRun(settings)[source]

Bases: MDBase

Small-strain MD run for estimating elastic stiffness coefficients.

Applies a sequence of small strains, performs short MD holds for each strain, averages the resulting stress, and fits stress–strain slopes to construct a stiffness matrix.

appendStress(atoms, stress_list, stress0)[source]

Append stress deviation relative to a reference stress.

Parameters:
  • atoms – Structure providing a stress tensor.

  • stress_list (list) – List to which stress values are appended.

  • stress0 – Reference stress subtracted from the current stress.

run(atomic_structure)[source]

Run a strain sweep and compute an elastic stiffness matrix.

Parameters:

atomic_structure (AtomicStructure) – Reference structure providing the initial cell and stress.

Return type:

None

Notes

The resulting stiffness matrix is saved as cmatrix.npy.