calculate_momenta¶
- torch_sim.integrators.md.calculate_momenta(positions, masses, system_idx, kT, seed=None)[source]¶
Initialize particle momenta based on temperature.
Generates random momenta for particles following the Maxwell-Boltzmann distribution at the specified temperature. The center of mass motion is removed to prevent system drift.
- Parameters:
positions (
torch.Tensor) – Particle positions [n_particles, n_dim]masses (
torch.Tensor) – Particle masses [n_particles]system_idx (
torch.Tensor) – System indices [n_particles]kT (
torch.Tensor) – Temperature in energy units [n_systems]seed (
int, optional) – Random seed for reproducibility. Defaults to None.
- Returns:
Initialized momenta [n_particles, n_dim]
- Return type: