Package ffx.algorithms.dynamics
Class MolecularDynamicsOpenMM
java.lang.Object
ffx.algorithms.dynamics.MolecularDynamics
ffx.algorithms.dynamics.MolecularDynamicsOpenMM
- All Implemented Interfaces:
Terminatable
,Runnable
Runs Molecular Dynamics using OpenMM implementation
- Author:
- Michael J. Schnieders
-
Field Summary
Fields inherited from class ffx.algorithms.dynamics.MolecularDynamics
algorithmListener, automaticWriteouts, done, dt, fileType, initialState, initVelocities, logFrequency, molecularAssembly, restartFrequency, restartInterval, state, totalSimTime, trajectoryFrequency
-
Constructor Summary
ConstructorDescriptionMolecularDynamicsOpenMM
(MolecularAssembly assembly, Potential potential, AlgorithmListener listener, ThermostatEnum thermostat, IntegratorEnum integrator) Constructs an MolecularDynamicsOpenMM object, to perform molecular dynamics using native OpenMM routines, avoiding the cost of communicating coordinates, gradients, and energies back and forth across the PCI bus. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendSnapshot
(String[] extraLines) Append a snapshot to the trajectory file.void
dynamic
(long numSteps, double timeStep, double printInterval, double saveInterval, double temperature, boolean initVelocities, File dyn) Blocking molecular dynamics.int
getIntervalSteps.double
getTimeStep.void
init
(long numSteps, double timeStep, double loggingInterval, double trajectoryInterval, String fileType, double restartInterval, double temperature, boolean initVelocities, File dyn) initvoid
Revert the state of the MolecularDynamics instance to the stored MDState.void
setFileType
(String fileType) Method to set file type from groovy scripts.void
setIntervalSteps
(int intervalSteps) Setter for the fieldintervalSteps
.void
setObtainVelAcc
(boolean obtainVA) Sets whether to obtain all variables (velocities, gradients) from OpenMM, or just positions and energies.void
Write out a restart file.Methods inherited from class ffx.algorithms.dynamics.MolecularDynamics
addAssembly, attachExtendedSystem, dynamic, dynamicsFactory, dynamicsFactory, getAssemblyArray, getCoordinates, getDynFile, getInitialKineticEnergy, getInitialPotentialEnergy, getInitialTemperature, getInitialTotalEnergy, getKineticEnergy, getPotentialEnergy, getTemperature, getThermostat, getTotalEnergy, getVerbosityLevel, init, logThermoForTime, run, setArchiveFiles, setAutomaticWriteouts, setCoordinates, setFallbackDynFile, setNonEquilibriumLambda, setRestartFrequency, setThermostat, setVerbosityLevel, storeState, terminate, writeFilesForStep, writeFilesForStep
-
Constructor Details
-
MolecularDynamicsOpenMM
public MolecularDynamicsOpenMM(MolecularAssembly assembly, Potential potential, AlgorithmListener listener, ThermostatEnum thermostat, IntegratorEnum integrator) Constructs an MolecularDynamicsOpenMM object, to perform molecular dynamics using native OpenMM routines, avoiding the cost of communicating coordinates, gradients, and energies back and forth across the PCI bus.- Parameters:
assembly
- MolecularAssembly to operate onpotential
- Either a ForceFieldEnergyOpenMM, or a Barostat.listener
- aAlgorithmListener
object.thermostat
- May have to be slightly modified for native OpenMM routinesintegrator
- May have to be slightly modified for native OpenMM routines
-
-
Method Details
-
dynamic
public void dynamic(long numSteps, double timeStep, double printInterval, double saveInterval, double temperature, boolean initVelocities, File dyn) Blocking molecular dynamics. When this method returns, the MD run is done.Execute
numSteps
of dynamics using the providedtimeStep
andtemperature
. TheprintInterval
andsaveInterval
control logging the state of the system to the console and writing a restart file, respectively. If thedyn
File is not null, the simulation will be initialized from the contents. If theiniVelocities
is true, the velocities will be initialized from a Maxwell Boltzmann distribution.- Overrides:
dynamic
in classMolecularDynamics
- Parameters:
numSteps
- Number of MD stepstimeStep
- Time step (fsec)printInterval
- Interval between printing/logging information in picoseconds.saveInterval
- Interval between adding a frame to the trajectory file in picoseconds.temperature
- Temperature in Kelvins.initVelocities
- Initialize new velocities from a Maxwell-Boltzmann distribution.dyn
- AFile
object to write the restart file to.
-
getIntervalSteps
public int getIntervalSteps()getIntervalSteps.- Overrides:
getIntervalSteps
in classMolecularDynamics
- Returns:
- Always 1 for this implementation.
-
setIntervalSteps
public void setIntervalSteps(int intervalSteps) Setter for the fieldintervalSteps
.- Overrides:
setIntervalSteps
in classMolecularDynamics
- Parameters:
intervalSteps
- The number of interval steps.
-
getTimeStep
public double getTimeStep()getTimeStep.- Overrides:
getTimeStep
in classMolecularDynamics
- Returns:
- Time step in picoseconds.
-
init
public void init(long numSteps, double timeStep, double loggingInterval, double trajectoryInterval, String fileType, double restartInterval, double temperature, boolean initVelocities, File dyn) init- Overrides:
init
in classMolecularDynamics
- Parameters:
numSteps
- Number of MD stepstimeStep
- Time step in femtosecondsloggingInterval
- Interval between printing/logging information in picoseconds.trajectoryInterval
- Interval between adding a frame to the trajectory file in picoseconds.fileType
- XYZ or ARC to save to .arc, PDB for .pdb filesrestartInterval
- Interval between writing new restart files in picoseconds.temperature
- Temperature in Kelvins.initVelocities
- Initialize new velocities from a Maxwell-Boltzmann distribution.dyn
- AFile
object to write the restart file to.
-
revertState
Description copied from class:MolecularDynamics
Revert the state of the MolecularDynamics instance to the stored MDState.- Overrides:
revertState
in classMolecularDynamics
- Throws:
Exception
- is thrown if the stored state is null.
-
setFileType
Method to set file type from groovy scripts.- Overrides:
setFileType
in classMolecularDynamics
- Parameters:
fileType
- the type of snapshot files to write.
-
setObtainVelAcc
public void setObtainVelAcc(boolean obtainVA) Sets whether to obtain all variables (velocities, gradients) from OpenMM, or just positions and energies.- Overrides:
setObtainVelAcc
in classMolecularDynamics
- Parameters:
obtainVA
- If true, obtain all variables from OpenMM each update.
-
writeRestart
public void writeRestart()Description copied from class:MolecularDynamics
Write out a restart file.- Overrides:
writeRestart
in classMolecularDynamics
-
appendSnapshot
Description copied from class:MolecularDynamics
Append a snapshot to the trajectory file.- Overrides:
appendSnapshot
in classMolecularDynamics
- Parameters:
extraLines
- Strings of meta-data to include.
-