OpenMM

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CustomCompoundBondForce.h
1 #ifndef OPENMM_CUSTOMCOMPOUNDBONDFORCE_H_
2 #define OPENMM_CUSTOMCOMPOUNDBONDFORCE_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 <vector>
39 #include "internal/windowsExport.h"
40
41 namespace OpenMM {
42
100 class OPENMM_EXPORT CustomCompoundBondForce : public Force {
101 public:
110 explicit CustomCompoundBondForce(int numParticles, const std::string& energy);
111 ~CustomCompoundBondForce();
115 int getNumParticlesPerBond() const {
116 return particlesPerBond;
117 }
121 int getNumBonds() const {
122 return bonds.size();
123 }
127 int getNumPerBondParameters() const {
128 return bondParameters.size();
129 }
133 int getNumGlobalParameters() const {
134 return globalParameters.size();
135 }
139 int getNumTabulatedFunctions() const {
140 return functions.size();
141 }
147 int getNumFunctions() const {
148 return functions.size();
149 }
153 const std::string& getEnergyFunction() const;
157 void setEnergyFunction(const std::string& energy);
164 int addPerBondParameter(const std::string& name);
171 const std::string& getPerBondParameterName(int index) const;
178 void setPerBondParameterName(int index, const std::string& name);
186 int addGlobalParameter(const std::string& name, double defaultValue);
193 const std::string& getGlobalParameterName(int index) const;
200 void setGlobalParameterName(int index, const std::string& name);
207 double getGlobalParameterDefaultValue(int index) const;
214 void setGlobalParameterDefaultValue(int index, double defaultValue);
222 int addBond(const std::vector<int>& particles, const std::vector<double>& parameters);
230 void getBondParameters(int index, std::vector<int>& particles, std::vector<double>& parameters) const;
238 void setBondParameters(int index, const std::vector<int>& particles, const std::vector<double>& parameters);
248 int addTabulatedFunction(const std::string& name, TabulatedFunction* function);
255 const TabulatedFunction& getTabulatedFunction(int index) const;
262 TabulatedFunction& getTabulatedFunction(int index);
269 const std::string& getTabulatedFunctionName(int index) const;
275 int addFunction(const std::string& name, const std::vector<double>& values, double min, double max);
282 void getFunctionParameters(int index, std::string& name, std::vector<double>& values, double& min, double& max) const;
289 void setFunctionParameters(int index, const std::string& name, const std::vector<double>& values, double min, double max);
300 void updateParametersInContext(Context& context);
307 bool usesPeriodicBoundaryConditions() const {
308 return false;
309 }
310 protected:
311 ForceImpl* createImpl() const;
312 private:
313 class BondInfo;
314 class BondParameterInfo;
315 class GlobalParameterInfo;
316 class FunctionInfo;
317 int particlesPerBond;
318 std::string energyExpression;
319 std::vector<BondParameterInfo> bondParameters;
320 std::vector<GlobalParameterInfo> globalParameters;
321 std::vector<BondInfo> bonds;
322 std::vector<FunctionInfo> functions;
323 };
324
329 class CustomCompoundBondForce::BondInfo {
330 public:
331 std::vector<int> particles;
332 std::vector<double> parameters;
333 BondInfo() {
334 }
335 BondInfo(const std::vector<int>& particles, const std::vector<double>& parameters) :
336 particles(particles), parameters(parameters) {
337 }
338 };
339
344 class CustomCompoundBondForce::BondParameterInfo {
345 public:
346 std::string name;
347 BondParameterInfo() {
348 }
349 BondParameterInfo(const std::string& name) : name(name) {
350 }
351 };
352
357 class CustomCompoundBondForce::GlobalParameterInfo {
358 public:
359 std::string name;
360 double defaultValue;
361 GlobalParameterInfo() {
362 }
363 GlobalParameterInfo(const std::string& name, double defaultValue) : name(name), defaultValue(defaultValue) {
364 }
365 };
366
371 class CustomCompoundBondForce::FunctionInfo {
372 public:
373 std::string name;
374 TabulatedFunction* function;
375 FunctionInfo() {
376 }
377 FunctionInfo(const std::string& name, TabulatedFunction* function) : name(name), function(function) {
378 }
379 };
380
381 } // namespace OpenMM
382
383 #endif /*OPENMM_CUSTOMCOMPOUNDBONDFORCE_H_*/
OpenMM::CustomCompoundBondForce::usesPeriodicBoundaryConditions
bool usesPeriodicBoundaryConditions() const
Returns whether or not this force makes use of periodic boundary conditions.
Definition: CustomCompoundBondForce.h:307
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::CustomCompoundBondForce::getNumPerBondParameters
int getNumPerBondParameters() const
Get the number of per-bond parameters that the interaction depends on.
Definition: CustomCompoundBondForce.h:127
OpenMM::CustomCompoundBondForce::getNumTabulatedFunctions
int getNumTabulatedFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomCompoundBondForce.h:139
OpenMM::Force
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
OpenMM::CustomCompoundBondForce::getNumBonds
int getNumBonds() const
Get the number of bonds for which force field parameters have been defined.
Definition: CustomCompoundBondForce.h:121
OpenMM::CustomCompoundBondForce::getNumParticlesPerBond
int getNumParticlesPerBond() const
Get the number of particles used to define each bond.
Definition: CustomCompoundBondForce.h:115
OpenMM::CustomCompoundBondForce::getNumFunctions
int getNumFunctions() const
Get the number of tabulated functions that have been defined.
Definition: CustomCompoundBondForce.h:147
OpenMM::CustomCompoundBondForce::getNumGlobalParameters
int getNumGlobalParameters() const
Get the number of global parameters that the interaction depends on.
Definition: CustomCompoundBondForce.h:133
OpenMM::CustomCompoundBondForce
This class supports a wide variety of bonded interactions.
Definition: CustomCompoundBondForce.h:100
OpenMM
Definition: AndersenThermostat.h:40