MELDOpenMMPlugin
MeldForce Class Reference

This is the MELD Force. More...

#include <MeldForce.h>

+ Inheritance diagram for MeldForce:

Public Member Functions

 MeldForce ()
 Default constructor. More...
 
void updateParametersInContext (OpenMM::Context &context)
 Update the per-restraint parameters in a Context to match those stored in this Force object. More...
 
int getNumDistRestraints () const
 
int getNumHyperbolicDistRestraints () const
 
int getNumTorsionRestraints () const
 
int getNumDistProfileRestraints () const
 
int getNumDistProfileRestParams () const
 
int getNumTorsProfileRestraints () const
 
int getNumTorsProfileRestParams () const
 
int getNumTotalRestraints () const
 
int getNumGroups () const
 
int getNumCollections () const
 
void getDistanceRestraintParams (int index, int &atom1, int &atom2, float &r1, float &r2, float &r3, float &r4, float &forceConstant, int &globalIndex) const
 Get the parameters for a distance restraint. More...
 
void getHyperbolicDistanceRestraintParams (int index, int &atom1, int &atom2, float &r1, float &r2, float &r3, float &r4, float &forceConstant, float &asymptote, int &globalIndex) const
 Get the parameters for a hyperbolic distance restraint. More...
 
void getTorsionRestraintParams (int index, int &atom1, int &atom2, int &atom3, int &atom4, float &phi, float &deltaPhi, float &forceConstant, int &globalIndex) const
 Get the parameters for a torsion restraint. More...
 
void getDistProfileRestraintParams (int index, int &atom1, int &atom2, float &rMin, float &rMax, int &nBins, std::vector< double > &a0, std::vector< double > &a1, std::vector< double > &a2, std::vector< double > &a3, float &scaleFactor, int &globalIndex) const
 Get the parameters for a distance profile restraint. More...
 
void getTorsProfileRestraintParams (int index, int &atom1, int &atom2, int &atom3, int &atom4, int &atom5, int &atom6, int &atom7, int &atom8, int &nBins, std::vector< double > &a0, std::vector< double > &a1, std::vector< double > &a2, std::vector< double > &a3, std::vector< double > &a4, std::vector< double > &a5, std::vector< double > &a6, std::vector< double > &a7, std::vector< double > &a8, std::vector< double > &a9, std::vector< double > &a10, std::vector< double > &a11, std::vector< double > &a12, std::vector< double > &a13, std::vector< double > &a14, std::vector< double > &a15, float &scaleFactor, int &globalIndex) const
 Get the parameters for a torsion profile restraint. More...
 
void getGroupParams (int index, std::vector< int > &indices, int &numActive) const
 Get the parameters for a group of restraints. More...
 
void getCollectionParams (int index, std::vector< int > &indices, int &numActive) const
 Get the parameters for a collection of restraint groups. More...
 
int addDistanceRestraint (int particle1, int particle2, float r1, float r2, float r3, float r4, float force_constant)
 Create a new distance restraint. More...
 
void modifyDistanceRestraint (int index, int particle1, int particle2, float r1, float r2, float r3, float r4, float force_constant)
 Modify an existing distance restraint. More...
 
int addHyperbolicDistanceRestraint (int particle1, int particle2, float r1, float r2, float r3, float r4, float force_constant, float asymptote)
 Create a new hyperbolic distance restraint. More...
 
void modifyHyperbolicDistanceRestraint (int index, int particle1, int particle2, float r1, float r2, float r3, float r4, float force_constant, float asymptote)
 Modify an existing hyperbolic distance restraint. More...
 
int addTorsionRestraint (int atom1, int atom2, int atom3, int atom4, float phi, float deltaPhi, float forceConstant)
 Create a new torsion restraint. More...
 
void modifyTorsionRestraint (int index, int atom1, int atom2, int atom3, int atom4, float phi, float deltaPhi, float forceConstant)
 Modify an existing torsion restraint. More...
 
int addDistProfileRestraint (int atom1, int atom2, float rMin, float rMax, int nBins, std::vector< double > a0, std::vector< double > a1, std::vector< double > a2, std::vector< double > a3, float scaleFactor)
 Create a new distance profile restraint. More...
 
void modifyDistProfileRestraint (int index, int atom1, int atom2, float rMin, float rMax, int nBins, std::vector< double > a0, std::vector< double > a1, std::vector< double > a2, std::vector< double > a3, float scaleFactor)
 Modify an existing distance profile restraint. More...
 
int addTorsProfileRestraint (int atom1, int atom2, int atom3, int atom4, int atom5, int atom6, int atom7, int atom8, int nBins, std::vector< double > a0, std::vector< double > a1, std::vector< double > a2, std::vector< double > a3, std::vector< double > a4, std::vector< double > a5, std::vector< double > a6, std::vector< double > a7, std::vector< double > a8, std::vector< double > a9, std::vector< double > a10, std::vector< double > a11, std::vector< double > a12, std::vector< double > a13, std::vector< double > a14, std::vector< double > a15, float scaleFactor)
 Create a new torsion profile restraint. More...
 
void modifyTorsProfileRestraint (int index, int atom1, int atom2, int atom3, int atom4, int atom5, int atom6, int atom7, int atom8, int nBins, std::vector< double > a0, std::vector< double > a1, std::vector< double > a2, std::vector< double > a3, std::vector< double > a4, std::vector< double > a5, std::vector< double > a6, std::vector< double > a7, std::vector< double > a8, std::vector< double > a9, std::vector< double > a10, std::vector< double > a11, std::vector< double > a12, std::vector< double > a13, std::vector< double > a14, std::vector< double > a15, float scaleFactor)
 Modify an existing torsion profile restraint. More...
 
int addGroup (std::vector< int > restraint_indices, int n_active)
 Create a new group of restraints. More...
 
int addCollection (std::vector< int > group_indices, int n_active)
 Create a new collection of restraint groups. More...
 

Protected Member Functions

OpenMM::ForceImpl * createImpl () const
 

Detailed Description

This is the MELD Force.

Constructor & Destructor Documentation

MeldForce ( )

Default constructor.

Member Function Documentation

int addCollection ( std::vector< int >  group_indices,
int  n_active 
)

Create a new collection of restraint groups.

Parameters
group_indicesthe indices of the groups in the collection
n_activethe number of active groups in the collection
Returns
the index of the collection that was created
int addDistanceRestraint ( int  particle1,
int  particle2,
float  r1,
float  r2,
float  r3,
float  r4,
float  force_constant 
)

Create a new distance restraint.

There are five regions:

I: r < r1

II: r1 < r < r2

III: r2 < r < r3

IV: r3 < r < r4

V: r4 < r

The energy is linear in regions I and V, quadratic in II and IV, and zero in III.

Parameters
particle1the first atom
particle2the second atom
r1the upper bound of region 1
r2the upper bound of region 2
r3the upper bound of region 3
r4the upper bound of region 4
forceConstantthe force constant
Returns
the index of the restraint that was created
int addDistProfileRestraint ( int  atom1,
int  atom2,
float  rMin,
float  rMax,
int  nBins,
std::vector< double >  a0,
std::vector< double >  a1,
std::vector< double >  a2,
std::vector< double >  a3,
float  scaleFactor 
)

Create a new distance profile restraint.

bin = floor( (r - rMin) / (rMax - rMin) * nBins) )

binWidth = (rMax - rMin) / nBins

t = (r - bin * binWidth + rMin) / binWidth;

E = scaleFactor * (a0 + a1 * t + a2 * t^2 + a3 * t^3)

Parameters
atom1the first atom
atom2the second atom
rMinthe lower bound of the restraint
rMaxthe upper bound of the restraint
nBinsthe number of bins
aNthe Nth spline parameter where N is in (0,1,2,3)
scaleFactorthe scale factor
Returns
the index of the restraint that was created
int addGroup ( std::vector< int >  restraint_indices,
int  n_active 
)

Create a new group of restraints.

Parameters
restraint_indicesthe indices of the restraints in the group
n_activethe number of active restraints in the group
Returns
the index of the group that was created
int addHyperbolicDistanceRestraint ( int  particle1,
int  particle2,
float  r1,
float  r2,
float  r3,
float  r4,
float  force_constant,
float  asymptote 
)

Create a new hyperbolic distance restraint.

There are five regions:

I: r < r1

II: r1 < r < r2

III: r2 < r < r3

IV: r3 < r < r4

V: r4 < r

The energy is linear in region I, quadratic in II and IV, and zero in III.

The energy is hyperbolic in region V, with an asymptotic value set by the parameter asymptote. The energy will be 1/3 of the asymptotic value at r=r4. The distance between r3 and r4 controls the steepness of the potential.

Parameters
particle1the first atom
particle2the second atom
r1the upper bound of region 1
r2the upper bound of region 2
r3the upper bound of region 3
r4the upper bound of region 4
forceConstantthe force constant in regions I and II
asymptotethe asymptotic value in region V, also controls the steepness in region IV.
Returns
the index of the restraint that was created
int addTorsionRestraint ( int  atom1,
int  atom2,
int  atom3,
int  atom4,
float  phi,
float  deltaPhi,
float  forceConstant 
)

Create a new torsion restraint.

If (x - phi) < -deltaPhi: E = 1/2 * forceConstant * (x - phi + deltaPhi)^2

Else if (x - phi) > deltaPhi: E = 1/2 * forceConstant * (x - phi - deltaPhi)^2

Else: E = 0

Parameters
atom1the first atom
atom2the second atom
atom3the third atom
atom4the fourth atom
phithe equilibrium torsion (degrees)
deltaPhithe deltaPhi parameter (degrees)
forceConstantthe force constant
Returns
the index of the restraint that was created
int addTorsProfileRestraint ( int  atom1,
int  atom2,
int  atom3,
int  atom4,
int  atom5,
int  atom6,
int  atom7,
int  atom8,
int  nBins,
std::vector< double >  a0,
std::vector< double >  a1,
std::vector< double >  a2,
std::vector< double >  a3,
std::vector< double >  a4,
std::vector< double >  a5,
std::vector< double >  a6,
std::vector< double >  a7,
std::vector< double >  a8,
std::vector< double >  a9,
std::vector< double >  a10,
std::vector< double >  a11,
std::vector< double >  a12,
std::vector< double >  a13,
std::vector< double >  a14,
std::vector< double >  a15,
float  scaleFactor 
)

Create a new torsion profile restraint.

Parameters
atom1the first atom
atom2the second atom
atom3the third atom
atom4the fourth atom
atom5the fifth atom
atom6the sixth atom
atom7the seventh atom
atom8the eighth atom
nBinsthe number of bins
aNthe Nth spline parameter where N is in (0,1,...,14,15)
scaleFactorthe scale factor
Returns
the index of the restraint that was created
OpenMM::ForceImpl* createImpl ( ) const
protected
void getCollectionParams ( int  index,
std::vector< int > &  indices,
int &  numActive 
) const

Get the parameters for a collection of restraint groups.

Parameters
indexthe index of the collection
indicesthe indices of the groups in the collection
numActivethe number of active groups in the collection
void getDistanceRestraintParams ( int  index,
int &  atom1,
int &  atom2,
float &  r1,
float &  r2,
float &  r3,
float &  r4,
float &  forceConstant,
int &  globalIndex 
) const

Get the parameters for a distance restraint.

See addDistanceRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
r1the upper bound of region 1
r2the upper bound of region 2
r3the upper bound of region 3
r4the upper bound of region 4
forceConstantthe force constant
globalIndexthe global index of the restraint
void getDistProfileRestraintParams ( int  index,
int &  atom1,
int &  atom2,
float &  rMin,
float &  rMax,
int &  nBins,
std::vector< double > &  a0,
std::vector< double > &  a1,
std::vector< double > &  a2,
std::vector< double > &  a3,
float &  scaleFactor,
int &  globalIndex 
) const

Get the parameters for a distance profile restraint.

See addDistProfileRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
rMinthe lower bound of the restraint
rMaxthe upper bound of the restraint
nBinsthe number of bins
aNthe Nth spline parameter where N is in (0,1,2,3)
scaleFactorthe scale factor
globalIndexthe global index of the restraint
void getGroupParams ( int  index,
std::vector< int > &  indices,
int &  numActive 
) const

Get the parameters for a group of restraints.

Parameters
indexthe index of the group
indicesthe indices of the restraints in the group
numActivethe number of active restraints in the group
void getHyperbolicDistanceRestraintParams ( int  index,
int &  atom1,
int &  atom2,
float &  r1,
float &  r2,
float &  r3,
float &  r4,
float &  forceConstant,
float &  asymptote,
int &  globalIndex 
) const

Get the parameters for a hyperbolic distance restraint.

See addHyperbolicDistanceRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
r1the upper bound of region 1
r2the upper bound of region 2
r3the upper bound of region 3
r4the upper bound of region 4
forceConstantthe force constant for region 1
asymptotethe asymptotic energy in region 4
globalIndexthe global index of the restraint
int getNumCollections ( ) const
Returns
The number of collections of restraint groups.
int getNumDistProfileRestParams ( ) const
Returns
The number of distance profile restraint parameters.
int getNumDistProfileRestraints ( ) const
Returns
The number of distance profile restraints.
int getNumDistRestraints ( ) const
Returns
The number of distance restraints.
int getNumGroups ( ) const
Returns
The number of restraint groups.
int getNumHyperbolicDistRestraints ( ) const
Returns
The number of hyperbolic distance restraints.
int getNumTorsionRestraints ( ) const
Returns
The number of torsion restraints.
int getNumTorsProfileRestParams ( ) const
Returns
The number of torsion profile restraint parameters.
int getNumTorsProfileRestraints ( ) const
Returns
The number of torsion profile restraints.
int getNumTotalRestraints ( ) const
Returns
The total number of distance and torsion restraints.
void getTorsionRestraintParams ( int  index,
int &  atom1,
int &  atom2,
int &  atom3,
int &  atom4,
float &  phi,
float &  deltaPhi,
float &  forceConstant,
int &  globalIndex 
) const

Get the parameters for a torsion restraint.

See addTorsionRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
atom3the third atom
atom4the fourth atom
phithe equilibrium torsion (degrees)
deltaPhithe deltaPhi parameter (degrees)
forceConstantthe force constant
globalIndexthe global index of the restraint
void getTorsProfileRestraintParams ( int  index,
int &  atom1,
int &  atom2,
int &  atom3,
int &  atom4,
int &  atom5,
int &  atom6,
int &  atom7,
int &  atom8,
int &  nBins,
std::vector< double > &  a0,
std::vector< double > &  a1,
std::vector< double > &  a2,
std::vector< double > &  a3,
std::vector< double > &  a4,
std::vector< double > &  a5,
std::vector< double > &  a6,
std::vector< double > &  a7,
std::vector< double > &  a8,
std::vector< double > &  a9,
std::vector< double > &  a10,
std::vector< double > &  a11,
std::vector< double > &  a12,
std::vector< double > &  a13,
std::vector< double > &  a14,
std::vector< double > &  a15,
float &  scaleFactor,
int &  globalIndex 
) const

Get the parameters for a torsion profile restraint.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
atom3the third atom
atom4the fourth atom
atom5the fifth atom
atom6the sixth atom
atom7the seventh atom
atom8the eighth atom
nBinsthe number of bins
aNthe Nth spline parameter where N is in (0,1,...,14,15)
scaleFactorthe scale factor
globalIndexthe global index of the restraint
void modifyDistanceRestraint ( int  index,
int  particle1,
int  particle2,
float  r1,
float  r2,
float  r3,
float  r4,
float  force_constant 
)

Modify an existing distance restraint.

See addDistanceRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
particle1the first atom
particle2the second atom
r1the upper bound of region 1
r2the upper bound of region 2
r3the upper bound of region 3
r4the upper bound of region 4
forceConstantthe force constant
void modifyDistProfileRestraint ( int  index,
int  atom1,
int  atom2,
float  rMin,
float  rMax,
int  nBins,
std::vector< double >  a0,
std::vector< double >  a1,
std::vector< double >  a2,
std::vector< double >  a3,
float  scaleFactor 
)

Modify an existing distance profile restraint.

See addDistProfileRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
rMinthe lower bound of the restraint
rMaxthe upper bound of the restraint
nBinsthe number of bins
aNthe Nth spline parameter where N is in (0,1,2,3)
scaleFactorthe scale factor
void modifyHyperbolicDistanceRestraint ( int  index,
int  particle1,
int  particle2,
float  r1,
float  r2,
float  r3,
float  r4,
float  force_constant,
float  asymptote 
)

Modify an existing hyperbolic distance restraint.

See addHyperbolicDistanceRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
particle1the first atom
particle2the second atom
r1the upper bound of region 1
r2the upper bound of region 2
r3the upper bound of region 3
r4the upper bound of region 4
forceConstantthe force constant
asymptotethe asymptotic value
void modifyTorsionRestraint ( int  index,
int  atom1,
int  atom2,
int  atom3,
int  atom4,
float  phi,
float  deltaPhi,
float  forceConstant 
)

Modify an existing torsion restraint.

See addTorsionRestraint() for more details about the parameters.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
atom3the third atom
atom4the fourth atom
phithe equilibrium torsion (degrees)
deltaPhithe deltaPhi parameter (degrees)
forceConstantthe force constant
void modifyTorsProfileRestraint ( int  index,
int  atom1,
int  atom2,
int  atom3,
int  atom4,
int  atom5,
int  atom6,
int  atom7,
int  atom8,
int  nBins,
std::vector< double >  a0,
std::vector< double >  a1,
std::vector< double >  a2,
std::vector< double >  a3,
std::vector< double >  a4,
std::vector< double >  a5,
std::vector< double >  a6,
std::vector< double >  a7,
std::vector< double >  a8,
std::vector< double >  a9,
std::vector< double >  a10,
std::vector< double >  a11,
std::vector< double >  a12,
std::vector< double >  a13,
std::vector< double >  a14,
std::vector< double >  a15,
float  scaleFactor 
)

Modify an existing torsion profile restraint.

Parameters
indexthe index of the restraint
atom1the first atom
atom2the second atom
atom3the third atom
atom4the fourth atom
atom5the fifth atom
atom6the sixth atom
atom7the seventh atom
atom8the eighth atom
nBinsthe number of bins
aNthe Nth spline parameter where N is in (0,1,...,14,15)
scaleFactorthe scale factor
void updateParametersInContext ( OpenMM::Context &  context)

Update the per-restraint 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 modifyDistanceRestaint(), modifyTorsionRestraint(), modifyDistProfileRestraint(), or modifyTorsProfileRestraint() to modify the parameters of a restraint, then call updateParametersInContext() to copy them over to the Context.

This method has several limitations. The only information it updates is the values of per-restraint parameters. All other aspects of the Force (such as the energy function) are unaffected and can only be changed by reinitializing the Context. The set of particles involved in a restraint cannot be changed, nor can new restraints be added.


The documentation for this class was generated from the following file: