All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
System.h
#ifndef OPENMM_SYSTEM_H_
#define OPENMM_SYSTEM_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-2009 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "Vec3.h"
#include <vector>
#include "internal/windowsExport.h"
namespace OpenMM {
class OPENMM_EXPORT Force;
class OPENMM_EXPORT VirtualSite;
class OPENMM_EXPORT System {
public:
System();
~System();
int getNumParticles() const {
return masses.size();
}
int addParticle(double mass) {
masses.push_back(mass);
return masses.size()-1;
}
double getParticleMass(int index) const;
void setParticleMass(int index, double mass);
void setVirtualSite(int index, VirtualSite* virtualSite);
bool isVirtualSite(int index) const {
return (index < (int) virtualSites.size() && virtualSites[index] != NULL);
}
const VirtualSite& getVirtualSite(int index) const;
int getNumConstraints() const {
return constraints.size();
}
int addConstraint(int particle1, int particle2, double distance);
void getConstraintParameters(int index, int& particle1, int& particle2, double& distance) const;
void setConstraintParameters(int index, int particle1, int particle2, double distance);
void removeConstraint(int index);
int addForce(Force* force) {
forces.push_back(force);
return forces.size()-1;
}
int getNumForces() const {
return forces.size();
}
const Force& getForce(int index) const;
Force& getForce(int index);
void removeForce(int index);
void getDefaultPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const;
void setDefaultPeriodicBoxVectors(const Vec3& a, const Vec3& b, const Vec3& c);
bool usesPeriodicBoundaryConditions();
private:
class ConstraintInfo;
Vec3 periodicBoxVectors[3];
std::vector<double> masses;
std::vector<ConstraintInfo> constraints;
std::vector<Force*> forces;
std::vector<VirtualSite*> virtualSites;
};
class System::ConstraintInfo {
public:
int particle1, particle2;
double distance;
ConstraintInfo() {
particle1 = particle2 = -1;
distance = 0.0;
}
ConstraintInfo(int particle1, int particle2, double distance) :
particle1(particle1), particle2(particle2), distance(distance) {
}
};
} // namespace OpenMM
#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