ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-2.0/src/primitives/Molecule.hpp
Revision: 1696
Committed: Tue Nov 2 15:23:46 2004 UTC (19 years, 8 months ago) by tim
File size: 8341 byte(s)
Log Message:
adding SimModel(something similar as SimInfo)

File Contents

# Content
1 /*
2 * Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project
3 *
4 * Contact: oopse@oopse.org
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1
9 * of the License, or (at your option) any later version.
10 * All we ask is that proper credit is given for our work, which includes
11 * - but is not limited to - adding the above copyright notice to the beginning
12 * of your source code files, and to any copyright notice that you may distribute
13 * with programs based on this work.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 */
25
26 /**
27 * @file Molecule.hpp
28 * @author tlin
29 * @date 10/25/2004
30 * @version 1.0
31 */
32
33 #ifndef PRIMITIVES_MOLECULE_HPP
34 #define PRIMITIVES_MOLECULE_HPP
35 #include <vector>
36 #include <iostream>
37
38 #include "math/Vector3.hpp"
39 #include "primitives/Atom.hpp"
40 #include "primitives/RigidBody.hpp"
41 #include "primitives/Bond.hpp"
42 #include "primitives/Bend.hpp"
43 #include "primitives/Torsion.hpp"
44 #include "primitives/CutoffGroup.hpp"
45
46 namespace oopse{
47
48 /**
49 * @class Molecule Molecule.hpp "primitives/Molecule.hpp"
50 * @brief
51 */
52 class Molecule {
53 public:
54
55 Molecule();
56 virtual ~Molecule();
57
58 /**
59 * Returns the global index of this molecule.
60 * @return the global index of this molecule
61 */
62 int getGlobalIndex() {
63 return globalIndex_;
64 }
65
66 /**
67 * Sets the global index of this molecule.
68 * @param new global index to be set
69 */
70 int setGlobalIndex(int index) {
71 return globalIndex_;
72 }
73
74 /**
75 * Returns the local index of this molecule
76 * @return the local index of this molecule
77 */
78 int getLocalIndex() {
79 return localIndex_;
80 }
81
82 /** add an atom into this molecule */
83 void addAtom(Atom* atom);
84
85 /** add a bond into this molecule */
86 void addBond(Bond* bond);
87
88 /** add a bend into this molecule */
89 void addBend(Bend* bend);
90
91 /** add a torsion into this molecule*/
92 void addTorsion(Torsion* torsion);
93
94 /** add a rigidbody into this molecule */
95 void addRigidBody(RigidBody *rb);
96
97 /** add a cutoff group into this molecule */
98 void addCutoffGroup(CutoffGroup* cp);
99
100 /** */
101 void complete();
102
103 /** Returns the total number of atoms in this molecule */
104 unsigned int getNAtoms() {
105 return atoms_.size();
106 }
107
108 /** Returns the total number of bonds in this molecule */
109 unsigned int getNBonds(){
110 return bonds_.size();
111 }
112
113 /** Returns the total number of bends in this molecule */
114 unsigned int getNBends() {
115 return bends_.size();
116 }
117
118 /** Returns the total number of torsions in this molecule */
119 unsigned int getNTorsions() {
120 return torsions_.size();
121 }
122
123 /** Returns the total number of rigid bodies in this molecule */
124 unsigned int getNRigidBodies() {
125 return rigidBodies_.size();
126 }
127
128 /** Returns the total number of integrable objects in this molecule */
129 unsigned int getNIntegrableObjects() {
130 return integrableObjects_.size();
131 }
132
133 /** Returns the total number of cutoff groups in this molecule */
134 unsigned int getNCutoffGroups() {
135 return cutoffGroups_.size();
136 }
137
138 /** Returns the total number of constraints in this molecule */
139 unsigned int getNConstraints() {
140 return constraints_.size();
141 }
142
143 /**
144 * Returns the first atom in this molecule and initialize the iterator.
145 * @return the first atom, return NULL if there is not cut off group in this molecule
146 * @param i iteraotr
147 */
148 Atom* beginAtom(std::vector<Atom*>::iterator& i);
149
150 Atom* nextAtom(std::vector<Atom*>::iterator& i);
151
152 /**
153 * Returns the first bond in this molecule and initialize the iterator.
154 * @return the first bond, return NULL if there is not cut off group in this molecule
155 * @param i iteraotr
156 */
157 Bond* beginBond(std::vector<Bond*>::iterator& i);
158
159 Bond* nextBond(std::vector<Bond*>::iterator& i);
160
161 /**
162 * Returns the first bend in this molecule and initialize the iterator.
163 * @return the first bend, return NULL if there is not cut off group in this molecule
164 * @param i iteraotr
165 */
166 Bend* beginBend(std::vector<Bend*>::iterator& i);
167
168 Bend* nextBend(std::vector<Bend*>::iterator& i);
169
170 /**
171 * Returns the first torsion in this molecule and initialize the iterator.
172 * @return the first torsion, return NULL if there is not cut off group in this molecule
173 * @param i iteraotr
174 */
175 Torsion* beginTorsion(std::vector<Torsion*>::iterator& i);
176 Torsion* nextTorsion(std::vector<Torsion*>::iterator& i);
177
178 /**
179 * Returns the first rigid body in this molecule and initialize the iterator.
180 * @return the first rigid body, return NULL if there is not cut off group in this molecule
181 * @param i iteraotr
182 */
183 RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i);
184
185 RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i);
186
187 /**
188 * Returns the first integrable object in this molecule and initialize the iterator.
189 * @return the first integrable object, return NULL if there is not cut off group in this molecule
190 * @param i iteraotr
191 */
192 StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i);
193
194 StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i);
195
196 /**
197 * Returns the first cutoff group in this molecule and initialize the iterator.
198 * @return the first cutoff group, return NULL if there is not cut off group in this molecule
199 * @param i iteraotr
200 */
201 CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
202
203 /**
204 * Returns next cutoff group based on the iterator
205 * @return next cutoff group
206 * @param i
207 */
208 CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
209
210 Constraint* beginConstraint(std::vector<Constraint*>::iterator& i);
211
212 Constraint* nextConstraint(std::vector<Constraint*>::iterator& i);
213
214 //void setStampID( int info ) {stampID = info;}
215
216 void calcForces( void );
217
218 void atoms2rigidBodies( void );
219
220 /** return the total potential energy of short range interaction of this molecule */
221 double getPotential();
222
223
224 /** return the center of mass of this molecule */
225 Vector3d getCom();
226
227 /** Moves the center of this molecule */
228 void moveCom(const Vector3d& delta);
229
230 /** Returns the velocity of center of mass of this molecule */
231 Vector3d getComVel();
232
233 /** Returns the total mass of this molecule */
234 double getTotalMass();
235
236 friend std::ostream& operator <<(std::ostream& o, Molecule& mol);
237
238 private:
239 int localIndex_;
240 int globalIndex_;
241
242 std::vector<Atom*> atoms_;
243 std::vector<Bond*> bonds_;
244 std::vector<Bend*> bends_;
245 std::vector<Torsion*> torsions_;
246 std::vector<RigidBody*> rigidBodies_;
247 std::vector<StuntDouble*> integrableObjects_;
248 std::vector<CutoffGroup*> cutoffGroups_;
249 std::vector<Constraint*> constraints_;
250 };
251
252 } //namespace oopse
253 #endif //