Commit 61d5cc0f authored by Peter's avatar Peter
Browse files

Merge branch 'master' into applecl

parents e2999354 afae4bc8
......@@ -68,7 +68,7 @@ ForceValidationResult::ForceValidationResult( const Context& context1, const Con
ForceValidationResult::~ForceValidationResult( ){
}
void ForceValidationResult::_calculateNorms( void ){
void ForceValidationResult::_calculateNorms(){
// ---------------------------------------------------------------------------------------
......@@ -195,7 +195,7 @@ std::vector<double> ForceValidationResult::getForceNorms( int forceIndex ) cons
}
}
int ForceValidationResult::nansDetected( void ) const {
int ForceValidationResult::nansDetected() const {
return _nansDetected;
}
......@@ -203,7 +203,7 @@ void ForceValidationResult::registerInconsistentForceIndex( int index, int value
_inconsistentForceIndicies[index] = value;
}
void ForceValidationResult::clearInconsistentForceIndexList( void ){
void ForceValidationResult::clearInconsistentForceIndexList(){
_inconsistentForceIndicies.clear();
}
......@@ -213,7 +213,7 @@ void ForceValidationResult::getInconsistentForceIndexList( std::vector<int>& inc
}
}
int ForceValidationResult::getNumberOfInconsistentForceEntries( void ) const {
int ForceValidationResult::getNumberOfInconsistentForceEntries() const {
return static_cast<int>(_inconsistentForceIndicies.size() );
}
......@@ -329,7 +329,7 @@ double ForceValidationResult::getMaxDotProduct( int* maxIndex ) const {
return maxDotProduct;
}
std::string ForceValidationResult::getForceName( void ) const {
std::string ForceValidationResult::getForceName() const {
// ---------------------------------------------------------------------------------------
......@@ -376,7 +376,7 @@ void ForceValidationResult::compareForces( double tolerance ){
std::vector<Vec3> forces2 = getForces( 1 );
std::vector<double> forceNorms2 = getForceNorms( 1 );
clearInconsistentForceIndexList( );
clearInconsistentForceIndexList();
for( unsigned int jj = 0; jj < forces1.size(); jj++ ){
if( ValidateOpenMM::isNanOrInfinity( forceNorms1[jj] ) || ValidateOpenMM::isNanOrInfinity( forceNorms2[jj] ) ){
registerInconsistentForceIndex( jj );
......@@ -406,7 +406,7 @@ void ForceValidationResult::compareForceNorms( double tolerance ){
std::vector<double> forceNorms0 = getForceNorms( 0 );
std::vector<double> forceNorms1 = getForceNorms( 1 );
clearInconsistentForceIndexList( );
clearInconsistentForceIndexList();
for( unsigned int jj = 0; jj < forceNorms0.size(); jj++ ){
if( ValidateOpenMM::isNanOrInfinity( forceNorms0[jj] ) || ValidateOpenMM::isNanOrInfinity( forceNorms1[jj] ) ){
registerInconsistentForceIndex( jj );
......@@ -420,11 +420,11 @@ void ForceValidationResult::compareForceNorms( double tolerance ){
}
}
ValidateOpenMMForces::ValidateOpenMMForces( void ) {
ValidateOpenMMForces::ValidateOpenMMForces() {
_initialize();
}
void ValidateOpenMMForces::_initialize( void ){
void ValidateOpenMMForces::_initialize(){
_forceTolerance = 1.0e-02;
_maxErrorsToPrint = 25;
......@@ -450,7 +450,7 @@ void ValidateOpenMMForces::_initialize( void ){
_forcesToBeExcluded[ANDERSEN_THERMOSTAT] = 1;
}
ValidateOpenMMForces::~ValidateOpenMMForces( ){
ValidateOpenMMForces::~ValidateOpenMMForces(){
for( unsigned int ii = 0; ii < _forceValidationResults.size(); ii++ ){
delete _forceValidationResults[ii];
......@@ -459,7 +459,7 @@ ValidateOpenMMForces::~ValidateOpenMMForces( ){
}
double ValidateOpenMMForces::getForceTolerance( void ) const {
double ValidateOpenMMForces::getForceTolerance() const {
return _forceTolerance;
}
......@@ -706,7 +706,7 @@ double ValidateOpenMMForces::getForceTolerance( const std::string& forceName ) c
return _forceTolerance;
}
int ValidateOpenMMForces::getMaxErrorsToPrint( void ) const {
int ValidateOpenMMForces::getMaxErrorsToPrint() const {
return _maxErrorsToPrint;
}
......
......@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Portions copyright (c) 2008-2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -103,11 +103,13 @@ public:
* @param includeForce true if forces should be computed
* @param includeEnergy true if potential energy should be computed
* @param groups a set of bit flags for which force groups to include
* @param valid the method may set this to false to indicate the results are invalid and the force/energy
* calculation should be repeated
* @return the potential energy of the system. This value is added to all values returned by ForceImpls'
* calcForcesAndEnergy() methods. That is, each force kernel may <i>either</i> return its contribution to the
* energy directly, <i>or</i> add it to an internal buffer so that it will be included here.
*/
virtual double finishComputation(ContextImpl& context, bool includeForce, bool includeEnergy, int groups) = 0;
virtual double finishComputation(ContextImpl& context, bool includeForce, bool includeEnergy, int groups, bool& valid) = 0;
};
/**
......@@ -492,6 +494,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the CMAPTorsionForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const CMAPTorsionForce& force) = 0;
};
/**
......@@ -1225,10 +1234,10 @@ public:
* Begin computing the force and energy.
*
* @param io an object that coordinates data transfer
* @param periodicBoxSize the size of the periodic box (measured in nm)
* @param periodicBoxVectors the vectors defining the periodic box (measured in nm)
* @param includeEnergy true if potential energy should be computed
*/
virtual void beginComputation(IO& io, Vec3 periodicBoxSize, bool includeEnergy) = 0;
virtual void beginComputation(IO& io, const Vec3* periodicBoxVectors, bool includeEnergy) = 0;
/**
* Finish computing the force and energy.
*
......
......@@ -134,7 +134,10 @@ int Platform::getNumPlatforms() {
}
Platform& Platform::getPlatform(int index) {
if (index >= 0 && index < getNumPlatforms()) {
return *getPlatforms()[index];
}
throw OpenMMException("Invalid platform index");
}
Platform& Platform::getPlatformByName(const string& name) {
......
......@@ -56,6 +56,7 @@
#include "openmm/LocalEnergyMinimizer.h"
#include "openmm/MonteCarloAnisotropicBarostat.h"
#include "openmm/MonteCarloBarostat.h"
#include "openmm/MonteCarloMembraneBarostat.h"
#include "openmm/NonbondedForce.h"
#include "openmm/Context.h"
#include "openmm/OpenMMException.h"
......
......@@ -35,6 +35,7 @@
#include "Force.h"
#include <string>
#include "internal/windowsExport.h"
#include "openmm/internal/OSRngSeed.h"
namespace OpenMM {
......@@ -113,10 +114,23 @@ public:
* the other hand, no guarantees are made about the behavior of simulations that use the same seed.
* In particular, Platforms are permitted to use non-deterministic algorithms which produce different
* results on successive runs, even if those runs were initialized identically.
*
* If seed is set to 0 (which is the default value assigned), a unique seed is chosen when a Context
* is created from this Force. This is done to ensure that each Context receives unique random seeds
* without you needing to set them explicitly.
*/
void setRandomNumberSeed(int seed) {
randomNumberSeed = seed;
}
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -49,7 +49,7 @@ public:
*
* @param temperature the temperature of the heat bath (in Kelvin)
* @param frictionCoeff the friction coefficient which couples the system to the heat bath, measured in 1/ps
* @param stepSize the step size with which to integrator the system (in picoseconds)
* @param stepSize the step size with which to integrate the system (in picoseconds)
*/
BrownianIntegrator(double temperature, double frictionCoeff, double stepSize);
/**
......@@ -99,6 +99,10 @@ public:
* the other hand, no guarantees are made about the behavior of simulations that use the same seed.
* In particular, Platforms are permitted to use non-deterministic algorithms which produce different
* results on successive runs, even if those runs were initialized identically.
*
* If seed is set to 0 (which is the default value assigned), a unique seed is chosen when a Context
* is created from this Force. This is done to ensure that each Context receives unique random seeds
* without you needing to set them explicitly.
*/
void setRandomNumberSeed(int seed) {
randomNumberSeed = seed;
......
......@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010 Stanford University and the Authors. *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -148,6 +148,26 @@ public:
* @param b4 the index of the fourth particle forming the second torsion
*/
void setTorsionParameters(int index, int map, int a1, int a2, int a3, int a4, int b1, int b2, int b3, int b4);
/**
* 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.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns false
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -61,6 +61,15 @@ public:
void setFrequency(int freq) {
frequency = freq;
}
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -182,8 +182,9 @@ public:
* Set the vectors defining the axes of the periodic box (measured in nm). They will affect
* any Force that uses periodic boundary conditions.
*
* Currently, only rectangular boxes are supported. This means that a, b, and c must be aligned with the
* x, y, and z axes respectively. Future releases may support arbitrary triclinic boxes.
* Triclinic boxes are supported, but the vectors must satisfy certain requirements. In particular,
* a must point in the x direction, b must point "mostly" in the y direction, and c must point "mostly"
* in the z direction. See the documentation for details.
*
* @param a the vector defining the first edge of the periodic box
* @param b the vector defining the second edge of the periodic box
......
......@@ -65,7 +65,7 @@ namespace OpenMM {
* </pre></tt>
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
*/
......@@ -194,7 +194,7 @@ public:
/**
* Update the per-angle 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 setAngleParameters() to modify this object's parameters, then call updateParametersInState()
* Simply call setAngleParameters() to modify this object's parameters, 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-angle parameters.
......@@ -202,6 +202,15 @@ public:
* the Context. The set of particles involved in a angle cannot be changed, nor can new angles be added.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns false
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -65,7 +65,7 @@ namespace OpenMM {
* </pre></tt>
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
*/
......@@ -191,7 +191,7 @@ public:
/**
* Update the per-bond 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 setBondParameters() to modify this object's parameters, then call updateParametersInState()
* Simply call setBondParameters() to modify this object's parameters, 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-bond parameters.
......@@ -199,6 +199,15 @@ public:
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns false
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -89,7 +89,7 @@ namespace OpenMM {
* </pre></tt>
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
*
* In addition, you can call addTabulatedFunction() to define a new function based on tabulated values. You specify the function by
......@@ -289,7 +289,7 @@ public:
/**
* Update the per-bond 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 setBondParameters() to modify this object's parameters, then call updateParametersInState()
* Simply call setBondParameters() to modify this object's parameters, 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-bond parameters.
......@@ -297,6 +297,15 @@ public:
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns false
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -68,7 +68,7 @@ namespace OpenMM {
* </pre></tt>
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
*/
......@@ -191,7 +191,7 @@ public:
/**
* Update the per-particle 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 setParticleParameters() to modify this object's parameters, then call updateParametersInState()
* Simply call setParticleParameters() to modify this object's parameters, 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-particle parameters.
......@@ -199,6 +199,15 @@ public:
* the Context. Also, this method cannot be used to add new particles, only to change the parameters of existing ones.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns false
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -129,7 +129,7 @@ namespace OpenMM {
* particular piece of the computation.
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise. In expressions for
* particle pair calculations, the names of per-particle parameters and computed values
* have the suffix "1" or "2" appended to them to indicate the values for the two interacting particles. As seen in the above example,
......@@ -515,7 +515,7 @@ public:
/**
* Update the per-particle 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 setParticleParameters() to modify this object's parameters, then call updateParametersInState()
* Simply call setParticleParameters() to modify this object's parameters, 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-particle parameters.
......@@ -523,6 +523,15 @@ public:
* the Context. Also, this method cannot be used to add new particles, only to change the parameters of existing ones.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return nonbondedMethod == CustomGBForce::CutoffPeriodic;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -89,7 +89,7 @@ namespace OpenMM {
* </pre></tt>
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
*
* In addition, you can call addTabulatedFunction() to define a new function based on tabulated values. You specify the function by
......@@ -435,7 +435,7 @@ public:
* Update the per-donor and per-acceptor 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 setDonorParameters() and setAcceptorParameters() to modify this object's parameters, then call
* updateParametersInState() to copy them over to the Context.
* updateParametersInContext() to copy them over to the Context.
*
* This method has several limitations. The only information it updates is the values of per-donor and per-acceptor parameters.
* All other aspects of the Force (the energy function, nonbonded method, cutoff distance, etc.) are unaffected and can only
......@@ -443,6 +443,15 @@ public:
* new donors or acceptors be added.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return nonbondedMethod == CustomHbondForce::CutoffPeriodic;
}
protected:
ForceImpl* createImpl() const;
private:
......@@ -474,7 +483,7 @@ public:
GroupInfo() : p1(-1), p2(-1), p3(-1) {
}
GroupInfo(int p1, int p2, int p3, const std::vector<double>& parameters) :
p1(p1), p2(p2), p3(p3), parameters(parameters) {
parameters(parameters), p1(p1), p2(p2), p3(p3) {
}
};
......
......@@ -204,7 +204,7 @@ namespace OpenMM {
* the force from a single force group, or a random number.
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise. An expression
* may also involve intermediate quantities that are defined following the main expression, using ";" as a separator.
*/
......@@ -302,6 +302,13 @@ public:
* @return the current value of the variable
*/
double getGlobalVariable(int index) const;
/**
* Get the current value of a global variable, specified by name.
*
* @param name the name of the variable to get
* @return the current value of the parameter
*/
double getGlobalVariableByName(const std::string& name) const;
/**
* Set the value of a global variable.
*
......@@ -324,6 +331,14 @@ public:
* are stored into this
*/
void getPerDofVariable(int index, std::vector<Vec3>& values) const;
/**
* Get the value of a per-DOF variable, specified by name.
*
* @param name the name of the variable to get
* @param values the values of the variable for all degrees of freedom
* are stored into this
*/
void getPerDofVariableByName(const std::string& name, std::vector<Vec3>& values) const;
/**
* Set the value of a per-DOF variable.
*
......@@ -429,6 +444,10 @@ public:
* the other hand, no guarantees are made about the behavior of simulations that use the same seed.
* In particular, Platforms are permitted to use non-deterministic algorithms which produce different
* results on successive runs, even if those runs were initialized identically.
*
* If seed is set to 0 (which is the default value assigned), a unique seed is chosen when a Context
* is created from this Force. This is done to ensure that each Context receives unique random seeds
* without you needing to set them explicitly.
*/
void setRandomNumberSeed(int seed) {
randomNumberSeed = seed;
......
......@@ -149,7 +149,7 @@ namespace OpenMM {
* still only be evaluated once for each triplet, so it must still be symmetric with respect to p2 and p3.
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
* The names of per-particle parameters have the suffix "1", "2", etc. appended to them to indicate the values for the multiple interacting particles.
* For example, if you define a per-particle parameter called "charge", then the variable "charge2" is the charge of particle p2.
......@@ -461,6 +461,15 @@ public:
* the parameters of existing ones.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return nonbondedMethod == CustomManyParticleForce::CutoffPeriodic;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -120,7 +120,7 @@ namespace OpenMM {
* frequently, the long range correction can be very slow. For this reason, it is disabled by default.
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise. The names of per-particle parameters
* have the suffix "1" or "2" appended to them to indicate the values for the two interacting particles. As seen in the above example,
* the expression may also involve intermediate quantities that are defined following the main expression, using ";" as a separator.
......@@ -464,6 +464,15 @@ public:
* the parameters of existing ones.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return nonbondedMethod == CustomNonbondedForce::CutoffPeriodic;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -65,7 +65,7 @@ namespace OpenMM {
* </pre></tt>
*
* 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, sinh, cosh, tanh, erf, erfc, min, max, abs, step, delta. All trigonometric functions
* functions: sqrt, exp, log, sin, cos, sec, csc, tan, cot, asin, acos, atan, sinh, cosh, tanh, erf, erfc, min, max, abs, floor, ceil, step, delta. All trigonometric functions
* are defined in radians, and log is the natural logarithm. step(x) = 0 if x is less than 0, 1 otherwise. delta(x) = 1 if x is 0, 0 otherwise.
*/
......@@ -197,7 +197,7 @@ public:
/**
* Update the per-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 setTorsionParameters() to modify this object's parameters, then call updateParametersInState()
* Simply call setTorsionParameters() to modify this object's parameters, 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-torsion parameters.
......@@ -205,6 +205,15 @@ public:
* the Context. The set of particles involved in a torsion cannot be changed, nor can new torsions be added.
*/
void updateParametersInContext(Context& context);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions.
*
* @returns true if force uses PBC and false otherwise
*/
bool usesPeriodicBoundaryConditions() const {
return false;
}
protected:
ForceImpl* createImpl() const;
private:
......
......@@ -78,6 +78,14 @@ public:
* @param group the group index. Legal values are between 0 and 31 (inclusive).
*/
void setForceGroup(int group);
/**
* Returns whether or not this force makes use of periodic boundary
* conditions. This method should be overridden for all Force subclasses, or
* a OpenMM::OpenMMException will be thrown
*
* @return true if Force uses periodic boundaries or false if it does not
*/
virtual bool usesPeriodicBoundaryConditions() const;
protected:
friend class ContextImpl;
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment