SteeredMolecularDynamics

class SteeredMolecularDynamics(collective_variable, velocity, spring_constant, initial_target_cv_value=None, collective_variable_name=None, measurement_interval=None)

Hook class to run steered MD by applying a moving spring to a given collective variable.

Parameters:
  • collective_variable (DiffractionPeak | object) – The collective variable (cv) on which the steered MD should act. The unit of the collective variable must be consistent with the units for velocity and spring_constant.

  • velocity (PhysicalQuantity of type cv-unit / time) – The velocity at which the spring position moves.

  • spring_constant (PhysicalQuantity of type energy / cv-unit ** 2) – The spring constant used to move the collective variable.

  • initial_target_cv_value (float | PhysicalQuantity of type cv-unit | None) – The initial target value of the collective variable. If not specified the initial value at the first MD step is used.

  • collective_variable_name (str) – The name with which the collective variable shows up in the measurements.

  • measurement_interval (int) – The interval at which measurements of cv-value and bias potential are measured.

callInterval()
Returns:

The call interval of this hook function.

Return type:

int

measurements(step, time, configuration)

Measurement hook that records the collective variable value, bias, and target value.

Parameters:
Returns:

A dictionary with the measurements.

Return type:

dict

uniqueString()

Return a unique string representing the state of the object.

Usage Examples

Use the DiffractionPeak as collective variable in a SteeredMolecularDynamics to accelerate the crystallization in an amorphous cobalt silicide configuration using the MomentTensorPotential.

# Set up the diffraction peak intensity at q=2.1/Ang as collective variable.
# The diffraction intensity is only calculated for Cobalt atoms.
diffraction_peak = DiffractionPeak(
    cutoff_radius=10.0*Ang,
    q_value=2.1/Ang,
    included_atoms=[Cobalt],
)

# Set up the Steered MD with the diffraction peak intensity as collective variable.
# The object will be used as post-step-hook in the MD simulation.
hook_function = SteeredMolecularDynamics(
    collective_variable=diffraction_peak,
    velocity=300/1000/ps,
    spring_constant=0.5*eV,
    measurement_interval=50,
)

method = NVTNoseHoover(
    initial_velocity=MaxwellBoltzmannDistribution(
        temperature=1500.0*Kelvin
    ),
    reservoir_temperature=1500.0*Kelvin,
    thermostat_timescale=500.0*fs,
)

md_trajectory = MolecularDynamics(
    configuration=last_image_2,
    constraints=[
        FixCenterOfMass()
    ],
    trajectory_filename='CoSi2_bulk_crystallization.hdf5',
    steps=1200000,
    post_step_hook=hook_function,
    measurement_hook=hook_function.measurements,
    log_interval=5000,
    method=method
)

crystallization_example.py

Notes

The SteeredMolecularDynamics object can be used as a post_step_hook in MolecularDynamics() or TimeStampedForceBiasMonteCarlo() to drive a given collective variable towards a specified value. This is done using a bias potential which mimics a harmonic spring acting on the collective variable (CV):

\[V^{bias}(\mathbf{R}) = \frac{1}{2} k (CV(\mathbf{R}) - v^{CV}t - CV_0)^2\]

where \(\mathbf{R}\) is the set of atomic coordinates, \(k\) is the spring constant, \(CV(\mathbf{R})\) is the collective variable as function of all cartesian coordinates, and \(v^{CV}\) is the velocity at which the spring moves. \(CV_0\) is the initial CV value which is either taken as the value at \(t=0\) or can be specified explicitly via the keyword initial_target_cv_value. The values of the collective variable (actual value and target value), as well as the value of the bias potential are stored as measurements on the resulting MDTrajectory object and can be visualized in the MovieTool, along with the Movie of the simulation.

SteeredMolecularDynamics can be used with predefined or custom implementations of collective variables which implement the calculation of CV value and the derivatives with respect to atomic positions and cell vectors via the method calculateCVAndDerivatives. Currently, only the class DiffractionPeak is available as predefined collective variable.