- Main Page
- Related Pages
- Classes
- Files

- File List

# System.h

    00001 #ifndef OPENMM_SYSTEM_H_
    00002 #define OPENMM_SYSTEM_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-2009 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 "Vec3.h"
    00036 #include <vector>
    00037 #include "internal/windowsExport.h"
    00038
    00039 namespace OpenMM {
    00040
    00041 class OPENMM_EXPORT Force;
    00042 class OPENMM_EXPORT VirtualSite;
    00043
    00066 class OPENMM_EXPORT System {
    00067 public:
    00071     System();
    00072     ~System();
    00076     int getNumParticles() const {
    00077         return masses.size();
    00078     }
    00088     int addParticle(double mass) {
    00089         masses.push_back(mass);
    00090         return masses.size()-1;
    00091     }
    00100     double getParticleMass(int index) const;
    00110     void setParticleMass(int index, double mass);
    00120     void setVirtualSite(int index, VirtualSite* virtualSite);
    00126     bool isVirtualSite(int index) const {
    00127         return (index < (int) virtualSites.size() && virtualSites[index] != NULL);
    00128     }
    00135     const VirtualSite& getVirtualSite(int index) const;
    00139     int getNumConstraints() const {
    00140         return constraints.size();
    00141     }
    00151     int addConstraint(int particle1, int particle2, double distance);
    00160     void getConstraintParameters(int index, int& particle1, int& particle2, double& distance) const;
    00170     void setConstraintParameters(int index, int particle1, int particle2, double distance);
    00179     int addForce(Force* force) {
    00180         forces.push_back(force);
    00181         return forces.size()-1;
    00182     }
    00186     int getNumForces() const {
    00187         return forces.size();
    00188     }
    00194     const Force& getForce(int index) const;
    00200     Force& getForce(int index);
    00213     void getDefaultPeriodicBoxVectors(Vec3& a, Vec3& b, Vec3& c) const;
    00226     void setDefaultPeriodicBoxVectors(const Vec3& a, const Vec3& b, const Vec3& c);
    00227 private:
    00228     class ConstraintInfo;
    00229     Vec3 periodicBoxVectors[3];
    00230     std::vector<double> masses;
    00231     std::vector<ConstraintInfo> constraints;
    00232     std::vector<Force*> forces;
    00233     std::vector<VirtualSite*> virtualSites;
    00234 };
    00235
    00240 class System::ConstraintInfo {
    00241 public:
    00242     int particle1, particle2;
    00243     double distance;
    00244     ConstraintInfo() {
    00245         particle1 = particle2 = -1;
    00246         distance = 0.0;
    00247     }
    00248     ConstraintInfo(int particle1, int particle2, double distance) :
    00249         particle1(particle1), particle2(particle2), distance(distance) {
    00250     }
    00251 };
    00252
    00253 } // namespace OpenMM
    00254
    00255 #endif /*OPENMM_SYSTEM_H_*/