MaxwellBoltzmannDistribution

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

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

Parameters:
  • 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. The default value is configuration dependent. False if len(configuration) == 1 else 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

uniqueString()

Return a unique string representing the state of the object.

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(
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

# Define a calculator
molecule_configuration.setCalculator(LCAOCalculator())

# 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,
                                     method=md_method,
                                     steps=10)

# Save the final configuration
nlsave('maxwellboltzmann.nc', md_configuration)


maxwellboltzmann.py