Package ffx.openmm
Class CMAPTorsionForce
java.lang.Object
ffx.openmm.Force
ffx.openmm.CMAPTorsionForce
This class implements an interaction between pairs of dihedral angles. The interaction energy is
defined by an "energy correction map" (CMAP), which is simply a set of tabulated energy values
on a regular grid of (phi, psi) angles. Natural cubic spline interpolation is used to compute
forces and energies at arbitrary values of the two angles.
To use this class, first create one or more energy correction maps by calling addMap(). For each one, you provide an array of energies at uniformly spaced values of the two angles. Next, add interactions by calling addTorsion(). For each one, you specify the sequence of particles used to calculate each of the two dihedral angles, and the index of the map used to calculate their interaction energy.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
addMap
(int size, com.sun.jna.ptr.PointerByReference energy) Create a new map that can be used for torsion pairs.int
addTorsion
(int map, int a1, int a2, int a3, int a4, int b1, int b2, int b3, int b4) Add a CMAP torsion term to the force field.void
destroy()
Destroy the force.void
getMapParameters
(int index, com.sun.jna.ptr.IntByReference size, com.sun.jna.ptr.PointerByReference energy) Get the energy values of a map.void
getMapParameters
(int index, IntBuffer size, com.sun.jna.ptr.PointerByReference energy) Get the energy values of a map.int
Get the number of maps that have been defined.int
Get the number of CMAP torsion terms in the potential functionvoid
getTorsionParameters
(int index, com.sun.jna.ptr.IntByReference map, com.sun.jna.ptr.IntByReference a1, com.sun.jna.ptr.IntByReference a2, com.sun.jna.ptr.IntByReference a3, com.sun.jna.ptr.IntByReference a4, com.sun.jna.ptr.IntByReference b1, com.sun.jna.ptr.IntByReference b2, com.sun.jna.ptr.IntByReference b3, com.sun.jna.ptr.IntByReference b4) Get the force field parameters for a CMAP torsion term.void
getTorsionParameters
(int index, IntBuffer map, IntBuffer a1, IntBuffer a2, IntBuffer a3, IntBuffer a4, IntBuffer b1, IntBuffer b2, IntBuffer b3, IntBuffer b4) Get the force field parameters for a CMAP torsion term.void
setMapParameters
(int index, int size, com.sun.jna.ptr.PointerByReference energy) Set the energy values of a map.void
setTorsionParameters
(int index, int map, int a1, int a2, int a3, int a4, int b1, int b2, int b3, int b4) Set the force field parameters for a CMAP torsion term.void
setUsesPeriodicBoundaryConditions
(boolean periodic) Set whether this force should apply periodic boundary conditions when calculating displacements.void
updateParametersInContext
(Context context) Update the map and torsion parameters in a Context to match those stored in this Force object.boolean
Returns whether or not this force makes use of periodic boundary conditions.Methods inherited from class ffx.openmm.Force
getForceGroup, getForceIndex, getName, getPointer, setForceGroup, setForceIndex, setName
-
Constructor Details
-
CMAPTorsionForce
public CMAPTorsionForce()Create a CMAPTorsionForce.
-
-
Method Details
-
addMap
public int addMap(int size, com.sun.jna.ptr.PointerByReference energy) Create a new map that can be used for torsion pairs.- Parameters:
size
- the size of the map along each dimensionenergy
- the energy values for the map. This must be of length size*size. The element energy[i+size*j] contains the energy when the first torsion angle equals i*2*PI/size and the second torsion angle equals j*2*PI/size.- Returns:
- the index of the map that was added
-
addTorsion
public int addTorsion(int map, int a1, int a2, int a3, int a4, int b1, int b2, int b3, int b4) Add a CMAP torsion term to the force field.- Parameters:
map
- the index of the map to use for this terma1
- the index of the first particle forming the first torsiona2
- the index of the second particle forming the first torsiona3
- the index of the third particle forming the first torsiona4
- the index of the fourth particle forming the first torsionb1
- the index of the first particle forming the second torsionb2
- the index of the second particle forming the second torsionb3
- the index of the third particle forming the second torsionb4
- the index of the fourth particle forming the second torsion- Returns:
- the index of the torsion that was added
-
destroy
public void destroy()Destroy the force. -
getMapParameters
public void getMapParameters(int index, com.sun.jna.ptr.IntByReference size, com.sun.jna.ptr.PointerByReference energy) Get the energy values of a map.- Parameters:
index
- the index of the map for which to get energy valuessize
- the size of the map along each dimensionenergy
- the energy values for the map. This must be of length size*size. The element energy[i+size*j] contains the energy when the first torsion angle equals i*2*PI/size and the second torsion angle equals j*2*PI/size.
-
getMapParameters
Get the energy values of a map.- Parameters:
index
- the index of the map for which to get energy valuessize
- the size of the map along each dimensionenergy
- the energy values for the map. This must be of length size*size. The element energy[i+size*j] contains the energy when the first torsion angle equals i*2*PI/size and the second torsion angle equals j*2*PI/size.
-
getNumMaps
public int getNumMaps()Get the number of maps that have been defined. -
getNumTorsions
public int getNumTorsions()Get the number of CMAP torsion terms in the potential function -
getTorsionParameters
public void getTorsionParameters(int index, com.sun.jna.ptr.IntByReference map, com.sun.jna.ptr.IntByReference a1, com.sun.jna.ptr.IntByReference a2, com.sun.jna.ptr.IntByReference a3, com.sun.jna.ptr.IntByReference a4, com.sun.jna.ptr.IntByReference b1, com.sun.jna.ptr.IntByReference b2, com.sun.jna.ptr.IntByReference b3, com.sun.jna.ptr.IntByReference b4) Get the force field parameters for a CMAP torsion term.- Parameters:
index
- the index of the torsion for which to get parametersmap
- the index of the map to use for this terma1
- the index of the first particle forming the first torsiona2
- the index of the second particle forming the first torsiona3
- the index of the third particle forming the first torsiona4
- the index of the fourth particle forming the first torsionb1
- the index of the first particle forming the second torsionb2
- the index of the second particle forming the second torsionb3
- the index of the third particle forming the second torsionb4
- the index of the fourth particle forming the second torsion
-
getTorsionParameters
public void getTorsionParameters(int index, IntBuffer map, IntBuffer a1, IntBuffer a2, IntBuffer a3, IntBuffer a4, IntBuffer b1, IntBuffer b2, IntBuffer b3, IntBuffer b4) Get the force field parameters for a CMAP torsion term.- Parameters:
index
- the index of the torsion for which to get parametersmap
- the index of the map to use for this terma1
- the index of the first particle forming the first torsiona2
- the index of the second particle forming the first torsiona3
- the index of the third particle forming the first torsiona4
- the index of the fourth particle forming the first torsionb1
- the index of the first particle forming the second torsionb2
- the index of the second particle forming the second torsionb3
- the index of the third particle forming the second torsionb4
- the index of the fourth particle forming the second torsion
-
setMapParameters
public void setMapParameters(int index, int size, com.sun.jna.ptr.PointerByReference energy) Set the energy values of a map.- Parameters:
index
- the index of the map for which to set energy valuessize
- the size of the map along each dimensionenergy
- the energy values for the map. This must be of length size*size. The element energy[i+size*j] contains the energy when the first torsion angle equals i*2*PI/size and the second torsion angle equals j*2*PI/size.
-
setTorsionParameters
public void setTorsionParameters(int index, int map, int a1, int a2, int a3, int a4, int b1, int b2, int b3, int b4) Set the force field parameters for a CMAP torsion term.- Parameters:
index
- the index of the torsion for which to set parametersmap
- the index of the map to use for this terma1
- the index of the first particle forming the first torsiona2
- the index of the second particle forming the first torsiona3
- the index of the third particle forming the first torsiona4
- the index of the fourth particle forming the first torsionb1
- the index of the first particle forming the second torsionb2
- the index of the second particle forming the second torsionb3
- the index of the third particle forming the second torsionb4
- the index of the fourth particle forming the second torsion
-
setUsesPeriodicBoundaryConditions
public void setUsesPeriodicBoundaryConditions(boolean periodic) Set whether this force should apply periodic boundary conditions when calculating displacements. Usually this is not appropriate for bonded forces, but there are situations when it can be useful. -
updateParametersInContext
Update the map and torsion parameters in a Context to match those stored in this Force object. This method provides an efficient method to update certain parameters in an existing Context without needing to reinitialize it. Simply call setMapParameters() and setTorsionParameters() to modify this object's parameters, then call updateParametersInContext() to copy them over to the Context.The only information that can be updated with this method is the energy values for a map, and the map index for a torsion. The size of a map and the set of particles involved in a torsion cannot be changed. Also, new bonds and torsions cannot be added.
-
usesPeriodicBoundaryConditions
public boolean usesPeriodicBoundaryConditions()Returns whether or not this force makes use of periodic boundary conditions.- Overrides:
usesPeriodicBoundaryConditions
in classForce
- Returns:
- true if force uses PBC and false otherwise
-