MDState

class torch_sim.integrators.md.MDState(positions, masses, cell, pbc, atomic_numbers, system_idx, momenta, energy, forces)[source]

Bases: SimState

State information for molecular dynamics simulations.

This class represents the complete state of a molecular system being integrated with molecular dynamics. It extends the base SimState class to include additional attributes required for MD simulations, such as momenta, energy, and forces. The class also provides computed properties like velocities.

Variables:
  • positions (torch.Tensor) – Particle positions [n_particles, n_dim]

  • masses (torch.Tensor) – Particle masses [n_particles]

  • cell (torch.Tensor) – Simulation cell matrix [n_systems, n_dim, n_dim]

  • pbc (bool) – Whether to use periodic boundary conditions

  • system_idx (torch.Tensor) – System indices [n_particles]

  • atomic_numbers (torch.Tensor) – Atomic numbers [n_particles]

  • momenta (torch.Tensor) – Particle momenta [n_particles, n_dim]

  • energy (torch.Tensor) – Total energy of the system [n_systems]

  • forces (torch.Tensor) – Forces on particles [n_particles, n_dim]

Parameters:
Properties:

velocities (torch.Tensor): Particle velocities [n_particles, n_dim] n_systems (int): Number of independent systems in the batch device (torch.device): Device on which tensors are stored dtype (torch.dtype): Data type of tensors

property velocities: Tensor

Velocities calculated from momenta and masses with shape [n_particles, n_dimensions].