Package ffx.openmm

Class PeriodicTorsionForce

java.lang.Object
ffx.openmm.Force
ffx.openmm.PeriodicTorsionForce
Direct Known Subclasses:
ImproperTorsionForce, RestrainTorsionsForce, TorsionForce

public class PeriodicTorsionForce extends Force
This class implements an interaction between groups of four particles that varies periodically with the torsion angle between them. To use it, create a PeriodicTorsionForce object then call addTorsion() once for each torsion. After a torsion has been added, you can modify its force field parameters by calling setTorsionParameters(). This will have no effect on Contexts that already exist unless you call updateParametersInContext().
  • Constructor Details

    • PeriodicTorsionForce

      public PeriodicTorsionForce()
      Create a new PeriodicTorsionForce.
  • Method Details

    • addTorsion

      public int addTorsion(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k)
      Add a torsion to the PeriodicTorsionForce.
      Parameters:
      particle1 - Index of the first atom.
      particle2 - Index of the second atom.
      particle3 - Index of the third atom.
      particle4 - Index of the fourth atom.
      periodicity - The periodicity of the torsion.
      phase - The phase of the torsion.
      k - The force constant for the torsion.
      Returns:
      The index of the torsion that was added.
    • destroy

      public void destroy()
      Destroy the force.
      Specified by:
      destroy in class Force
    • getNumTorsions

      public int getNumTorsions()
      Get the number of torsions in the force.
      Returns:
      The number of torsions.
    • getTorsionParameters

      public void getTorsionParameters(int index, com.sun.jna.ptr.IntByReference particle1, com.sun.jna.ptr.IntByReference particle2, com.sun.jna.ptr.IntByReference particle3, com.sun.jna.ptr.IntByReference particle4, com.sun.jna.ptr.IntByReference periodicity, com.sun.jna.ptr.DoubleByReference phase, com.sun.jna.ptr.DoubleByReference k)
      Get the parameters for a torsion.
      Parameters:
      index - The index of the torsion.
      particle1 - The index of the first atom (output).
      particle2 - The index of the second atom (output).
      particle3 - The index of the third atom (output).
      particle4 - The index of the fourth atom (output).
      periodicity - The periodicity of the torsion (output).
      phase - The phase of the torsion (output).
      k - The force constant for the torsion (output).
    • getTorsionParameters

      public void getTorsionParameters(int index, IntBuffer particle1, IntBuffer particle2, IntBuffer particle3, IntBuffer particle4, IntBuffer periodicity, DoubleBuffer phase, DoubleBuffer k)
      Get the parameters for a torsion.
      Parameters:
      index - The index of the torsion.
      particle1 - The index of the first atom (output).
      particle2 - The index of the second atom (output).
      particle3 - The index of the third atom (output).
      particle4 - The index of the fourth atom (output).
      periodicity - The periodicity of the torsion (output).
      phase - The phase of the torsion (output).
      k - The force constant for the torsion (output).
    • setTorsionParameters

      public void setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k)
      Set the parameters for a torsion.
      Parameters:
      index - The index of the torsion for which to set parameters.
      particle1 - The index of the first atom in the torsion.
      particle2 - The index of the second atom in the torsion.
      particle3 - The index of the third atom in the torsion.
      particle4 - The index of the fourth atom in the torsion.
      periodicity - The periodicity of the torsion.
      phase - The phase of the torsion.
      k - The force constant for the torsion.
    • setUsesPeriodicBoundaryConditions

      public void setUsesPeriodicBoundaryConditions(boolean periodic)
      Set whether this force should apply periodic boundary conditions when calculating displacements.
      Parameters:
      periodic - If true, periodic boundary conditions will be applied.
    • updateParametersInContext

      public void updateParametersInContext(Context context)
      Update the parameters in the OpenMM Context.
      Parameters:
      context - The OpenMM Context.
    • usesPeriodicBoundaryConditions

      public boolean usesPeriodicBoundaryConditions()
      Check if the force uses periodic boundary conditions.
      Overrides:
      usesPeriodicBoundaryConditions in class Force
      Returns:
      True if the force uses periodic boundary conditions.