initialize_momenta¶
- torch_sim.integrators.md.initialize_momenta(positions, masses, system_idx, kT, generator=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]generator (Generator | None) – Optional
torch.Generatorfor reproducibility.
- Returns:
Initialized momenta [n_particles, n_dim]
- Return type: