All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CustomHbondForce.h
#ifndef OPENMM_CUSTOMHBONDFORCE_H_
#define OPENMM_CUSTOMHBONDFORCE_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 CustomHbondForce : public Force {
public:
enum NonbondedMethod {
NoCutoff = 0,
CutoffNonPeriodic = 1,
CutoffPeriodic = 2,
};
explicit CustomHbondForce(const std::string& energy);
~CustomHbondForce();
int getNumDonors() const {
return donors.size();
}
int getNumAcceptors() const {
return acceptors.size();
}
int getNumExclusions() const {
return exclusions.size();
}
int getNumPerDonorParameters() const {
return donorParameters.size();
}
int getNumPerAcceptorParameters() const {
return acceptorParameters.size();
}
int getNumGlobalParameters() const {
return globalParameters.size();
}
int getNumTabulatedFunctions() const {
return functions.size();
}
int getNumFunctions() const {
return functions.size();
}
const std::string& getEnergyFunction() const;
void setEnergyFunction(const std::string& energy);
NonbondedMethod getNonbondedMethod() const;
void setNonbondedMethod(NonbondedMethod method);
double getCutoffDistance() const;
void setCutoffDistance(double distance);
int addPerDonorParameter(const std::string& name);
const std::string& getPerDonorParameterName(int index) const;
void setPerDonorParameterName(int index, const std::string& name);
int addPerAcceptorParameter(const std::string& name);
const std::string& getPerAcceptorParameterName(int index) const;
void setPerAcceptorParameterName(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 addDonor(int d1, int d2, int d3, const std::vector<double>& parameters);
void getDonorParameters(int index, int& d1, int& d2, int& d3, std::vector<double>& parameters) const;
void setDonorParameters(int index, int d1, int d2, int d3, const std::vector<double>& parameters);
int addAcceptor(int a1, int a2, int a3, const std::vector<double>& parameters);
void getAcceptorParameters(int index, int& a1, int& a2, int& a3, std::vector<double>& parameters) const;
void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector<double>& parameters);
int addExclusion(int donor, int acceptor);
void getExclusionParticles(int index, int& donor, int& acceptor) const;
void setExclusionParticles(int index, int donor, int acceptor);
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 == CustomHbondForce::CutoffPeriodic;
}
protected:
ForceImpl* createImpl() const;
private:
class GroupInfo;
class PerPairParameterInfo;
class GlobalParameterInfo;
class ExclusionInfo;
class FunctionInfo;
NonbondedMethod nonbondedMethod;
double cutoffDistance;
std::string energyExpression;
std::vector<PerPairParameterInfo> donorParameters;
std::vector<PerPairParameterInfo> acceptorParameters;
std::vector<GlobalParameterInfo> globalParameters;
std::vector<GroupInfo> donors;
std::vector<GroupInfo> acceptors;
std::vector<ExclusionInfo> exclusions;
std::vector<FunctionInfo> functions;
};
class CustomHbondForce::GroupInfo {
public:
std::vector<double> parameters;
int p1, p2, p3;
GroupInfo() : p1(-1), p2(-1), p3(-1) {
}
GroupInfo(int p1, int p2, int p3, const std::vector<double>& parameters) :
parameters(parameters), p1(p1), p2(p2), p3(p3) {
}
};
class CustomHbondForce::PerPairParameterInfo {
public:
std::string name;
PerPairParameterInfo() {
}
PerPairParameterInfo(const std::string& name) : name(name) {
}
};
class CustomHbondForce::GlobalParameterInfo {
public:
std::string name;
double defaultValue;
GlobalParameterInfo() {
}
GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
}
};
class CustomHbondForce::ExclusionInfo {
public:
int donor, acceptor;
ExclusionInfo() {
donor = acceptor = -1;
}
ExclusionInfo(int donor, int acceptor) :
donor(donor), acceptor(acceptor) {
}
};
class CustomHbondForce::FunctionInfo {
public:
std::string name;
TabulatedFunction* function;
FunctionInfo() {
}
FunctionInfo(const std::string& name, TabulatedFunction* function) : name(name), function(function) {
}
};
} // namespace OpenMM
#endif /*OPENMM_CUSTOMHBONDFORCE_H_*/
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::CustomHbondForce::getNumAcceptors
int getNumAcceptors() const
Get the number of acceptors for which force field parameters have been defined.
Definition: CustomHbondForce.h:139
OpenMM::CustomHbondForce::getNumPerDonorParameters
int getNumPerDonorParameters() const
Get the number of per-donor parameters that the interaction depends on.
Definition: CustomHbondForce.h:151
OpenMM::CustomHbondForce::getNumFunctions
int getNumFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomHbondForce.h:177
OpenMM::CustomHbondForce
This class supports a wide variety of energy functions used to represent hydrogen bonding...
Definition: CustomHbondForce.h:100
OpenMM::Force
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
OpenMM::CustomHbondForce::getNumExclusions
int getNumExclusions() const
Get the number of donor-acceptor pairs whose interactions should be excluded.
Definition: CustomHbondForce.h:145
OpenMM::CustomHbondForce::usesPeriodicBoundaryConditions
bool usesPeriodicBoundaryConditions() const
Returns whether or not this force makes use of periodic boundary conditions.
Definition: CustomHbondForce.h:453
OpenMM::CustomHbondForce::getNumPerAcceptorParameters
int getNumPerAcceptorParameters() const
Get the number of per-acceptor parameters that the interaction depends on.
Definition: CustomHbondForce.h:157
OpenMM::CustomHbondForce::NonbondedMethod
NonbondedMethod
This is an enumeration of the different methods that may be used for handling long range nonbonded fo...
Definition: CustomHbondForce.h:105
OpenMM::CustomHbondForce::CutoffPeriodic
Periodic boundary conditions are used, so that each particle interacts only with the nearest periodic...
Definition: CustomHbondForce.h:119
OpenMM
Definition: AndersenThermostat.h:40
OpenMM::CustomHbondForce::getNumDonors
int getNumDonors() const
Get the number of donors for which force field parameters have been defined.
Definition: CustomHbondForce.h:133
OpenMM::CustomHbondForce::getNumTabulatedFunctions
int getNumTabulatedFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomHbondForce.h:169
OpenMM::CustomHbondForce::getNumGlobalParameters
int getNumGlobalParameters() const
Get the number of global parameters that the interaction depends on.
Definition: CustomHbondForce.h:163