NVEDynamics¶
Included in QATK.Dynamics
- class NVEDynamics(initial_velocity=None, time_step=None, max_force_threshold=None)¶
Constructor for the NVE Velocity-Verlet integrator class.
- Parameters:
initial_velocity (
ConfigurationVelocities|ZeroVelocities|MaxwellBoltzmannDistribution) – A class that implements a distribution of initial velocities for the particles in the MD simulation. Default:MaxwellBoltzmannDistributiontime_step (PhysicalQuantity of type time) – The time-step interval used in the MD simulation. Default:
1.0*fsmax_force_threshold (PhysicalQuantity of type energy/length) – The maximum allowed force to run MD simulation with single time step. If maximum force in an MD simulation is larger than the threshold force, multiple time steps MD simulation is performed. Default: None
- static getLogInfo(step, time, md_quantities)¶
Get the log information for the MD step.
- Parameters:
step (int) – The current MD step.
time (PhysicalQuantity of type time) – The current MD time in fs.
md_quantities (MDQuantities) – The MD quantities to log.
- Returns:
The header rows and the row with the MD information.
- Return type:
list of str, str
- kineticEnergy(configuration)¶
- Parameters:
configuration (DistributedConfiguration) – The current configuration to calculate the kinetic energy of.
- Returns:
The kinetic energy of the current configuration.
- Return type:
PhysicalQuantity of type energy
- kineticEnergyLeapfrog(configuration, forces)¶
- Parameters:
configuration (DistributedConfiguration) – The current configuration to calculate the kinetic energy of.
forces (PhysicalQuantity of type energy per distance) – The current forces on the configuration.
- Returns:
The kinetic energy of the current configuration.
- Return type:
PhysicalQuantity of type energy
- timeStep()¶
- Returns:
The time step.
- Return type:
PhysicalQuantity of type time
- uniqueString()¶
Return a unique string representing the state of the object.
Usage Examples¶
Perform a micro-canonical molecular dynamics run of 10 steps on a water molecule, using the NVE Dynamics MD method:
# 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,
method=NVEDynamics(),
steps=10)
# Save the final configuration
nlsave('velocityverlet.nc', md_configuration)
Notes¶
Uses the Verlet algorithm to perform a micro-canonical, classical molecular-dynamics simulation, i.e. the energy of the system is constant during the simulation.
This method is supported in both the soft matter and general dynamics frameworks. See the
documentation on the SoftMatterDynamicsSimulation for details on which methods are
supported in each framework.