class MaxwellBoltzmannDistribution(temperature=None, remove_center_of_mass_momentum=None, random_seed=None, enforce_temperature=True)

Maxwell-Boltzmann velocity distribution for particles in a MolecularDynamics() simulation.

  • temperature (PhysicalQuantity of type temperature) – The temperature parameter of the Maxwell-Boltzmann distribution.
    Default: 300.0*Kelvin
  • remove_center_of_mass_momentum (bool) – If True, the center-of-mass momentum should be removed, otherwise it is kept.
    Default: True
  • random_seed (int) – The seed used for the random number generator. The seed should be between 0 and 2**31-1.
  • enforce_temperature (bool) – Rescale the velocities of the system to ensure the instantaneous temperature is exactly the requested temperature.
    Default: True

Usage Examples

Perform a molecular dynamics run on a water molecule, using the default settings, but having applied a Maxwell-Boltzmann distribution of velocities to all atoms:

# Define elements
elements = [Oxygen, Hydrogen, Hydrogen]

# Define coordinates
cartesian_coordinates = [[0.0,  -1.70000000e-05,   1.20198000e-01],
                         [0.0,   7.59572000e-01,  -4.86714000e-01],
                         [0.0,  -7.59606000e-01,  -4.86721000e-01]]*Angstrom

# Set up configuration
molecule_configuration = MoleculeConfiguration(

# Define a calculator

# Setup a velocity distribution-defining class.
velocities = MaxwellBoltzmannDistribution()

# Setup the MD method.
md_method = NVEVelocityVerlet(initial_velocity=velocities)

# Perform MD
md_configuration = MolecularDynamics(molecule_configuration,

# Save the final configuration
nlsave('', md_configuration)