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