OpenMM

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
System.h
1 #ifndef OPENMM_SYSTEM_H_
2 #define OPENMM_SYSTEM_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-2009 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 "Vec3.h"
36 #include <vector>
37 #include "internal/windowsExport.h"
38
39 namespace OpenMM {
40
41 class OPENMM_EXPORT Force;
42 class OPENMM_EXPORT VirtualSite;
43
66 class OPENMM_EXPORT System {
67 public:
71 System();
72 ~System();
76 int getNumParticles() const {
77 return masses.size();
78 }
88 int addParticle(double mass) {
89 masses.push_back(mass);
90 return masses.size()-1;
91 }
100 double getParticleMass(int index) const;
110 void setParticleMass(int index, double mass);
120 void setVirtualSite(int index, VirtualSite* virtualSite);
126 bool isVirtualSite(int index) const {
127 return (index < (int) virtualSites.size() && virtualSites[index] != NULL);
128 }
135 const VirtualSite& getVirtualSite(int index) const;
139 int getNumConstraints() const {
140 return constraints.size();
141 }
151 int addConstraint(int particle1, int particle2, double distance);
160 void getConstraintParameters(int index, int& particle1, int& particle2, double& distance) const;
170 void setConstraintParameters(int index, int particle1, int particle2, double distance);
176 void removeConstraint(int index);
185 int addForce(Force* force) {
186 forces.push_back(force);
187 return forces.size()-1;
188 }
192 int getNumForces() const {
193 return forces.size();
194 }
200 const Force& getForce(int index) const;
206 Force& getForce(int index);
213 void removeForce(int index);
223 void getDefaultPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const;
237 void setDefaultPeriodicBoxVectors(const Vec3& a, const Vec3& b, const Vec3& c);
246 bool usesPeriodicBoundaryConditions();
247 private:
248 class ConstraintInfo;
249 Vec3 periodicBoxVectors[3];
250 std::vector<double> masses;
251 std::vector<ConstraintInfo> constraints;
252 std::vector<Force*> forces;
253 std::vector<VirtualSite*> virtualSites;
254 };
255
260 class System::ConstraintInfo {
261 public:
262 int particle1, particle2;
263 double distance;
264 ConstraintInfo() {
265 particle1 = particle2 = -1;
266 distance = 0.0;
267 }
268 ConstraintInfo(int particle1, int particle2, double distance) :
269 particle1(particle1), particle2(particle2), distance(distance) {
270 }
271 };
272
273 } // namespace OpenMM
274
275 #endif /*OPENMM_SYSTEM_H_*/
OpenMM::System::getNumConstraints
int getNumConstraints() const
Get the number of distance constraints in this System.
Definition: System.h:139
OpenMM::VirtualSite
A VirtualSite describes the rules for computing a particle's position based on other particles...
Definition: VirtualSite.h:48
OpenMM::Force
Force objects apply forces to the particles in a System, or alter their behavior in other ways...
Definition: Force.h:65
OpenMM::System::getNumForces
int getNumForces() const
Get the number of Force objects that have been added to the System.
Definition: System.h:192
OpenMM::System
This class represents a molecular system.
Definition: System.h:66
OpenMM::Vec3
This class represents a three component vector.
Definition: Vec3.h:45
OpenMM::System::addForce
int addForce(Force *force)
Add a Force to the System.
Definition: System.h:185
OpenMM::System::addParticle
int addParticle(double mass)
Add a particle to the System.
Definition: System.h:88
OpenMM
Definition: AndersenThermostat.h:40
OpenMM::System::isVirtualSite
bool isVirtualSite(int index) const
Get whether a particle is a VirtualSite.
Definition: System.h:126
OpenMM::System::getNumParticles
int getNumParticles() const
Get the number of particles in this System.
Definition: System.h:76