Class CustomVolumeForce
To use this class, create a CustomVolumeForce object, passing an algebraic expression to the constructor that defines the energy. The expression may depend on the following variables.
- v: The volume of the periodic box in nm^3.
- ax: The x component of the first box vector in nm. (The y and z components are always zero.)
- bx, by: The x and y components of the second box vector in nm. (The z component is always zero.)
- cx, cy, cz: The x, y and z components of the third box vector in nm.
- Global parameters that you define by calling addGlobalParameter().
The initial value of a global parameter is specified in the call to addGlobalParameter(). Their values can be modified during a simulation by calling Context::setParameter().
Expressions may involve the operators + (add), - (subtract), * (multiply), / (divide), and ^ (power), and the following functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, atan2, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta, select. All trigonometric functions are defined in radians, and log is the natural logarithm. step(x) = 0 if x < 0, 1 otherwise. delta(x) = 1 if x = 0, 0 otherwise. select(x,y,z) = z if x = 0, y otherwise.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
addGlobalParameter
(com.sun.jna.Pointer name, double defaultValue) Add a new global parameter that the energy may depend on.int
addGlobalParameter
(String name, double defaultValue) Add a new global parameter that the interaction may depend on.void
destroy()
Destroy the force.Get the algebraic expression that defines the energy.double
getGlobalParameterDefaultValue
(int index) Get the default value of a global parameter.getGlobalParameterName
(int index) Get the name of a global parameter.int
Get the number of global parameters that the energy depends on.void
setEnergyFunction
(com.sun.jna.Pointer energy) Set the algebraic expression that defines the energy.void
setEnergyFunction
(String energy) Set the algebraic expression that defines the energy.void
setGlobalParameterDefaultValue
(int index, double defaultValue) Set the default value of a global parameter.void
setGlobalParameterName
(int index, com.sun.jna.Pointer name) Set the name of a global parameter.void
setGlobalParameterName
(int index, String name) Set the name of a global parameter.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
-
CustomVolumeForce
Create a CustomVolumeForce.- Parameters:
energy
- an algebraic expression giving the energy as a function of the box shape
-
-
Method Details
-
addGlobalParameter
Add a new global parameter that the interaction may depend on. The default value provided to this method is the initial value of the parameter in newly created Contexts. You can change the value at any time by calling setParameter() on the Context.- Parameters:
name
- the name of the parameterdefaultValue
- the default value of the parameter- Returns:
- the index of the parameter that was added
-
addGlobalParameter
public int addGlobalParameter(com.sun.jna.Pointer name, double defaultValue) Add a new global parameter that the energy may depend on.- Parameters:
name
- The name of the parameter.defaultValue
- The default value of the parameter.- Returns:
- The index of the parameter that was added.
-
destroy
public void destroy()Destroy the force. -
getEnergyFunction
Get the algebraic expression that defines the energy.- Returns:
- the energy expression
-
getGlobalParameterDefaultValue
public double getGlobalParameterDefaultValue(int index) Get the default value of a global parameter.- Parameters:
index
- the index of the parameter for which to get the default value- Returns:
- the parameter default value
-
getGlobalParameterName
Get the name of a global parameter.- Parameters:
index
- the index of the parameter for which to get the name- Returns:
- the parameter name
-
getNumGlobalParameters
public int getNumGlobalParameters()Get the number of global parameters that the energy depends on.- Returns:
- The number of parameters.
-
setEnergyFunction
Set the algebraic expression that defines the energy.- Parameters:
energy
- the energy expression
-
setEnergyFunction
public void setEnergyFunction(com.sun.jna.Pointer energy) Set the algebraic expression that defines the energy.- Parameters:
energy
- the energy expression
-
setGlobalParameterDefaultValue
public void setGlobalParameterDefaultValue(int index, double defaultValue) Set the default value of a global parameter.- Parameters:
index
- the index of the parameter for which to set the default valuedefaultValue
- the default value of the parameter
-
setGlobalParameterName
Set the name of a global parameter.- Parameters:
index
- the index of the parameter for which to set the namename
- the name of the parameter
-
setGlobalParameterName
public void setGlobalParameterName(int index, com.sun.jna.Pointer name) Set the name of a global parameter.- Parameters:
index
- the index of the parameter for which to set the namename
- the name of the parameter
-
usesPeriodicBoundaryConditions
public boolean usesPeriodicBoundaryConditions()Returns whether or not this force makes use of periodic boundary conditions. Because this class is only applicable to periodic systems, this always returns true.- Overrides:
usesPeriodicBoundaryConditions
in classForce
- Returns:
- true if the force uses periodic boundary conditions
-