Name

MolecularDynamics — Function for performing a molecular dynamics simulation.

Synopsis

Namespace: NanoLanguage
MolecularDynamics(
configuration,
constraints,
trajectory_filename,
steps,
log_interval,
method,
xyz_filename
)

Description

Function for performing a molecular dynamics simulation. Returns: The MDTrajectory object.

MolecularDynamics Arguments

configuration

The initial configuration.

Type: A BulkConfiguration, MoleculeConfiguration, or DeviceConfiguration.

Default: None
constraints

The indices of the atom with fixed positions.

Type: A list of integers.

Default: []
trajectory_filename

The filename of the file to be used for storing the trajectory.

Type: A string.

Default: None
steps

The number of time-steps to undertake in simulation.

Type: An integer.

Default: 50
log_interval

The resolution used in saving steps to a trajectory file, where a value of 1 results in all steps being saved, and e.g. a value of 2 resulting in every other step being discarded.

Type: An integer.

Default: 1
method

The molecular dynamics method used for the simulation.

Type: An instance of either a VelocityVerlet or NVTBerendsen object.

Default: VelocityVerlet
xyz_filename

The name of the file to be used for storing the xyz trajectory.

Type: A string.

Default: None

Usage Examples

Perform a molecular dynamics run of 10 steps on a water molecule, using the default settings:

# 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())

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

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

md_h2o.py

Notes