- Main Page
- Related Pages
- Classes
- Files

- File List

# CustomHbondForce.h

    00001 #ifndef OPENMM_CUSTOMHBONDFORCE_H_
    00002 #define OPENMM_CUSTOMHBONDFORCE_H_
    00003
    00004 /* -------------------------------------------------------------------------- *
    00005  *                                   OpenMM                                   *
    00006  * -------------------------------------------------------------------------- *
    00007  * This is part of the OpenMM molecular simulation toolkit originating from   *
    00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
    00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
    00010  * Medical Research, grant U54 GM072970. See https://simtk.org.               *
    00011  *                                                                            *
    00012  * Portions copyright (c) 2008-2014 Stanford University and the Authors.      *
    00013  * Authors: Peter Eastman                                                     *
    00014  * Contributors:                                                              *
    00015  *                                                                            *
    00016  * Permission is hereby granted, free of charge, to any person obtaining a    *
    00017  * copy of this software and associated documentation files (the "Software"), *
    00018  * to deal in the Software without restriction, including without limitation  *
    00019  * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
    00020  * and/or sell copies of the Software, and to permit persons to whom the      *
    00021  * Software is furnished to do so, subject to the following conditions:       *
    00022  *                                                                            *
    00023  * The above copyright notice and this permission notice shall be included in *
    00024  * all copies or substantial portions of the Software.                        *
    00025  *                                                                            *
    00026  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
    00027  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
    00028  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
    00029  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
    00030  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
    00031  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
    00032  * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
    00033  * -------------------------------------------------------------------------- */
    00034
    00035 #include "TabulatedFunction.h"
    00036 #include "Force.h"
    00037 #include "Vec3.h"
    00038 #include <map>
    00039 #include <set>
    00040 #include <utility>
    00041 #include <vector>
    00042 #include "internal/windowsExport.h"
    00043
    00044 namespace OpenMM {
    00045
    00099 class OPENMM_EXPORT CustomHbondForce : public Force {
    00100 public:
    00104     enum NonbondedMethod {
    00109         NoCutoff = 0,
    00113         CutoffNonPeriodic = 1,
    00118         CutoffPeriodic = 2,
    00119     };
    00127     explicit CustomHbondForce(const std::string& energy);
    00128     ~CustomHbondForce();
    00132     int getNumDonors() const {
    00133         return donors.size();
    00134     }
    00138     int getNumAcceptors() const {
    00139         return acceptors.size();
    00140     }
    00144     int getNumExclusions() const {
    00145         return exclusions.size();
    00146     }
    00150     int getNumPerDonorParameters() const {
    00151         return donorParameters.size();
    00152     }
    00156     int getNumPerAcceptorParameters() const {
    00157         return acceptorParameters.size();
    00158     }
    00162     int getNumGlobalParameters() const {
    00163         return globalParameters.size();
    00164     }
    00168     int getNumTabulatedFunctions() const {
    00169         return functions.size();
    00170     }
    00176     int getNumFunctions() const {
    00177         return functions.size();
    00178     }
    00182     const std::string& getEnergyFunction() const;
    00186     void setEnergyFunction(const std::string& energy);
    00190     NonbondedMethod getNonbondedMethod() const;
    00194     void setNonbondedMethod(NonbondedMethod method);
    00201     double getCutoffDistance() const;
    00208     void setCutoffDistance(double distance);
    00215     int addPerDonorParameter(const std::string& name);
    00222     const std::string& getPerDonorParameterName(int index) const;
    00229     void setPerDonorParameterName(int index, const std::string& name);
    00236     int addPerAcceptorParameter(const std::string& name);
    00243     const std::string& getPerAcceptorParameterName(int index) const;
    00250     void setPerAcceptorParameterName(int index, const std::string& name);
    00258     int addGlobalParameter(const std::string& name, double defaultValue);
    00265     const std::string& getGlobalParameterName(int index) const;
    00272     void setGlobalParameterName(int index, const std::string& name);
    00279     double getGlobalParameterDefaultValue(int index) const;
    00286     void setGlobalParameterDefaultValue(int index, double defaultValue);
    00298     int addDonor(int d1, int d2, int d3, const std::vector<double>& parameters);
    00310     void getDonorParameters(int index, int& d1, int& d2, int& d3, std::vector<double>& parameters) const;
    00322     void setDonorParameters(int index, int d1, int d2, int d3, const std::vector<double>& parameters);
    00334     int addAcceptor(int a1, int a2, int a3, const std::vector<double>& parameters);
    00346     void getAcceptorParameters(int index, int& a1, int& a2, int& a3, std::vector<double>& parameters) const;
    00358     void setAcceptorParameters(int index, int a1, int a2, int a3, const std::vector<double>& parameters);
    00366     int addExclusion(int donor, int acceptor);
    00374     void getExclusionParticles(int index, int& donor, int& acceptor) const;
    00382     void setExclusionParticles(int index, int donor, int acceptor);
    00392     int addTabulatedFunction(const std::string& name, TabulatedFunction* function);
    00399     const TabulatedFunction& getTabulatedFunction(int index) const;
    00406     TabulatedFunction& getTabulatedFunction(int index);
    00413     const std::string& getTabulatedFunctionName(int index) const;
    00419     int addFunction(const std::string& name, const std::vector<double>& values, double min, double max);
    00426     void getFunctionParameters(int index, std::string& name, std::vector<double>& values, double& min, double& max) const;
    00433     void setFunctionParameters(int index, const std::string& name, const std::vector<double>& values, double min, double max);
    00445     void updateParametersInContext(Context& context);
    00446 protected:
    00447     ForceImpl* createImpl() const;
    00448 private:
    00449     class GroupInfo;
    00450     class PerPairParameterInfo;
    00451     class GlobalParameterInfo;
    00452     class ExclusionInfo;
    00453     class FunctionInfo;
    00454     NonbondedMethod nonbondedMethod;
    00455     double cutoffDistance;
    00456     std::string energyExpression;
    00457     std::vector<PerPairParameterInfo> donorParameters;
    00458     std::vector<PerPairParameterInfo> acceptorParameters;
    00459     std::vector<GlobalParameterInfo> globalParameters;
    00460     std::vector<GroupInfo> donors;
    00461     std::vector<GroupInfo> acceptors;
    00462     std::vector<ExclusionInfo> exclusions;
    00463     std::vector<FunctionInfo> functions;
    00464 };
    00465
    00470 class CustomHbondForce::GroupInfo {
    00471 public:
    00472     std::vector<double> parameters;
    00473     int p1, p2, p3;
    00474     GroupInfo() : p1(-1), p2(-1), p3(-1) {
    00475     }
    00476     GroupInfo(int p1, int p2, int p3, const std::vector<double>& parameters) :
    00477         p1(p1), p2(p2), p3(p3), parameters(parameters) {
    00478     }
    00479 };
    00480
    00485 class CustomHbondForce::PerPairParameterInfo {
    00486 public:
    00487     std::string name;
    00488     PerPairParameterInfo() {
    00489     }
    00490     PerPairParameterInfo(const std::string& name) : name(name) {
    00491     }
    00492 };
    00493
    00498 class CustomHbondForce::GlobalParameterInfo {
    00499 public:
    00500     std::string name;
    00501     double defaultValue;
    00502     GlobalParameterInfo() {
    00503     }
    00504     GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
    00505     }
    00506 };
    00507
    00512 class CustomHbondForce::ExclusionInfo {
    00513 public:
    00514     int donor, acceptor;
    00515     ExclusionInfo() {
    00516         donor = acceptor = -1;
    00517     }
    00518     ExclusionInfo(int donor, int acceptor) :
    00519         donor(donor), acceptor(acceptor) {
    00520     }
    00521 };
    00522
    00527 class CustomHbondForce::FunctionInfo {
    00528 public:
    00529     std::string name;
    00530     TabulatedFunction* function;
    00531     FunctionInfo() {
    00532     }
    00533     FunctionInfo(const std::string& name, TabulatedFunction* function) : name(name), function(function) {
    00534     }
    00535 };
    00536
    00537 } // namespace OpenMM
    00538
    00539 #endif /*OPENMM_CUSTOMHBONDFORCE_H_*/