ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/primitives/Molecule.hpp
Revision: 1695
Committed: Mon Nov 1 22:52:57 2004 UTC (19 years, 9 months ago) by tim
File size: 7961 byte(s)
Log Message:
Molecule, Atom, DirectionalAtom, RigidBody and StuntDouble classes get compiled

File Contents

# User Rev Content
1 tim 1692 /*
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 gezelter 1490
26 tim 1692 /**
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 gezelter 1490 #include <vector>
36 tim 1692 #include <iostream>
37 gezelter 1490
38 tim 1692 #include "math/Vector3.hpp"
39 tim 1492 #include "primitives/Atom.hpp"
40     #include "primitives/RigidBody.hpp"
41 tim 1695 #include "primitives/Bond.hpp"
42     #include "primitives/Bend.hpp"
43     #include "primitives/Torsion.hpp"
44     #include "primitives/CutoffGroup.hpp"
45 gezelter 1490
46 tim 1692 namespace oopse{
47 gezelter 1490
48 tim 1692 /**
49     * @class Molecule Molecule.hpp "primitives/Molecule.hpp"
50     * @brief
51     */
52     class Molecule {
53     public:
54 gezelter 1490
55 tim 1692 Molecule();
56     virtual ~Molecule();
57 gezelter 1490
58 tim 1692 /**
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 gezelter 1490
66 tim 1692 /**
67     * Sets the global index of this molecule.
68     * @param new global index to be set
69     */
70 tim 1695 int setGlobalIndex(int index) {
71 tim 1692 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 gezelter 1490
82 tim 1692 /** add an atom into this molecule */
83     void addAtom(Atom* atom);
84 gezelter 1490
85 tim 1692 /** add a bond into this molecule */
86     void addBond(Bond* bond);
87 gezelter 1490
88 tim 1692 /** add a bend into this molecule */
89     void addBend(Bend* bend);
90 gezelter 1490
91 tim 1692 /** add a torsion into this molecule*/
92     void addTorsion(Torsion* torsion);
93 gezelter 1490
94 tim 1692 /** add a rigidbody into this molecule */
95     void addRigidBody(RigidBody *rb);
96 gezelter 1490
97 tim 1692 /** add a cutoff group into this molecule */
98     void addCutoffGroup(CutoffGroup* cp);
99 gezelter 1490
100 tim 1692 /** */
101     void complete();
102 gezelter 1490
103 tim 1692 /** Returns the total number of atoms in this molecule */
104     unsigned int getNAtoms() {
105     return atoms_.size();
106     }
107 gezelter 1490
108 tim 1692 /** Returns the total number of bonds in this molecule */
109     unsigned int getNBonds(){
110     return bonds_.size();
111     }
112 gezelter 1490
113 tim 1692 /** Returns the total number of bends in this molecule */
114     unsigned int getNBends() {
115     return bends_.size();
116     }
117 gezelter 1490
118 tim 1692 /** Returns the total number of torsions in this molecule */
119     unsigned int getNTorsions() {
120     return torsions_.size();
121     }
122 gezelter 1490
123 tim 1692 /** Returns the total number of rigid bodies in this molecule */
124     unsigned int getNRigidBodies() {
125     return rigidBodies_.size();
126     }
127 gezelter 1490
128 tim 1692 /** 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     /**
139     * Returns the first atom in this molecule and initialize the iterator.
140     * @return the first atom, return NULL if there is not cut off group in this molecule
141     * @param i iteraotr
142     */
143     Atom* beginAtom(std::vector<Atom*>::iterator& i);
144    
145     Atom* nextAtom(std::vector<Atom*>::iterator& i);
146    
147     /**
148     * Returns the first bond in this molecule and initialize the iterator.
149     * @return the first bond, return NULL if there is not cut off group in this molecule
150     * @param i iteraotr
151     */
152     Bond* beginBond(std::vector<Bond*>::iterator& i);
153    
154     Bond* nextBond(std::vector<Bond*>::iterator& i);
155    
156     /**
157     * Returns the first bend in this molecule and initialize the iterator.
158     * @return the first bend, return NULL if there is not cut off group in this molecule
159     * @param i iteraotr
160     */
161     Bend* beginBend(std::vector<Bend*>::iterator& i);
162    
163     Bend* nextBend(std::vector<Bend*>::iterator& i);
164    
165     /**
166     * Returns the first torsion in this molecule and initialize the iterator.
167     * @return the first torsion, return NULL if there is not cut off group in this molecule
168     * @param i iteraotr
169     */
170     Torsion* beginTorsion(std::vector<Torsion*>::iterator& i);
171     Torsion* nextTorsion(std::vector<Torsion*>::iterator& i);
172    
173     /**
174     * Returns the first rigid body in this molecule and initialize the iterator.
175     * @return the first rigid body, return NULL if there is not cut off group in this molecule
176     * @param i iteraotr
177     */
178     RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i);
179    
180     RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i);
181    
182     /**
183     * Returns the first integrable object in this molecule and initialize the iterator.
184     * @return the first integrable object, return NULL if there is not cut off group in this molecule
185     * @param i iteraotr
186     */
187     StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i);
188    
189     StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i);
190    
191     /**
192     * Returns the first cutoff group in this molecule and initialize the iterator.
193     * @return the first cutoff group, return NULL if there is not cut off group in this molecule
194     * @param i iteraotr
195     */
196     CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
197    
198     /**
199     * Returns next cutoff group based on the iterator
200     * @return next cutoff group
201     * @param i
202     */
203     CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
204    
205     //void setStampID( int info ) {stampID = info;}
206    
207     void calcForces( void );
208    
209     void atoms2rigidBodies( void );
210    
211     /** return the total potential energy of short range interaction of this molecule */
212     double getPotential();
213    
214    
215     /** return the center of mass of this molecule */
216     Vector3d getCom();
217    
218     /** Moves the center of this molecule */
219 tim 1695 void moveCom(const Vector3d& delta);
220 tim 1692
221     /** Returns the velocity of center of mass of this molecule */
222     Vector3d getComVel();
223    
224     /** Returns the total mass of this molecule */
225     double getTotalMass();
226    
227 tim 1695 friend std::ostream& operator <<(std::ostream& o, Molecule& mol);
228 tim 1692
229     private:
230     int localIndex_;
231     int globalIndex_;
232    
233     std::vector<Atom*> atoms_;
234     std::vector<Bond*> bonds_;
235     std::vector<Bend*> bends_;
236     std::vector<Torsion*> torsions_;
237     std::vector<RigidBody*> rigidBodies_;
238     std::vector<StuntDouble*> integrableObjects_;
239     std::vector<CutoffGroup*> cutoffGroups_;
240 gezelter 1490 };
241    
242 tim 1692 } //namespace oopse
243     #endif //