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/SRI.hpp" |
45 |
+ |
#include "primitives/CutoffGroup.hpp" |
46 |
|
|
47 |
|
namespace oopse{ |
48 |
|
|
49 |
+ |
class Constraint; |
50 |
+ |
|
51 |
|
/** |
52 |
|
* @class Molecule Molecule.hpp "primitives/Molecule.hpp" |
53 |
|
* @brief |
55 |
|
class Molecule { |
56 |
|
public: |
57 |
|
|
58 |
< |
Molecule(); |
58 |
> |
typedef std::vector<Atom*>::iterator AtomIterator; |
59 |
> |
typedef std::vector<Bond*>::iterator BondIterator; |
60 |
> |
typedef std::vector<Bend*>::iterator BendIterator; |
61 |
> |
typedef std::vector<Torsion*>::iterator TorsionIterator; |
62 |
> |
typedef std::vector<RigidBody*>::iterator RigidBodyIterator; |
63 |
> |
typedef std::vector<CutoffGroup*>::iterator CutoffGroupIterator; |
64 |
> |
typedef std::vector<StuntDouble*>::iterator IntegrableObjectIterator; |
65 |
> |
|
66 |
> |
Molecule(int stampId, int globalIndex, const std::string& molName); |
67 |
|
virtual ~Molecule(); |
68 |
|
|
69 |
|
/** |
75 |
|
} |
76 |
|
|
77 |
|
/** |
78 |
< |
* Sets the global index of this molecule. |
79 |
< |
* @param new global index to be set |
78 |
> |
* Returns the stamp id of this molecule |
79 |
> |
* @note Ideally, every molecule should keep a pointer of its molecule stamp instead of its |
80 |
> |
* stamp id. However, the pointer will become invalid, if the molecule migrate to other processor. |
81 |
|
*/ |
82 |
< |
void setGlobalIndex(int index) { |
83 |
< |
return globalIndex_; |
82 |
> |
int getStampId() { |
83 |
> |
return stampId_; |
84 |
|
} |
85 |
+ |
|
86 |
+ |
/** Returns the name of the molecule */ |
87 |
+ |
std::string getType() { |
88 |
+ |
return moleculeName_; |
89 |
+ |
} |
90 |
|
|
91 |
< |
/** |
92 |
< |
* Returns the local index of this molecule |
93 |
< |
* @return the local index of this molecule |
91 |
> |
/** |
92 |
> |
* Sets the global index of this molecule. |
93 |
> |
* @param new global index to be set |
94 |
|
*/ |
95 |
< |
int getLocalIndex() { |
96 |
< |
return localIndex_; |
95 |
> |
int setGlobalIndex(int index) { |
96 |
> |
return globalIndex_; |
97 |
|
} |
98 |
|
|
99 |
+ |
|
100 |
|
/** add an atom into this molecule */ |
101 |
|
void addAtom(Atom* atom); |
102 |
|
|
153 |
|
return cutoffGroups_.size(); |
154 |
|
} |
155 |
|
|
156 |
+ |
/** Returns the total number of constraints in this molecule */ |
157 |
+ |
unsigned int getNConstraints() { |
158 |
+ |
return constraints_.size(); |
159 |
+ |
} |
160 |
+ |
|
161 |
+ |
Atom* getAtomAt(unsigned int i) { |
162 |
+ |
assert(i < atoms_.size()); |
163 |
+ |
return atoms_[i]; |
164 |
+ |
} |
165 |
|
/** |
166 |
|
* Returns the first atom in this molecule and initialize the iterator. |
167 |
|
* @return the first atom, return NULL if there is not cut off group in this molecule |
229 |
|
*/ |
230 |
|
CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i); |
231 |
|
|
232 |
< |
//void setStampID( int info ) {stampID = info;} |
232 |
> |
Constraint* beginConstraint(std::vector<Constraint*>::iterator& i); |
233 |
|
|
234 |
< |
void calcForces( void ); |
234 |
> |
Constraint* nextConstraint(std::vector<Constraint*>::iterator& i); |
235 |
> |
|
236 |
|
|
205 |
– |
void atoms2rigidBodies( void ); |
206 |
– |
|
237 |
|
/** return the total potential energy of short range interaction of this molecule */ |
238 |
|
double getPotential(); |
239 |
|
|
242 |
|
Vector3d getCom(); |
243 |
|
|
244 |
|
/** Moves the center of this molecule */ |
245 |
< |
void moveCom(const Vetor3d& delta); |
245 |
> |
void moveCom(const Vector3d& delta); |
246 |
|
|
247 |
|
/** Returns the velocity of center of mass of this molecule */ |
248 |
|
Vector3d getComVel(); |
250 |
|
/** Returns the total mass of this molecule */ |
251 |
|
double getTotalMass(); |
252 |
|
|
253 |
< |
friend std::ostream& operator <<(std::ostream& o, const Molecule& mol); |
253 |
> |
friend std::ostream& operator <<(std::ostream& o, Molecule& mol); |
254 |
|
|
255 |
|
private: |
256 |
< |
int localIndex_; |
256 |
> |
|
257 |
|
int globalIndex_; |
258 |
|
|
259 |
|
std::vector<Atom*> atoms_; |
263 |
|
std::vector<RigidBody*> rigidBodies_; |
264 |
|
std::vector<StuntDouble*> integrableObjects_; |
265 |
|
std::vector<CutoffGroup*> cutoffGroups_; |
266 |
+ |
std::vector<Constraint*> constraints_; |
267 |
+ |
|
268 |
+ |
int stampId_; |
269 |
+ |
std::string moleculeName_; |
270 |
|
}; |
271 |
|
|
272 |
|
} //namespace oopse |