All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CustomGBForce.h
#ifndef OPENMM_CUSTOMGBFORCE_H_
#define OPENMM_CUSTOMGBFORCE_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2014 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "TabulatedFunction.h"
#include "Force.h"
#include "Vec3.h"
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "internal/windowsExport.h"
namespace OpenMM {
class OPENMM_EXPORT CustomGBForce : public Force {
public:
enum NonbondedMethod {
NoCutoff = 0,
CutoffNonPeriodic = 1,
CutoffPeriodic = 2,
};
enum ComputationType {
SingleParticle = 0,
ParticlePair = 1,
ParticlePairNoExclusions = 2
};
CustomGBForce();
~CustomGBForce();
int getNumParticles() const {
return particles.size();
}
int getNumExclusions() const {
return exclusions.size();
}
int getNumPerParticleParameters() const {
return parameters.size();
}
int getNumGlobalParameters() const {
return globalParameters.size();
}
int getNumTabulatedFunctions() const {
return functions.size();
}
int getNumFunctions() const {
return functions.size();
}
int getNumComputedValues() const {
return computedValues.size();
}
int getNumEnergyTerms() const {
return energyTerms.size();
}
NonbondedMethod getNonbondedMethod() const;
void setNonbondedMethod(NonbondedMethod method);
double getCutoffDistance() const;
void setCutoffDistance(double distance);
int addPerParticleParameter(const std::string& name);
const std::string& getPerParticleParameterName(int index) const;
void setPerParticleParameterName(int index, const std::string& name);
int addGlobalParameter(const std::string& name, double defaultValue);
const std::string& getGlobalParameterName(int index) const;
void setGlobalParameterName(int index, const std::string& name);
double getGlobalParameterDefaultValue(int index) const;
void setGlobalParameterDefaultValue(int index, double defaultValue);
int addParticle(const std::vector<double>& parameters);
void getParticleParameters(int index, std::vector<double>& parameters) const;
void setParticleParameters(int index, const std::vector<double>& parameters);
int addComputedValue(const std::string& name, const std::string& expression, ComputationType type);
void getComputedValueParameters(int index, std::string& name, std::string& expression, ComputationType& type) const;
void setComputedValueParameters(int index, const std::string& name, const std::string& expression, ComputationType type);
int addEnergyTerm(const std::string& expression, ComputationType type);
void getEnergyTermParameters(int index, std::string& expression, ComputationType& type) const;
void setEnergyTermParameters(int index, const std::string& expression, ComputationType type);
int addExclusion(int particle1, int particle2);
void getExclusionParticles(int index, int& particle1, int& particle2) const;
void setExclusionParticles(int index, int particle1, int particle2);
int addTabulatedFunction(const std::string& name, TabulatedFunction* function);
const TabulatedFunction& getTabulatedFunction(int index) const;
TabulatedFunction& getTabulatedFunction(int index);
const std::string& getTabulatedFunctionName(int index) const;
int addFunction(const std::string& name, const std::vector<double>& values, double min, double max);
void getFunctionParameters(int index, std::string& name, std::vector<double>& values, double& min, double& max) const;
void setFunctionParameters(int index, const std::string& name, const std::vector<double>& values, double min, double max);
void updateParametersInContext(Context& context);
bool usesPeriodicBoundaryConditions() const {
return nonbondedMethod == CustomGBForce::CutoffPeriodic;
}
protected:
ForceImpl* createImpl() const;
private:
class ParticleInfo;
class PerParticleParameterInfo;
class GlobalParameterInfo;
class ExclusionInfo;
class FunctionInfo;
class ComputationInfo;
NonbondedMethod nonbondedMethod;
double cutoffDistance;
std::vector<PerParticleParameterInfo> parameters;
std::vector<GlobalParameterInfo> globalParameters;
std::vector<ParticleInfo> particles;
std::vector<ExclusionInfo> exclusions;
std::vector<FunctionInfo> functions;
std::vector<ComputationInfo> computedValues;
std::vector<ComputationInfo> energyTerms;
};
class CustomGBForce::ParticleInfo {
public:
std::vector<double> parameters;
ParticleInfo() {
}
ParticleInfo(const std::vector<double>& parameters) : parameters(parameters) {
}
};
class CustomGBForce::PerParticleParameterInfo {
public:
std::string name;
PerParticleParameterInfo() {
}
PerParticleParameterInfo(const std::string& name) : name(name) {
}
};
class CustomGBForce::GlobalParameterInfo {
public:
std::string name;
double defaultValue;
GlobalParameterInfo() {
}
GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
}
};
class CustomGBForce::ExclusionInfo {
public:
int particle1, particle2;
ExclusionInfo() {
particle1 = particle2 = -1;
}
ExclusionInfo(int particle1, int particle2) :
particle1(particle1), particle2(particle2) {
}
};
class CustomGBForce::FunctionInfo {
public:
std::string name;
TabulatedFunction* function;
FunctionInfo() {
}
FunctionInfo(const std::string& name, TabulatedFunction* function) : name(name), function(function) {
}
};
class CustomGBForce::ComputationInfo {
public:
std::string name;
std::string expression;
CustomGBForce::ComputationType type;
ComputationInfo() {
}
ComputationInfo(const std::string& name, const std::string& expression, CustomGBForce::ComputationType type) :
name(name), expression(expression), type(type) {
}
};
} // namespace OpenMM
#endif /*OPENMM_CUSTOMGBFORCE_H_*/
OpenMM::CustomGBForce::getNumFunctions
int getNumFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomGBForce.h:221
OpenMM::TabulatedFunction
A TabulatedFunction uses a set of tabulated values to define a mathematical function.
Definition: TabulatedFunction.h:58
OpenMM::Context
A Context stores the complete state of a simulation.
Definition: Context.h:67
OpenMM::CustomGBForce
This class implements complex, multiple stage nonbonded interactions between particles.
Definition: CustomGBForce.h:142
OpenMM::CustomGBForce::usesPeriodicBoundaryConditions
bool usesPeriodicBoundaryConditions() const
Returns whether or not this force makes use of periodic boundary conditions.
Definition: CustomGBForce.h:532
OpenMM::Force
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
OpenMM::CustomGBForce::getNumTabulatedFunctions
int getNumTabulatedFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomGBForce.h:213
OpenMM::CustomGBForce::getNumEnergyTerms
int getNumEnergyTerms() const
Get the number of terms in the energy computation.
Definition: CustomGBForce.h:233
OpenMM::CustomGBForce::NonbondedMethod
NonbondedMethod
This is an enumeration of the different methods that may be used for handling long range nonbonded fo...
Definition: CustomGBForce.h:147
OpenMM::CustomGBForce::CutoffPeriodic
Periodic boundary conditions are used, so that each particle interacts only with the nearest periodic...
Definition: CustomGBForce.h:161
OpenMM::CustomGBForce::getNumExclusions
int getNumExclusions() const
Get the number of particle pairs whose interactions should be excluded.
Definition: CustomGBForce.h:195
OpenMM::CustomGBForce::getNumComputedValues
int getNumComputedValues() const
Get the number of per-particle computed values the interaction depends on.
Definition: CustomGBForce.h:227
OpenMM::CustomGBForce::getNumParticles
int getNumParticles() const
Get the number of particles for which force field parameters have been defined.
Definition: CustomGBForce.h:189
OpenMM::CustomGBForce::getNumPerParticleParameters
int getNumPerParticleParameters() const
Get the number of per-particle parameters that the interaction depends on.
Definition: CustomGBForce.h:201
OpenMM
Definition: AndersenThermostat.h:40
OpenMM::CustomGBForce::ComputationType
ComputationType
This is an enumeration of the different ways in which a computed value or energy term can be calculat...
Definition: CustomGBForce.h:166
OpenMM::CustomGBForce::getNumGlobalParameters
int getNumGlobalParameters() const
Get the number of global parameters that the interaction depends on.
Definition: CustomGBForce.h:207