Package ffx.openmm
Class PeriodicTorsionForce
java.lang.Object
ffx.openmm.Force
ffx.openmm.PeriodicTorsionForce
- Direct Known Subclasses:
ImproperTorsionForce
,RestrainTorsionsForce
,TorsionForce
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().
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
addTorsion
(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k) Add a torsion to the PeriodicTorsionForce.void
destroy()
Destroy the force.int
Get the number of torsions in the force.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.void
getTorsionParameters
(int index, IntBuffer particle1, IntBuffer particle2, IntBuffer particle3, IntBuffer particle4, IntBuffer periodicity, DoubleBuffer phase, DoubleBuffer k) Get the parameters for a torsion.void
setTorsionParameters
(int index, int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k) Set the parameters for a torsion.void
setUsesPeriodicBoundaryConditions
(boolean periodic) Set whether this force should apply periodic boundary conditions when calculating displacements.void
updateParametersInContext
(Context context) Update the parameters in the OpenMM Context.boolean
Check if the force uses periodic boundary conditions.Methods inherited from class ffx.openmm.Force
getForceGroup, getForceIndex, getName, getPointer, setForceGroup, setForceIndex, setName
-
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. -
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
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 classForce
- Returns:
- True if the force uses periodic boundary conditions.
-