OpenMM

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CustomHbondForce.h
1 #ifndef OPENMM_CUSTOMHBONDFORCE_H_
2 #define OPENMM_CUSTOMHBONDFORCE_H_
3
4 /* -------------------------------------------------------------------------- *
5 * OpenMM *
6 * -------------------------------------------------------------------------- *
7 * This is part of the OpenMM molecular simulation toolkit originating from *
8 * Simbios, the NIH National Center for Physics-Based Simulation of *
9 * Biological Structures at Stanford, funded under the NIH Roadmap for *
10 * Medical Research, grant U54 GM072970. See https://simtk.org. *
11 * *
12 * Portions copyright (c) 2008-2014 Stanford University and the Authors. *
13 * Authors: Peter Eastman *
14 * Contributors: *
15 * *
16 * Permission is hereby granted, free of charge, to any person obtaining a *
17 * copy of this software and associated documentation files (the "Software"), *
18 * to deal in the Software without restriction, including without limitation *
19 * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
20 * and/or sell copies of the Software, and to permit persons to whom the *
21 * Software is furnished to do so, subject to the following conditions: *
22 * *
23 * The above copyright notice and this permission notice shall be included in *
24 * all copies or substantial portions of the Software. *
25 * *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
29 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
30 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
31 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
32 * USE OR OTHER DEALINGS IN THE SOFTWARE. *
33 * -------------------------------------------------------------------------- */
34
35 #include "TabulatedFunction.h"
36 #include "Force.h"
37 #include "Vec3.h"
38 #include <map>
39 #include <set>
40 #include <utility>
41 #include <vector>
42 #include "internal/windowsExport.h"
43
44 namespace OpenMM {
45
100 class OPENMM_EXPORT CustomHbondForce : public Force {
101 public:
105 enum NonbondedMethod {
110 NoCutoff = 0,
114 CutoffNonPeriodic = 1,
119 CutoffPeriodic = 2,
120 };
128 explicit CustomHbondForce(const std::string& energy);
129 ~CustomHbondForce();
133 int getNumDonors() const {
134 return donors.size();
135 }
139 int getNumAcceptors() const {
140 return acceptors.size();
141 }
145 int getNumExclusions() const {
146 return exclusions.size();
147 }
151 int getNumPerDonorParameters() const {
152 return donorParameters.size();
153 }
157 int getNumPerAcceptorParameters() const {
158 return acceptorParameters.size();
159 }
163 int getNumGlobalParameters() const {
164 return globalParameters.size();
165 }
169 int getNumTabulatedFunctions() const {
170 return functions.size();
171 }
177 int getNumFunctions() const {
178 return functions.size();
179 }
183 const std::string& getEnergyFunction() const;
187 void setEnergyFunction(const std::string& energy);
191 NonbondedMethod getNonbondedMethod() const;
195 void setNonbondedMethod(NonbondedMethod method);
202 double getCutoffDistance() const;
209 void setCutoffDistance(double distance);
216 int addPerDonorParameter(const std::string& name);
223 const std::string& getPerDonorParameterName(int index) const;
230 void setPerDonorParameterName(int index, const std::string& name);
237 int addPerAcceptorParameter(const std::string& name);
244 const std::string& getPerAcceptorParameterName(int index) const;
251 void setPerAcceptorParameterName(int index, const std::string& name);
259 int addGlobalParameter(const std::string& name, double defaultValue);
266 const std::string& getGlobalParameterName(int index) const;
273 void setGlobalParameterName(int index, const std::string& name);
280 double getGlobalParameterDefaultValue(int index) const;
287 void setGlobalParameterDefaultValue(int index, double defaultValue);
299 int addDonor(int d1, int d2, int d3, const std::vector<double>& parameters);
311 void getDonorParameters(int index, int& d1, int& d2, int& d3, std::vector<double>& parameters) const;
323 void setDonorParameters(int index, int d1, int d2, int d3, const std::vector<double>& parameters);
335 int addAcceptor(int a1, int a2, int a3, const std::vector<double>& parameters);
347 void getAcceptorParameters(int index, int& a1, int& a2, int& a3, std::vector<double>& parameters) const;
359 void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector<double>& parameters);
367 int addExclusion(int donor, int acceptor);
375 void getExclusionParticles(int index, int& donor, int& acceptor) const;
383 void setExclusionParticles(int index, int donor, int acceptor);
393 int addTabulatedFunction(const std::string& name, TabulatedFunction* function);
400 const TabulatedFunction& getTabulatedFunction(int index) const;
407 TabulatedFunction& getTabulatedFunction(int index);
414 const std::string& getTabulatedFunctionName(int index) const;
420 int addFunction(const std::string& name, const std::vector<double>& values, double min, double max);
427 void getFunctionParameters(int index, std::string& name, std::vector<double>& values, double& min, double& max) const;
434 void setFunctionParameters(int index, const std::string& name, const std::vector<double>& values, double min, double max);
446 void updateParametersInContext(Context& context);
453 bool usesPeriodicBoundaryConditions() const {
454 return nonbondedMethod == CustomHbondForce::CutoffPeriodic;
455 }
456 protected:
457 ForceImpl* createImpl() const;
458 private:
459 class GroupInfo;
460 class PerPairParameterInfo;
461 class GlobalParameterInfo;
462 class ExclusionInfo;
463 class FunctionInfo;
464 NonbondedMethod nonbondedMethod;
465 double cutoffDistance;
466 std::string energyExpression;
467 std::vector<PerPairParameterInfo> donorParameters;
468 std::vector<PerPairParameterInfo> acceptorParameters;
469 std::vector<GlobalParameterInfo> globalParameters;
470 std::vector<GroupInfo> donors;
471 std::vector<GroupInfo> acceptors;
472 std::vector<ExclusionInfo> exclusions;
473 std::vector<FunctionInfo> functions;
474 };
475
480 class CustomHbondForce::GroupInfo {
481 public:
482 std::vector<double> parameters;
483 int p1, p2, p3;
484 GroupInfo() : p1(-1), p2(-1), p3(-1) {
485 }
486 GroupInfo(int p1, int p2, int p3, const std::vector<double>& parameters) :
487 parameters(parameters), p1(p1), p2(p2), p3(p3) {
488 }
489 };
490
495 class CustomHbondForce::PerPairParameterInfo {
496 public:
497 std::string name;
498 PerPairParameterInfo() {
499 }
500 PerPairParameterInfo(const std::string& name) : name(name) {
501 }
502 };
503
508 class CustomHbondForce::GlobalParameterInfo {
509 public:
510 std::string name;
511 double defaultValue;
512 GlobalParameterInfo() {
513 }
514 GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
515 }
516 };
517
522 class CustomHbondForce::ExclusionInfo {
523 public:
524 int donor, acceptor;
525 ExclusionInfo() {
526 donor = acceptor = -1;
527 }
528 ExclusionInfo(int donor, int acceptor) :
529 donor(donor), acceptor(acceptor) {
530 }
531 };
532
537 class CustomHbondForce::FunctionInfo {
538 public:
539 std::string name;
540 TabulatedFunction* function;
541 FunctionInfo() {
542 }
543 FunctionInfo(const std::string& name, TabulatedFunction* function) : name(name), function(function) {
544 }
545 };
546
547 } // namespace OpenMM
548
549 #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