npt_crescale_independent_lengths_step

torch_sim.integrators.npt.npt_crescale_independent_lengths_step(state, model, *, dt, kT, external_pressure, tau=None)[source]

Perform one NPT integration step with cell rescaling barostat.

This function performs a single integration step for NPT dynamics using a cell rescaling barostat. It updates particle positions, momenta, and the simulation cell based on the target temperature and pressure.

Trotter based splitting: 1. Half Thermostat (velocity scaling) 2. Half Update momenta with forces 3. Barostat (cell rescaling) 4. Update positions (from barostat + half momenta) 5. Update forces with new positions and cell 6. Compute forces 7. Half Update momenta with forces 8. Half Thermostat (velocity scaling)

Only allow isotropic external stress. This method has 3 degrees of freedom for each cell length, allowing independent scaling of each cell vector.

Inspired from: https://github.com/bussilab/crescale/blob/master/simplemd_anisotropic/simplemd.cpp - Time reversible integrator - Instantaneous kinetic energy (not not the average from equipartition)

Parameters:
  • model (ModelInterface) – Model to compute forces and energies

  • state (NPTCRescaleState) – Current system state

  • dt (torch.Tensor) – Integration timestep

  • kT (torch.Tensor) – Target temperature

  • external_pressure (torch.Tensor) – Target external pressure

  • tau (torch.Tensor | None) – V-Rescale thermostat relaxation time. If None, defaults to 100*dt

Returns:

Updated state after one integration step

Return type:

NPTCRescaleState