- Main Page
- Related Pages
- Classes
- Files

- File List

# CustomAngleForce.h

    00001 #ifndef OPENMM_CUSTOMANGLEFORCE_H_
    00002 #define OPENMM_CUSTOMANGLEFORCE_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) 2010-2012 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 "Force.h"
    00036 #include "Vec3.h"
    00037 #include <vector>
    00038 #include "internal/windowsExport.h"
    00039
    00040 namespace OpenMM {
    00041
    00072 class OPENMM_EXPORT CustomAngleForce : public Force {
    00073 public:
    00080     explicit CustomAngleForce(const std::string& energy);
    00084     int getNumAngles() const {
    00085         return angles.size();
    00086     }
    00090     int getNumPerAngleParameters() const {
    00091         return parameters.size();
    00092     }
    00096     int getNumGlobalParameters() const {
    00097         return globalParameters.size();
    00098     }
    00102     const std::string& getEnergyFunction() const;
    00106     void setEnergyFunction(const std::string& energy);
    00113     int addPerAngleParameter(const std::string& name);
    00120     const std::string& getPerAngleParameterName(int index) const;
    00127     void setPerAngleParameterName(int index, const std::string& name);
    00135     int addGlobalParameter(const std::string& name, double defaultValue);
    00142     const std::string& getGlobalParameterName(int index) const;
    00149     void setGlobalParameterName(int index, const std::string& name);
    00156     double getGlobalParameterDefaultValue(int index) const;
    00163     void setGlobalParameterDefaultValue(int index, double defaultValue);
    00173     int addAngle(int particle1, int particle2, int particle3, const std::vector<double>& parameters);
    00183     void getAngleParameters(int index, int& particle1, int& particle2, int& particle3, std::vector<double>& parameters) const;
    00193     void setAngleParameters(int index, int particle1, int particle2, int particle3, const std::vector<double>& parameters);
    00204     void updateParametersInContext(Context& context);
    00205 protected:
    00206     ForceImpl* createImpl() const;
    00207 private:
    00208     class AngleInfo;
    00209     class AngleParameterInfo;
    00210     class GlobalParameterInfo;
    00211     std::string energyExpression;
    00212     std::vector<AngleParameterInfo> parameters;
    00213     std::vector<GlobalParameterInfo> globalParameters;
    00214     std::vector<AngleInfo> angles;
    00215 };
    00216
    00221 class CustomAngleForce::AngleInfo {
    00222 public:
    00223     int particle1, particle2, particle3;
    00224     std::vector<double> parameters;
    00225     AngleInfo() : particle1(-1), particle2(-1), particle3(-1) {
    00226     }
    00227     AngleInfo(int particle1, int particle2, int particle3, const std::vector<double>& parameters) :
    00228             particle1(particle1), particle2(particle2), particle3(particle3), parameters(parameters) {
    00229     }
    00230 };
    00231
    00236 class CustomAngleForce::AngleParameterInfo {
    00237 public:
    00238     std::string name;
    00239     AngleParameterInfo() {
    00240     }
    00241     AngleParameterInfo(const std::string& name) : name(name) {
    00242     }
    00243 };
    00244
    00249 class CustomAngleForce::GlobalParameterInfo {
    00250 public:
    00251     std::string name;
    00252     double defaultValue;
    00253     GlobalParameterInfo() {
    00254     }
    00255     GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
    00256     }
    00257 };
    00258
    00259 } // namespace OpenMM
    00260
    00261 #endif /*OPENMM_CUSTOMANGLEFORCE_H_*/