ConfigurationVelocities

class ConfigurationVelocities(remove_center_of_mass_momentum=None)

The ConfigurationVelocities object uses the velocities saved in the configuration as initial velocities in a MolecularDynamics() simulation.

Parameters:remove_center_of_mass_momentum (bool) – If True, the center-of-mass momentum should be removed, otherwise kept.

Usage Examples

Perform a molecular dynamics run of a silicon crystal, using the velocities defined in the bulk configuration as initial velocities in the MD simulation.

# Set up lattice
lattice = FaceCenteredCubic(5.4306*Angstrom)

# Define elements
elements = [Silicon, Silicon]

# Define coordinates
fractional_coordinates = [[-0.009580233862,  0.002314591627,  0.010466101485],
                          [ 0.259580233862,  0.247685408373,  0.239533898515]]

# Define velocities
velocities = [[ 0.00221094,  0.00024205, -0.00126377],
              [-0.00221094, -0.00024205,  0.00126377]]*Angstrom/fs

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates,
    velocities=velocities
    )

potentialSet = Tersoff_Si_1988b()
calculator = TremoloXCalculator(parameters=potentialSet)
bulk_configuration.setCalculator(calculator)

# Use the exisiting velocities of the configuration as initial velocities.
initial_velocity = ConfigurationVelocities(remove_center_of_mass_momentum=True)

method = NVEVelocityVerlet(initial_velocity=initial_velocity)

md_trajectory = MolecularDynamics(
    bulk_configuration,
    constraints=[],
    trajectory_filename='trajectory.nc',
    steps=500,
    log_interval=100,
    method=method
)

configuration_velocities.py

Notes

Pass this object as initial_velocity parameter in the MD method (e.g. NVEVelocityVerlet), if you want to use to velocities stored in the configuration (e.g from a previous MD run, or explicitly specified in the constructor of the configuration, cf. BulkConfiguration) as initial velocities in an MD simulation.

If the configuration does not have any velocities, the initial velocities will be set to zero.