ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/test/brains/Molecule.hpp
Revision: 1686
Committed: Fri Oct 29 20:54:04 2004 UTC (19 years, 8 months ago) by tim
File size: 7161 byte(s)
Log Message:
rewrite Molecule class.

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
37 #include "math/Vector3.hpp"
38
39 namespace oopse{
40
41 /**
42 * @class Molecule Molecule.hpp "primitives/Molecule.hpp"
43 * @brief
44 */
45 class Molecule {
46 public:
47
48 Molecule();
49 virtual ~Molecule();
50
51 /**
52 * Returns the global index of this molecule.
53 * @return the global index of this molecule
54 */
55 int getGlobalIndex() {
56 return globalIndex_;
57 }
58
59 /**
60 * Sets the global index of this molecule.
61 * @param new global index to be set
62 */
63 void setGlobalIndex(int index) {
64 return globalIndex_;
65 }
66
67 /**
68 * Returns the local index of this molecule
69 * @return the local index of this molecule
70 */
71 int getLocalIndex() {
72 return localIndex_;
73 }
74
75 /** Returns the total number of atoms in this molecule */
76 unsigned int getNAtoms() {
77 return atoms_.size();
78 }
79
80 /** Returns the total number of bonds in this molecule */
81 unsigned int getNBonds(){
82 return bonds_.size();
83 }
84
85 /** Returns the total number of bends in this molecule */
86 unsigned int getNBends() {
87 return bends_.size();
88 }
89
90 /** Returns the total number of torsions in this molecule */
91 unsigned int getNTorsions() {
92 return torsions_.size();
93 }
94
95 /** Returns the total number of rigid bodies in this molecule */
96 unsigned int getNRigidBodies() {
97 return rigidBodies_.size();
98 }
99
100 /** Returns the total number of integrable objects in this molecule */
101 unsigned int getNIntegrableObjects() {
102 return integrableObjects_.size();
103 }
104
105 /** Returns the total number of cutoff groups in this molecule */
106 unsigned int getNCutoffGroups() {
107 return cutoffGroups_.size();
108 }
109
110 /**
111 * Returns the first atom in this molecule and initialize the iterator.
112 * @return the first atom, return NULL if there is not cut off group in this molecule
113 * @param i iteraotr
114 */
115 Atom* beginAtom(std::vector<Atom*>::iterator& i);
116
117 Atom* nextAtom(std::vector<Atom*>::iterator& i);
118
119 /**
120 * Returns the first bond in this molecule and initialize the iterator.
121 * @return the first bond, return NULL if there is not cut off group in this molecule
122 * @param i iteraotr
123 */
124 Bond* beginBond(std::vector<Bond*>::iterator& i);
125
126 Bond* nextBond(std::vector<Bond*>::iterator& i);
127
128 /**
129 * Returns the first bend in this molecule and initialize the iterator.
130 * @return the first bend, return NULL if there is not cut off group in this molecule
131 * @param i iteraotr
132 */
133 Bend* beginBend(std::vector<Bend*>::iterator& i);
134
135 Bend* nextBend(std::vector<Bend*>::iterator& i);
136
137 /**
138 * Returns the first torsion in this molecule and initialize the iterator.
139 * @return the first torsion, return NULL if there is not cut off group in this molecule
140 * @param i iteraotr
141 */
142 Torsion* beginTorsion(std::vector<Torsion*>::iterator& i);
143 Torsion* nextTorsion(std::vector<Torsion*>::iterator& i);
144
145 /**
146 * Returns the first rigid body in this molecule and initialize the iterator.
147 * @return the first rigid body, return NULL if there is not cut off group in this molecule
148 * @param i iteraotr
149 */
150 RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i);
151
152 RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i);
153
154 /**
155 * Returns the first integrable object in this molecule and initialize the iterator.
156 * @return the first integrable object, return NULL if there is not cut off group in this molecule
157 * @param i iteraotr
158 */
159 StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i);
160
161 StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i);
162
163 /**
164 * Returns the first cutoff group in this molecule and initialize the iterator.
165 * @return the first cutoff group, return NULL if there is not cut off group in this molecule
166 * @param i iteraotr
167 */
168 CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
169
170 /**
171 * Returns next cutoff group based on the iterator
172 * @return next cutoff group
173 * @param i
174 */
175 CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
176
177 //void setStampID( int info ) {stampID = info;}
178
179 void calcForces( void );
180
181 void atoms2rigidBodies( void );
182
183 /** return the total potential energy of short range interaction of this molecule */
184 double getPotential();
185
186
187 /** return the center of mass of this molecule */
188 Vector3d getCom();
189
190 /** Moves the center of this molecule */
191 void moveCom(const Vetor3d& delta);
192
193 /** Returns the velocity of center of mass of this molecule */
194 Vector3d getComVel();
195
196 /** Returns the total mass of this molecule */
197 double getTotalMass();
198
199 friend ostream& operator <<(ostream& o, const Molecule& mol);
200
201 private:
202 int localIndex_;
203 int globalIndex_;
204
205 std::vector<Atom*> atoms_;
206 std::vector<Bond*> bonds_;
207 std::vector<Bend*> bends_;
208 std::vector<Torsion*> torsions_;
209 std::vector<RigidBody*> rigidBodies_;
210 std::vector<StuntDouble*> integrableObjects_;
211 std::vector<CutoffGroup*> cutoffGroups_;
212 };
213
214 } //namespace oopse
215 #endif //

Properties

Name Value
svn:executable *