--- trunk/src/primitives/Molecule.hpp 2013/07/19 21:25:45 1908 +++ trunk/src/primitives/Molecule.hpp 2015/01/09 19:06:35 2052 @@ -63,10 +63,11 @@ #include "primitives/CutoffGroup.hpp" #include "utils/PropertyMap.hpp" + namespace OpenMD{ class Constraint; - + /** * @class Molecule Molecule.hpp "primitives/Molecule.hpp" * @brief @@ -74,6 +75,11 @@ namespace OpenMD{ class Molecule { public: + struct HBondDonor { + Atom* donorAtom; + Atom* donatedHydrogen; + }; + typedef std::vector::iterator AtomIterator; typedef std::vector::iterator BondIterator; typedef std::vector::iterator BendIterator; @@ -85,7 +91,9 @@ namespace OpenMD{ typedef std::vector::iterator ConstraintPairIterator; typedef std::vector::iterator ConstraintElemIterator; typedef std::vector::iterator FluctuatingChargeIterator; - + typedef std::vector::iterator HBondDonorIterator; + typedef std::vector::iterator HBondAcceptorIterator; + Molecule(int stampId, int globalIndex, const std::string& molName, int region); virtual ~Molecule(); @@ -209,6 +217,15 @@ namespace OpenMD{ unsigned int getNFluctuatingCharges() { return fluctuatingCharges_.size(); } + /** Returns the total number of Hydrogen Bond donors in this molecule */ + unsigned int getNHBondDonors() { + return hBondDonors_.size(); + } + + /** Returns the total number of Hydrogen Bond acceptors in this molecule */ + unsigned int getNHBondAcceptors() { + return hBondAcceptors_.size(); + } Atom* getAtomAt(unsigned int i) { assert(i < atoms_.size()); @@ -329,7 +346,27 @@ namespace OpenMD{ Atom* nextFluctuatingCharge(std::vector::iterator& i) { ++i; return (i == fluctuatingCharges_.end()) ? NULL : *i; + } + + HBondDonor* beginHBondDonor(std::vector::iterator& i) { + i = hBondDonors_.begin(); + return (i == hBondDonors_.end()) ? NULL : *i; + } + + HBondDonor* nextHBondDonor(std::vector::iterator& i) { + ++i; + return (i == hBondDonors_.end()) ? NULL : *i; + } + + Atom* beginHBondAcceptor(std::vector::iterator& i) { + i = hBondAcceptors_.begin(); + return (i == hBondAcceptors_.end()) ? NULL : *i; } + + Atom* nextHBondAcceptor(std::vector::iterator& i) { + ++i; + return (i == hBondAcceptors_.end()) ? NULL : *i; + } /** @@ -341,9 +378,23 @@ namespace OpenMD{ /** get total mass of this molecule */ RealType getMass(); - /** return the center of mass of this molecule */ + /** + * Returns the current center of mass position of this molecule. + * + * @return the center of mass position of this molecule. + */ Vector3d getCom(); + /** + * Returns the center of mass position of this molecule in + * specified snapshot + * + * @return the center of mass position of this molecule + * @param snapshotNo + */ + Vector3d getCom(int snapshotNo); + + /** Moves the center of this molecule */ void moveCom(const Vector3d& delta); @@ -409,6 +460,9 @@ namespace OpenMD{ std::vector constraintPairs_; std::vector constraintElems_; std::vector fluctuatingCharges_; + std::vector hBondDonors_; + std::vector hBondAcceptors_; + int stampId_; int region_; std::string moleculeName_;