npt_nose_hoover_init¶
- torch_sim.integrators.npt.npt_nose_hoover_init(state, model, *, kT, dt, chain_length=3, chain_steps=2, sy_steps=3, t_tau=None, b_tau=None, seed=None, **kwargs)[source]¶
Initialize the NPT Nose-Hoover state.
This function initializes a state for NPT molecular dynamics with Nose-Hoover chain thermostats for both temperature and pressure control. It sets up the system with appropriate initial conditions including particle positions, momenta, cell variables, and thermostat chains.
- Parameters:
model (
ModelInterface) – Model to compute forces and energiesstate (SimState | dict[Literal['positions', 'masses', 'cell', 'pbc', 'atomic_numbers', 'system_idx'], ~torch.Tensor]) – Initial system state as MDState or dict containing positions, masses, cell, and PBC information
kT (Tensor) – Target temperature in energy units
external_pressure – Target external pressure
dt (Tensor) – Integration timestep
chain_length (int) – Length of Nose-Hoover chains. Defaults to 3.
chain_steps (int) – Chain integration substeps. Defaults to 2.
sy_steps (int) – Suzuki-Yoshida integration order. Defaults to 3.
t_tau (Tensor | None) – Thermostat relaxation time. Controls how quickly temperature equilibrates. Defaults to 100*dt
b_tau (Tensor | None) – Barostat relaxation time. Controls how quickly pressure equilibrates. Defaults to 1000*dt
seed (int | None) – Random seed for momenta initialization. Used for reproducible runs
**kwargs (Any) – Additional state variables like atomic_numbers or pre-initialized momenta
- Returns:
- Initialized state containing:
Particle positions, momenta, forces
Cell position, momentum and mass (all with batch dimensions)
Reference cell matrix (with batch dimensions)
Thermostat and barostat chain variables
System energy
Other state variables (masses, PBC, etc.)
- Return type:
Notes
Uses separate Nose-Hoover chains for temperature and pressure control
Cell mass is set based on system size and barostat relaxation time
Initial momenta are drawn from Maxwell-Boltzmann distribution if not provided
Cell dynamics use logarithmic coordinates for volume updates
All cell properties are properly initialized with batch dimensions