Class MolecularDynamicsOpenMM

java.lang.Object
ffx.algorithms.dynamics.MolecularDynamics
ffx.algorithms.dynamics.MolecularDynamicsOpenMM
All Implemented Interfaces:
Terminatable, Runnable

public class MolecularDynamicsOpenMM extends MolecularDynamics
Runs Molecular Dynamics using OpenMM implementation
Author:
Michael J. Schnieders
  • 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 on
      potential - Either a ForceFieldEnergyOpenMM, or a Barostat.
      listener - a AlgorithmListener object.
      thermostat - May have to be slightly modified for native OpenMM routines
      integrator - 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 provided timeStep and temperature. The printInterval and saveInterval control logging the state of the system to the console and writing a restart file, respectively. If the dyn File is not null, the simulation will be initialized from the contents. If the iniVelocities is true, the velocities will be initialized from a Maxwell Boltzmann distribution.

      Overrides:
      dynamic in class MolecularDynamics
      Parameters:
      numSteps - Number of MD steps
      timeStep - 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 - A File object to write the restart file to.
    • getIntervalSteps

      public int getIntervalSteps()
      getIntervalSteps.
      Overrides:
      getIntervalSteps in class MolecularDynamics
      Returns:
      Always 1 for this implementation.
    • setIntervalSteps

      public void setIntervalSteps(int intervalSteps)
      Setter for the field intervalSteps.
      Overrides:
      setIntervalSteps in class MolecularDynamics
      Parameters:
      intervalSteps - The number of interval steps.
    • getTimeStep

      public double getTimeStep()
      getTimeStep.
      Overrides:
      getTimeStep in class MolecularDynamics
      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 class MolecularDynamics
      Parameters:
      numSteps - Number of MD steps
      timeStep - Time step in femtoseconds
      loggingInterval - 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 files
      restartInterval - Interval between writing new restart files in picoseconds.
      temperature - Temperature in Kelvins.
      initVelocities - Initialize new velocities from a Maxwell-Boltzmann distribution.
      dyn - A File object to write the restart file to.
    • revertState

      public void revertState() throws Exception
      Description copied from class: MolecularDynamics
      Revert the state of the MolecularDynamics instance to the stored MDState.
      Overrides:
      revertState in class MolecularDynamics
      Throws:
      Exception - is thrown if the stored state is null.
    • setFileType

      public void setFileType(String fileType)
      Method to set file type from groovy scripts.
      Overrides:
      setFileType in class MolecularDynamics
      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 class MolecularDynamics
      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 class MolecularDynamics
    • appendSnapshot

      protected void appendSnapshot(String[] extraLines)
      Description copied from class: MolecularDynamics
      Append a snapshot to the trajectory file.
      Overrides:
      appendSnapshot in class MolecularDynamics
      Parameters:
      extraLines - Strings of meta-data to include.