NPTNoseHooverState

class torch_sim.integrators.npt.NPTNoseHooverState(positions, masses, cell, pbc, atomic_numbers, system_idx, momenta, energy, forces, *, reference_cell, cell_position, cell_momentum, cell_mass, thermostat, thermostat_fns, barostat, barostat_fns)[source]

Bases: MDState

State information for an NPT system with Nose-Hoover chain thermostats.

This class represents the complete state of a molecular system being integrated in the NPT (constant particle number, pressure, temperature) ensemble using Nose-Hoover chain thermostats for both temperature and pressure control.

The cell dynamics are parameterized using a logarithmic coordinate system where cell_position = (1/d)ln(V/V_0), with V being the current volume, V_0 the reference volume, and d the spatial dimension. This ensures volume positivity and simplifies the equations of motion.

Variables:
  • positions (torch.Tensor) – Particle positions with shape [n_particles, n_dims]

  • momenta (torch.Tensor) – Particle momenta with shape [n_particles, n_dims]

  • forces (torch.Tensor) – Forces on particles with shape [n_particles, n_dims]

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

  • reference_cell (torch.Tensor) – Reference simulation cell matrix with shape [n_systems, n_dimensions, n_dimensions]. Used to measure relative volume changes.

  • cell_position (torch.Tensor) – Logarithmic cell coordinate with shape [n_systems]. Represents (1/d)ln(V/V_0) where V is current volume and V_0 is reference volume.

  • cell_momentum (torch.Tensor) – Cell momentum (velocity) conjugate to cell_position with shape [n_systems]. Controls volume changes.

  • cell_mass (torch.Tensor) – Mass parameter for cell dynamics with shape [n_systems]. Controls coupling between volume fluctuations and pressure.

  • barostat (NoseHooverChain) – Chain thermostat coupled to cell dynamics for pressure control

  • thermostat (NoseHooverChain) – Chain thermostat coupled to particle dynamics for temperature control

  • barostat_fns (NoseHooverChainFns) – Functions for barostat chain updates

  • thermostat_fns (NoseHooverChainFns) – Functions for thermostat chain updates

Parameters:
Properties:
velocities (torch.Tensor): Particle velocities computed as momenta

divided by masses. Shape: [n_particles, n_dimensions]

current_cell (torch.Tensor): Current simulation cell matrix derived from

cell_position. Shape: [n_systems, n_dimensions, n_dimensions]

Notes

  • The cell parameterization ensures volume positivity

  • Nose-Hoover chains provide deterministic control of T and P

  • Extended system approach conserves an extended Hamiltonian

  • Time-reversible when integrated with appropriate algorithms

  • All cell-related properties now support batch dimensions

property velocities: Tensor

Calculate particle velocities from momenta and masses.

Returns:

Particle velocities with shape [n_particles, n_dimensions]

Return type:

Tensor

property current_cell: Tensor

Calculate current simulation cell from cell position.

The cell is computed from the reference cell and cell_position using: cell = (V/V_0)^(1/d) * reference_cell where V = V_0 * exp(d * cell_position)

Returns:

Current simulation cell matrix with shape

[n_systems, n_dimensions, n_dimensions]

Return type:

Tensor