Name

MaxwellBoltzmannDistribution — The class that implements the Maxwell-Boltzmann distribution of velocities for MD simulation.

Synopsis

Namespace: NanoLanguage
MaxwellBoltzmannDistribution(temperature)

Description

Constructor for the Maxwell-Boltzmann distribution of velocities for particles in an MD simulation.

MaxwellBoltzmannDistribution Arguments

temperature

The temperature the Maxwell-Boltzmann distribution should model.

Type: A unit of type temperature - e.g. 300*Kelvin

Default: 300*Kelvin

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 = VelocityVerlet(initial_velocity=velocities)

# Perform MD
md_configuration = MolecularDynamics(molecule_configuration,
                                     log_filename='maxwellboltzmann.nc',
                                     method=md_method,
                                     steps=10)

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

maxwellboltzmann.py

Notes