00001 #ifndef OPENMM_CUSTOMHBONDFORCE_H_
00002 #define OPENMM_CUSTOMHBONDFORCE_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "Force.h"
00036 #include "Vec3.h"
00037 #include <map>
00038 #include <set>
00039 #include <utility>
00040 #include <vector>
00041 #include "internal/windowsExport.h"
00042
00043 namespace OpenMM {
00044
00098 class OPENMM_EXPORT CustomHbondForce : public Force {
00099 public:
00103 enum NonbondedMethod {
00108 NoCutoff = 0,
00112 CutoffNonPeriodic = 1,
00117 CutoffPeriodic = 2,
00118 };
00126 explicit CustomHbondForce(const std::string& energy);
00130 int getNumDonors() const {
00131 return donors.size();
00132 }
00136 int getNumAcceptors() const {
00137 return acceptors.size();
00138 }
00142 int getNumExclusions() const {
00143 return exclusions.size();
00144 }
00148 int getNumPerDonorParameters() const {
00149 return donorParameters.size();
00150 }
00154 int getNumPerAcceptorParameters() const {
00155 return acceptorParameters.size();
00156 }
00160 int getNumGlobalParameters() const {
00161 return globalParameters.size();
00162 }
00166 int getNumFunctions() const {
00167 return functions.size();
00168 }
00172 const std::string& getEnergyFunction() const;
00176 void setEnergyFunction(const std::string& energy);
00180 NonbondedMethod getNonbondedMethod() const;
00184 void setNonbondedMethod(NonbondedMethod method);
00191 double getCutoffDistance() const;
00198 void setCutoffDistance(double distance);
00205 int addPerDonorParameter(const std::string& name);
00212 const std::string& getPerDonorParameterName(int index) const;
00219 void setPerDonorParameterName(int index, const std::string& name);
00226 int addPerAcceptorParameter(const std::string& name);
00233 const std::string& getPerAcceptorParameterName(int index) const;
00240 void setPerAcceptorParameterName(int index, const std::string& name);
00248 int addGlobalParameter(const std::string& name, double defaultValue);
00255 const std::string& getGlobalParameterName(int index) const;
00262 void setGlobalParameterName(int index, const std::string& name);
00269 double getGlobalParameterDefaultValue(int index) const;
00276 void setGlobalParameterDefaultValue(int index, double defaultValue);
00288 int addDonor(int d1, int d2, int d3, const std::vector<double>& parameters);
00300 void getDonorParameters(int index, int& d1, int& d2, int& d3, std::vector<double>& parameters) const;
00312 void setDonorParameters(int index, int d1, int d2, int d3, const std::vector<double>& parameters);
00324 int addAcceptor(int a1, int a2, int a3, const std::vector<double>& parameters);
00336 void getAcceptorParameters(int index, int& a1, int& a2, int& a3, std::vector<double>& parameters) const;
00348 void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector<double>& parameters);
00356 int addExclusion(int donor, int acceptor);
00364 void getExclusionParticles(int index, int& donor, int& acceptor) const;
00372 void setExclusionParticles(int index, int donor, int acceptor);
00383 int addFunction(const std::string& name, const std::vector<double>& values, double min, double max);
00394 void getFunctionParameters(int index, std::string& name, std::vector<double>& values, double& min, double& max) const;
00405 void setFunctionParameters(int index, const std::string& name, const std::vector<double>& values, double min, double max);
00406 protected:
00407 ForceImpl* createImpl();
00408 private:
00409 class GroupInfo;
00410 class PerPairParameterInfo;
00411 class GlobalParameterInfo;
00412 class ExclusionInfo;
00413 class FunctionInfo;
00414 NonbondedMethod nonbondedMethod;
00415 double cutoffDistance;
00416 std::string energyExpression;
00417 std::vector<PerPairParameterInfo> donorParameters;
00418 std::vector<PerPairParameterInfo> acceptorParameters;
00419 std::vector<GlobalParameterInfo> globalParameters;
00420 std::vector<GroupInfo> donors;
00421 std::vector<GroupInfo> acceptors;
00422 std::vector<ExclusionInfo> exclusions;
00423 std::vector<FunctionInfo> functions;
00424 };
00425
00430 class CustomHbondForce::GroupInfo {
00431 public:
00432 std::vector<double> parameters;
00433 int p1, p2, p3;
00434 GroupInfo() : p1(-1), p2(-1), p3(-1) {
00435 }
00436 GroupInfo(int p1, int p2, int p3, const std::vector<double>& parameters) :
00437 p1(p1), p2(p2), p3(p3), parameters(parameters) {
00438 }
00439 };
00440
00445 class CustomHbondForce::PerPairParameterInfo {
00446 public:
00447 std::string name;
00448 PerPairParameterInfo() {
00449 }
00450 PerPairParameterInfo(const std::string& name) : name(name) {
00451 }
00452 };
00453
00458 class CustomHbondForce::GlobalParameterInfo {
00459 public:
00460 std::string name;
00461 double defaultValue;
00462 GlobalParameterInfo() {
00463 }
00464 GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
00465 }
00466 };
00467
00472 class CustomHbondForce::ExclusionInfo {
00473 public:
00474 int donor, acceptor;
00475 ExclusionInfo() {
00476 donor = acceptor = -1;
00477 }
00478 ExclusionInfo(int donor, int acceptor) :
00479 donor(donor), acceptor(acceptor) {
00480 }
00481 };
00482
00487 class CustomHbondForce::FunctionInfo {
00488 public:
00489 std::string name;
00490 std::vector<double> values;
00491 double min, max;
00492 FunctionInfo() {
00493 }
00494 FunctionInfo(const std::string& name, const std::vector<double>& values, double min, double max) :
00495 name(name), values(values), min(min), max(max) {
00496 }
00497 };
00498
00499 }
00500
00501 #endif