ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/primitives/Molecule.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/primitives/Molecule.hpp (file contents):
Revision 1691, Thu Oct 28 22:34:02 2004 UTC vs.
Revision 1692 by tim, Mon Nov 1 20:15:58 2004 UTC

# Line 1 | Line 1
1 < #ifndef _MOLECULE_H_
2 < #define _MOLECULE_H_
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 < #include <set>
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"
8 #include "primitives/SRI.hpp"
9 #include "types/MoleculeStamp.hpp"
40   #include "primitives/RigidBody.hpp"
11 #include "primitives/CutoffGroup.hpp"
41  
42 < using namespace std;
42 > namespace oopse{
43  
44 < typedef struct{
45 <  
46 <  int stampID;   // the ID in the BASS component stamp array
47 <  int nAtoms;    // the number of atoms in the molecule
48 <  int nBonds;    // ... .. ..  . .bonds .. .. . . . .
49 <  int nBends;    // . . . . .. . .bends . . . . .. .
21 <  int nTorsions; // .. . . .. . . torsions . . .. . .
22 <  int nRigidBodies; // .. .. .. . rigid bodies ... ..
23 <  int nOriented; // .. . . . .. . oriented atoms . . .
24 <  
25 <  Atom** myAtoms;      // the array of atoms
26 <  Bond** myBonds;      // arrays of all the short range interactions
27 <  Bend** myBends;
28 <  Torsion** myTorsions;
29 <  vector<RigidBody*>   myRigidBodies;
30 <  vector<StuntDouble*> myIntegrableObjects;
31 <  vector<CutoffGroup*> myCutoffGroups;
32 < } molInit;
44 > /**
45 > * @class Molecule Molecule.hpp "primitives/Molecule.hpp"
46 > * @brief
47 > */
48 > class Molecule {
49 >    public:
50  
51 < class Molecule{
51 >        Molecule();
52 >        virtual ~Molecule();
53  
54 < public:
55 <  
56 <  Molecule( void );
57 <  ~Molecule( void );
54 >        /**
55 >         * Returns the global index of this molecule.
56 >         * @return  the global index of this molecule
57 >         */
58 >        int getGlobalIndex() {
59 >            return globalIndex_;
60 >        }
61  
62 <  void initialize( molInit &theInit );
62 >        /**
63 >         * Sets the global index of this molecule.
64 >         * @param new global index to be set
65 >         */
66 >        void setGlobalIndex(int index) {
67 >            return globalIndex_;
68 >        }
69 >        
70 >        /**
71 >         * Returns the local index of this molecule
72 >         * @return the local index of this molecule
73 >         */
74 >        int getLocalIndex() {
75 >            return localIndex_;
76 >        }
77  
78 <  void setMyIndex( int theIndex ){ myIndex = theIndex;}
79 <  int getMyIndex( void ) { return myIndex; }
78 >        /** add an atom into this molecule */
79 >        void addAtom(Atom* atom);
80  
81 <  int getGlobalIndex( void ) { return globalIndex; }
82 <  void setGlobalIndex( int theIndex ) { globalIndex = theIndex; }
81 >        /** add a bond into this molecule */
82 >        void addBond(Bond* bond);
83  
84 <  int getNAtoms   ( void )    {return nAtoms;}
85 <  int getNBonds   ( void )    {return nBonds;}
51 <  int getNBends   ( void )    {return nBends;}
52 <  int getNTorsions( void )    {return nTorsions;}
53 <  int getNRigidBodies( void ) {return myRigidBodies.size();}
54 <  int getNOriented( void )    {return nOriented;}
55 <  int getNMembers ( void )    {return nMembers;}
56 <  int getStampID  ( void )    {return stampID;}
84 >        /** add a bend into this molecule */
85 >        void addBend(Bend* bend);
86  
87 <  Atom**      getMyAtoms   ( void )    {return myAtoms;}
88 <  Bond**      getMyBonds   ( void )    {return myBonds;}
60 <  Bend**      getMyBends   ( void )    {return myBends;}
61 <  Torsion**   getMyTorsions( void )    {return myTorsions;}
62 <  vector<RigidBody*> getMyRigidBodies( void ) {return myRigidBodies;}
63 <  vector<StuntDouble*>& getIntegrableObjects(void) {return myIntegrableObjects;}
87 >        /** add a torsion into this molecule*/
88 >        void addTorsion(Torsion* torsion);
89  
90 <  //beginCutoffGroup return the first group and initialize the iterator
91 <  CutoffGroup* beginCutoffGroup(vector<CutoffGroup*>::iterator& i){
67 <    i = myCutoffGroups.begin();
68 <    return i != myCutoffGroups.end()? *i : NULL;
69 <  }
90 >        /** add a rigidbody into this molecule */
91 >        void addRigidBody(RigidBody *rb);
92  
93 <  //nextCutoffGroup return next cutoff group based on the iterator
94 <  CutoffGroup* nextCutoffGroup(vector<CutoffGroup*>::iterator& i){
73 <    i++;
74 <    return i != myCutoffGroups.end()? *i : NULL;
75 <  }
93 >        /** add a cutoff group into this molecule */
94 >        void addCutoffGroup(CutoffGroup* cp);        
95  
96 <  int getNCutoffGroups() {return nCutoffGroups;}
96 >        /** */
97 >        void complete();
98  
99 <  void setStampID( int info ) {stampID = info;}
99 >        /** Returns the total number of atoms in this molecule */
100 >        unsigned int getNAtoms() {
101 >            return atoms_.size();
102 >        }
103  
104 <  void calcForces( void );
105 <  void atoms2rigidBodies( void );
106 <  double getPotential( void );
107 <  
85 <  void printMe( void );
104 >        /** Returns the total number of bonds in this molecule */        
105 >        unsigned int getNBonds(){
106 >            return bonds_.size();
107 >        }
108  
109 <  void getCOM( double COM[3] );
110 <  void moveCOM( double delta[3] );
111 <  double getCOMvel( double COMvel[3] );
112 <  
91 <  double getTotalMass();
109 >        /** Returns the total number of bends in this molecule */        
110 >        unsigned int getNBends() {
111 >            return bends_.size();
112 >        }
113  
114 < private:
114 >        /** Returns the total number of torsions in this molecule */        
115 >        unsigned int getNTorsions() {
116 >            return torsions_.size();
117 >        }
118  
119 <  int stampID;   // the ID in the BASS component stamp array
120 <  int nAtoms;    // the number of atoms in the molecule
121 <  int nBonds;    // ... .. ..  . .bonds .. .. . . . .
122 <  int nBends;    // . . . . .. . .bends . . . . .. .
99 <  int nTorsions; // .. . . .. . . torsions . . .. . .
100 <  int nRigidBodies; // .. . . .. .rigid bodies . . .. . .
101 <  int nOriented; // .. . . . .. . oriented atoms . . .
102 <  int nMembers;  // .. . . . . . .atoms (legacy code) . . .
103 <  int nCutoffGroups;
104 <  
105 <  int myIndex; // mostly just for debug (and for making pressure calcs work)
106 <  int globalIndex;
119 >        /** Returns the total number of rigid bodies in this molecule */        
120 >        unsigned int getNRigidBodies() {
121 >            return rigidBodies_.size();
122 >        }
123  
124 <  Atom** myAtoms;     // the array of atoms
125 <  Bond** myBonds;     // arrays of all the short range interactions
126 <  Bend** myBends;
127 <  Torsion** myTorsions;
128 <  vector<RigidBody*>   myRigidBodies;
129 <  vector<StuntDouble*> myIntegrableObjects;
130 <  vector<CutoffGroup*> myCutoffGroups;
124 >        /** Returns the total number of integrable objects in this molecule */
125 >        unsigned int getNIntegrableObjects() {
126 >            return integrableObjects_.size();
127 >        }
128 >
129 >        /** Returns the total number of cutoff groups in this molecule */
130 >        unsigned int getNCutoffGroups() {
131 >            return cutoffGroups_.size();
132 >        }
133 >
134 >        /**
135 >         * Returns the first atom in this molecule and initialize the iterator.
136 >         * @return the first atom, return NULL if there is not cut off group in this molecule
137 >         * @param i iteraotr
138 >         */        
139 >        Atom* beginAtom(std::vector<Atom*>::iterator& i);
140 >
141 >        Atom* nextAtom(std::vector<Atom*>::iterator& i);
142 >
143 >        /**
144 >         * Returns the first bond in this molecule and initialize the iterator.
145 >         * @return the first bond, return NULL if there is not cut off group in this molecule
146 >         * @param i iteraotr
147 >         */
148 >        Bond* beginBond(std::vector<Bond*>::iterator& i);
149 >
150 >        Bond* nextBond(std::vector<Bond*>::iterator& i);
151 >
152 >        /**
153 >         * Returns the first bend in this molecule and initialize the iterator.
154 >         * @return the first bend, return NULL if there is not cut off group in this molecule
155 >         * @param i iteraotr
156 >         */
157 >        Bend* beginBend(std::vector<Bend*>::iterator& i);
158 >
159 >        Bend* nextBend(std::vector<Bend*>::iterator& i);
160 >
161 >        /**
162 >         * Returns the first torsion in this molecule and initialize the iterator.
163 >         * @return the first torsion, return NULL if there is not cut off group in this molecule
164 >         * @param i iteraotr
165 >         */
166 >        Torsion* beginTorsion(std::vector<Torsion*>::iterator& i);
167 >        Torsion* nextTorsion(std::vector<Torsion*>::iterator& i);
168 >
169 >        /**
170 >         * Returns the first rigid body in this molecule and initialize the iterator.
171 >         * @return the first rigid body, return NULL if there is not cut off group in this molecule
172 >         * @param i iteraotr
173 >         */
174 >        RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i);
175 >
176 >        RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i);
177 >
178 >        /**
179 >         * Returns the first integrable object in this molecule and initialize the iterator.
180 >         * @return the first integrable object, return NULL if there is not cut off group in this molecule
181 >         * @param i iteraotr
182 >         */
183 >        StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i);
184 >        
185 >        StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i);
186 >
187 >        /**
188 >         * Returns the first cutoff group in this molecule and initialize the iterator.
189 >         * @return the first cutoff group, return NULL if there is not cut off group in this molecule
190 >         * @param i iteraotr
191 >         */
192 >        CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
193 >
194 >        /**
195 >         * Returns next cutoff group based on the iterator
196 >         * @return next cutoff group
197 >         * @param i
198 >         */        
199 >        CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
200 >
201 >        //void setStampID( int info ) {stampID = info;}
202 >
203 >        void calcForces( void );
204 >
205 >        void atoms2rigidBodies( void );
206 >
207 >        /** return the total potential energy of short range interaction of this molecule */
208 >        double getPotential();
209 >
210 >
211 >        /** return the center of mass of this molecule */
212 >        Vector3d getCom();
213 >
214 >        /** Moves the center of this molecule */
215 >        void moveCom(const Vetor3d& delta);
216 >
217 >        /** Returns the velocity of center of mass of this molecule */
218 >        Vector3d getComVel();
219 >
220 >        /** Returns the total mass of this molecule */
221 >        double getTotalMass();
222 >
223 >        friend std::ostream& operator <<(std::ostream& o, const Molecule& mol);
224 >        
225 >    private:
226 >        int localIndex_;
227 >        int globalIndex_;
228 >
229 >        std::vector<Atom*> atoms_;
230 >        std::vector<Bond*> bonds_;
231 >        std::vector<Bend*> bends_;
232 >        std::vector<Torsion*> torsions_;
233 >        std::vector<RigidBody*> rigidBodies_;
234 >        std::vector<StuntDouble*> integrableObjects_;
235 >        std::vector<CutoffGroup*> cutoffGroups_;
236   };
237  
238 < #endif
238 > } //namespace oopse
239 > #endif //

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines