Skip to content

kups.application.md

MDParticles

Bases: Particles

Particle state for molecular dynamics simulations.

Extends :class:Particles with gradient, momenta, and derived kinematic quantities needed by MD integrators.

Attributes:

Name Type Description
position_gradients Array

Energy gradient w.r.t. positions, shape (n_atoms, 3).

momenta Array

Particle momenta, shape (n_atoms, 3).

exclusion Index[ExclusionId]

Per-particle exclusion index (defaults to one group per atom via :func:default_exclusion if not supplied).

Source code in src/kups/application/md/data.py
@dataclass
class MDParticles(Particles):
    """Particle state for molecular dynamics simulations.

    Extends :class:`Particles` with gradient, momenta, and derived
    kinematic quantities needed by MD integrators.

    Attributes:
        position_gradients: Energy gradient w.r.t. positions, shape ``(n_atoms, 3)``.
        momenta: Particle momenta, shape ``(n_atoms, 3)``.
        exclusion: Per-particle exclusion index (defaults to one group per
            atom via :func:`default_exclusion` if not supplied).
    """

    position_gradients: Array
    momenta: Array
    exclusion: Index[ExclusionId] = field(default=None, kw_only=True)  # type: ignore

    def __post_init__(self):
        if self.exclusion is None:
            object.__setattr__(self, "exclusion", default_exclusion(len(self.charges)))

    @property
    def forces(self) -> Array:
        """Negative position gradient, shape ``(n_atoms, 3)``."""
        return -self.position_gradients

    @property
    def velocities(self) -> Array:
        """Velocities derived from momenta and masses, shape ``(n_atoms, 3)``."""
        return self.momenta / self.masses[..., None]

    @property
    def kinetic_energy(self) -> Array:
        """Per-particle kinetic energy, shape ``(n_atoms,)``."""
        return particle_kinetic_energy(self.momenta, self.masses)

forces property

Negative position gradient, shape (n_atoms, 3).

kinetic_energy property

Per-particle kinetic energy, shape (n_atoms,).

velocities property

Velocities derived from momenta and masses, shape (n_atoms, 3).

MDSystems

Per-system state for molecular dynamics simulations.

Attributes:

Name Type Description
cell Cell

Cell geometry for each system.

integrator_params IntegratorParams

Bundled integrator control parameters; concrete shape (e.g. :class:VerletParams, :class:BAOABLangevinParams, :class:CSVRParams, :class:CSVRNPTParams) is chosen to match the selected integrator.

cell_gradients Cell

Energy gradient w.r.t. the cell, stored as a :class:Cell (the vectors leaf holds the shape-(n_systems, 3, 3) gradient used by :attr:stress_tensor).

potential_energy Array

Total potential energy per system (eV), shape (n_systems,).

Source code in src/kups/application/md/data.py
@dataclass
class MDSystems:
    """Per-system state for molecular dynamics simulations.

    Attributes:
        cell: Cell geometry for each system.
        integrator_params: Bundled integrator control parameters; concrete shape
            (e.g. :class:`VerletParams`, :class:`BAOABLangevinParams`,
            :class:`CSVRParams`, :class:`CSVRNPTParams`) is chosen to match the
            selected integrator.
        cell_gradients: Energy gradient w.r.t. the cell, stored as a
            :class:`Cell` (the ``vectors`` leaf holds the
            shape-``(n_systems, 3, 3)`` gradient used by
            :attr:`stress_tensor`).
        potential_energy: Total potential energy per system (eV), shape ``(n_systems,)``.
    """

    cell: Cell
    integrator_params: IntegratorParams
    cell_gradients: Cell
    potential_energy: Array