--- branches/new_design/OOPSE-2.0/src/primitives/Molecule.hpp 2004/11/05 02:56:22 1713 +++ branches/new_design/OOPSE-2.0/src/primitives/Molecule.hpp 2004/11/24 20:55:03 1782 @@ -38,10 +38,9 @@ #include "math/Vector3.hpp" #include "primitives/Atom.hpp" #include "primitives/RigidBody.hpp" -//#include "primitives/Bond.hpp" -//#include "primitives/Bend.hpp" -//#include "primitives/Torsion.hpp" -#include "primitives/SRI.hpp" +#include "primitives/Bond.hpp" +#include "primitives/Bend.hpp" +#include "primitives/Torsion.hpp" #include "primitives/CutoffGroup.hpp" namespace oopse{ @@ -55,7 +54,15 @@ class Molecule { class Molecule { public: - Molecule(); + typedef std::vector::iterator AtomIterator; + typedef std::vector::iterator BondIterator; + typedef std::vector::iterator BendIterator; + typedef std::vector::iterator TorsionIterator; + typedef std::vector::iterator RigidBodyIterator; + typedef std::vector::iterator CutoffGroupIterator; + typedef std::vector::iterator IntegrableObjectIterator; + + Molecule(int stampId, int globalIndex, const std::string& molName); virtual ~Molecule(); /** @@ -66,6 +73,20 @@ class Molecule { return globalIndex_; } + /** + * Returns the stamp id of this molecule + * @note Ideally, every molecule should keep a pointer of its molecule stamp instead of its + * stamp id. However, the pointer will become invalid, if the molecule migrate to other processor. + */ + int getStampId() { + return stampId_; + } + + /** Returns the name of the molecule */ + std::string getType() { + return moleculeName_; + } + /** * Sets the global index of this molecule. * @param new global index to be set @@ -73,15 +94,8 @@ class Molecule { int setGlobalIndex(int index) { return globalIndex_; } - - /** - * Returns the local index of this molecule - * @return the local index of this molecule - */ - int getLocalIndex() { - return localIndex_; - } + /** add an atom into this molecule */ void addAtom(Atom* atom); @@ -142,7 +156,11 @@ class Molecule { unsigned int getNConstraints() { return constraints_.size(); } - + + Atom* getAtomAt(unsigned int i) { + assert(i < atoms_.size()); + return atoms_[i]; + } /** * Returns the first atom in this molecule and initialize the iterator. * @return the first atom, return NULL if there is not cut off group in this molecule @@ -214,12 +232,7 @@ class Molecule { Constraint* nextConstraint(std::vector::iterator& i); - //void setStampID( int info ) {stampID = info;} - void calcForces( void ); - - void atoms2rigidBodies( void ); - /** return the total potential energy of short range interaction of this molecule */ double getPotential(); @@ -239,7 +252,7 @@ class Molecule { friend std::ostream& operator <<(std::ostream& o, Molecule& mol); private: - int localIndex_; + int globalIndex_; std::vector atoms_; @@ -251,7 +264,8 @@ class Molecule { std::vector cutoffGroups_; std::vector constraints_; - int stampID; + int stampId_; + std::string moleculeName_; }; } //namespace oopse