| 1 | 
< | 
#ifndef _MOLECULE_H_ | 
| 2 | 
< | 
#define _MOLECULE_H_ | 
| 1 | 
> | 
/* | 
| 2 | 
> | 
 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | 
| 3 | 
> | 
 * | 
| 4 | 
> | 
 * The University of Notre Dame grants you ("Licensee") a | 
| 5 | 
> | 
 * non-exclusive, royalty free, license to use, modify and | 
| 6 | 
> | 
 * redistribute this software in source and binary code form, provided | 
| 7 | 
> | 
 * that the following conditions are met: | 
| 8 | 
> | 
 * | 
| 9 | 
> | 
 * 1. Redistributions of source code must retain the above copyright | 
| 10 | 
> | 
 *    notice, this list of conditions and the following disclaimer. | 
| 11 | 
> | 
 * | 
| 12 | 
> | 
 * 2. Redistributions in binary form must reproduce the above copyright | 
| 13 | 
> | 
 *    notice, this list of conditions and the following disclaimer in the | 
| 14 | 
> | 
 *    documentation and/or other materials provided with the | 
| 15 | 
> | 
 *    distribution. | 
| 16 | 
> | 
 * | 
| 17 | 
> | 
 * This software is provided "AS IS," without a warranty of any | 
| 18 | 
> | 
 * kind. All express or implied conditions, representations and | 
| 19 | 
> | 
 * warranties, including any implied warranty of merchantability, | 
| 20 | 
> | 
 * fitness for a particular purpose or non-infringement, are hereby | 
| 21 | 
> | 
 * excluded.  The University of Notre Dame and its licensors shall not | 
| 22 | 
> | 
 * be liable for any damages suffered by licensee as a result of | 
| 23 | 
> | 
 * using, modifying or distributing the software or its | 
| 24 | 
> | 
 * derivatives. In no event will the University of Notre Dame or its | 
| 25 | 
> | 
 * licensors be liable for any lost revenue, profit or data, or for | 
| 26 | 
> | 
 * direct, indirect, special, consequential, incidental or punitive | 
| 27 | 
> | 
 * damages, however caused and regardless of the theory of liability, | 
| 28 | 
> | 
 * arising out of the use of or inability to use software, even if the | 
| 29 | 
> | 
 * University of Notre Dame has been advised of the possibility of | 
| 30 | 
> | 
 * such damages. | 
| 31 | 
> | 
 * | 
| 32 | 
> | 
 * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your | 
| 33 | 
> | 
 * research, please cite the appropriate papers when you publish your | 
| 34 | 
> | 
 * work.  Good starting points are: | 
| 35 | 
> | 
 *                                                                       | 
| 36 | 
> | 
 * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).              | 
| 37 | 
> | 
 * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).           | 
| 38 | 
> | 
 * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).           | 
| 39 | 
> | 
 * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010). | 
| 40 | 
> | 
 * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). | 
| 41 | 
> | 
 */ | 
| 42 | 
> | 
  | 
| 43 | 
> | 
/** | 
| 44 | 
> | 
 * @file Molecule.hpp | 
| 45 | 
> | 
 * @author    tlin | 
| 46 | 
> | 
 * @date  10/25/2004 | 
| 47 | 
> | 
 * @version 1.0 | 
| 48 | 
> | 
 */  | 
| 49 | 
  | 
 | 
| 50 | 
< | 
#include <set> | 
| 50 | 
> | 
#ifndef PRIMITIVES_MOLECULE_HPP | 
| 51 | 
> | 
#define PRIMITIVES_MOLECULE_HPP | 
| 52 | 
  | 
#include <vector> | 
| 53 | 
+ | 
#include <iostream> | 
| 54 | 
  | 
 | 
| 55 | 
< | 
#include "Atom.hpp" | 
| 56 | 
< | 
#include "SRI.hpp" | 
| 57 | 
< | 
#include "MoleculeStamp.hpp" | 
| 58 | 
< | 
#include "RigidBody.hpp" | 
| 59 | 
< | 
#include "CutoffGroup.hpp" | 
| 55 | 
> | 
#include "constraints/ConstraintPair.hpp" | 
| 56 | 
> | 
#include "math/Vector3.hpp" | 
| 57 | 
> | 
#include "primitives/Atom.hpp" | 
| 58 | 
> | 
#include "primitives/RigidBody.hpp" | 
| 59 | 
> | 
#include "primitives/Bond.hpp" | 
| 60 | 
> | 
#include "primitives/Bend.hpp" | 
| 61 | 
> | 
#include "primitives/Torsion.hpp" | 
| 62 | 
> | 
#include "primitives/Inversion.hpp" | 
| 63 | 
> | 
#include "primitives/CutoffGroup.hpp" | 
| 64 | 
> | 
#include "utils/PropertyMap.hpp" | 
| 65 | 
  | 
 | 
| 66 | 
< | 
using namespace std; | 
| 66 | 
> | 
namespace OpenMD{ | 
| 67 | 
  | 
 | 
| 68 | 
< | 
typedef struct{ | 
| 16 | 
< | 
   | 
| 17 | 
< | 
  int stampID;   // the ID in the BASS component stamp array | 
| 18 | 
< | 
  int nAtoms;    // the number of atoms in the molecule | 
| 19 | 
< | 
  int nBonds;    // ... .. ..  . .bonds .. .. . . . .  | 
| 20 | 
< | 
  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; | 
| 68 | 
> | 
  class Constraint; | 
| 69 | 
  | 
 | 
| 70 | 
< | 
class Molecule{ | 
| 70 | 
> | 
  /** | 
| 71 | 
> | 
   * @class Molecule Molecule.hpp "primitives/Molecule.hpp" | 
| 72 | 
> | 
   * @brief | 
| 73 | 
> | 
   */ | 
| 74 | 
> | 
  class Molecule { | 
| 75 | 
> | 
  public: | 
| 76 | 
  | 
 | 
| 77 | 
< | 
public: | 
| 78 | 
< | 
   | 
| 79 | 
< | 
  Molecule( void ); | 
| 80 | 
< | 
  ~Molecule( void ); | 
| 77 | 
> | 
    typedef std::vector<Atom*>::iterator AtomIterator; | 
| 78 | 
> | 
    typedef std::vector<Bond*>::iterator BondIterator; | 
| 79 | 
> | 
    typedef std::vector<Bend*>::iterator BendIterator; | 
| 80 | 
> | 
    typedef std::vector<Torsion*>::iterator TorsionIterator; | 
| 81 | 
> | 
    typedef std::vector<Inversion*>::iterator InversionIterator; | 
| 82 | 
> | 
    typedef std::vector<RigidBody*>::iterator RigidBodyIterator; | 
| 83 | 
> | 
    typedef std::vector<CutoffGroup*>::iterator CutoffGroupIterator; | 
| 84 | 
> | 
    typedef std::vector<StuntDouble*>::iterator IntegrableObjectIterator; | 
| 85 | 
> | 
    typedef std::vector<ConstraintPair*>::iterator ConstraintPairIterator; | 
| 86 | 
> | 
    typedef std::vector<ConstraintElem*>::iterator ConstraintElemIterator; | 
| 87 | 
> | 
    typedef std::vector<Atom*>::iterator FluctuatingChargeIterator; | 
| 88 | 
> | 
     | 
| 89 | 
> | 
    Molecule(int stampId, int globalIndex, const std::string& molName); | 
| 90 | 
> | 
    virtual ~Molecule(); | 
| 91 | 
  | 
 | 
| 92 | 
< | 
  void initialize( molInit &theInit ); | 
| 92 | 
> | 
    /** | 
| 93 | 
> | 
     * Returns the global index of this molecule. | 
| 94 | 
> | 
     * @return  the global index of this molecule  | 
| 95 | 
> | 
     */ | 
| 96 | 
> | 
    int getGlobalIndex() { | 
| 97 | 
> | 
      return globalIndex_; | 
| 98 | 
> | 
    } | 
| 99 | 
> | 
     | 
| 100 | 
> | 
    /** | 
| 101 | 
> | 
     * Returns the stamp id of this molecule | 
| 102 | 
> | 
     * @note Ideally, every molecule should keep a pointer of its | 
| 103 | 
> | 
     * molecule stamp instead of its stamp id. However, the pointer | 
| 104 | 
> | 
     * will become invalid, if the molecule migrate to other | 
| 105 | 
> | 
     * processor. | 
| 106 | 
> | 
     */ | 
| 107 | 
> | 
    int getStampId() { | 
| 108 | 
> | 
      return stampId_; | 
| 109 | 
> | 
    } | 
| 110 | 
> | 
     | 
| 111 | 
> | 
    /** Returns the name of the molecule */ | 
| 112 | 
> | 
    std::string getType() { | 
| 113 | 
> | 
      return moleculeName_; | 
| 114 | 
> | 
    } | 
| 115 | 
> | 
     | 
| 116 | 
> | 
    /** | 
| 117 | 
> | 
     * Sets the global index of this molecule. | 
| 118 | 
> | 
     * @param new global index to be set | 
| 119 | 
> | 
     */ | 
| 120 | 
> | 
    void setGlobalIndex(int index) { | 
| 121 | 
> | 
      globalIndex_ = index; | 
| 122 | 
> | 
    } | 
| 123 | 
> | 
     | 
| 124 | 
> | 
    void setConstrainedCharge(RealType cc) { | 
| 125 | 
> | 
      constrainedCharge_ = cc; | 
| 126 | 
> | 
    } | 
| 127 | 
  | 
 | 
| 128 | 
< | 
  void setMyIndex( int theIndex ){ myIndex = theIndex;} | 
| 129 | 
< | 
  int getMyIndex( void ) { return myIndex; } | 
| 128 | 
> | 
    RealType getConstrainedCharge() { | 
| 129 | 
> | 
      return constrainedCharge_; | 
| 130 | 
> | 
    } | 
| 131 | 
> | 
     | 
| 132 | 
> | 
    /** add an atom into this molecule */ | 
| 133 | 
> | 
    void addAtom(Atom* atom); | 
| 134 | 
> | 
     | 
| 135 | 
> | 
    /** add a bond into this molecule */ | 
| 136 | 
> | 
    void addBond(Bond* bond); | 
| 137 | 
> | 
     | 
| 138 | 
> | 
    /** add a bend into this molecule */ | 
| 139 | 
> | 
    void addBend(Bend* bend); | 
| 140 | 
> | 
     | 
| 141 | 
> | 
    /** add a torsion into this molecule*/ | 
| 142 | 
> | 
    void addTorsion(Torsion* torsion); | 
| 143 | 
  | 
 | 
| 144 | 
< | 
  int getGlobalIndex( void ) { return globalIndex; } | 
| 145 | 
< | 
  void setGlobalIndex( int theIndex ) { globalIndex = theIndex; } | 
| 144 | 
> | 
    /** add an improper torsion into this molecule*/ | 
| 145 | 
> | 
    void addInversion(Inversion* inversion); | 
| 146 | 
> | 
     | 
| 147 | 
> | 
    /** add a rigidbody into this molecule */ | 
| 148 | 
> | 
    void addRigidBody(RigidBody *rb); | 
| 149 | 
> | 
     | 
| 150 | 
> | 
    /** add a cutoff group into this molecule */ | 
| 151 | 
> | 
    void addCutoffGroup(CutoffGroup* cp);      | 
| 152 | 
> | 
     | 
| 153 | 
> | 
    void addConstraintPair(ConstraintPair* consPair); | 
| 154 | 
> | 
     | 
| 155 | 
> | 
    void addConstraintElem(ConstraintElem* consElem); | 
| 156 | 
> | 
     | 
| 157 | 
> | 
    /** */ | 
| 158 | 
> | 
    void complete(); | 
| 159 | 
> | 
     | 
| 160 | 
> | 
    /** Returns the total number of atoms in this molecule */ | 
| 161 | 
> | 
    unsigned int getNAtoms() { | 
| 162 | 
> | 
      return atoms_.size(); | 
| 163 | 
> | 
    } | 
| 164 | 
> | 
     | 
| 165 | 
> | 
    /** Returns the total number of bonds in this molecule */         | 
| 166 | 
> | 
    unsigned int getNBonds(){ | 
| 167 | 
> | 
      return bonds_.size(); | 
| 168 | 
> | 
    } | 
| 169 | 
> | 
     | 
| 170 | 
> | 
    /** Returns the total number of bends in this molecule */         | 
| 171 | 
> | 
    unsigned int getNBends() { | 
| 172 | 
> | 
      return bends_.size(); | 
| 173 | 
> | 
    } | 
| 174 | 
> | 
     | 
| 175 | 
> | 
    /** Returns the total number of torsions in this molecule */         | 
| 176 | 
> | 
    unsigned int getNTorsions() { | 
| 177 | 
> | 
      return torsions_.size(); | 
| 178 | 
> | 
    } | 
| 179 | 
  | 
 | 
| 180 | 
< | 
  int getNAtoms   ( void )    {return nAtoms;} | 
| 181 | 
< | 
  int getNBonds   ( void )    {return nBonds;} | 
| 182 | 
< | 
  int getNBends   ( void )    {return nBends;} | 
| 183 | 
< | 
  int getNTorsions( void )    {return nTorsions;} | 
| 184 | 
< | 
  int getNRigidBodies( void ) {return myRigidBodies.size();} | 
| 185 | 
< | 
  int getNOriented( void )    {return nOriented;} | 
| 186 | 
< | 
  int getNMembers ( void )    {return nMembers;} | 
| 187 | 
< | 
  int getStampID  ( void )    {return stampID;} | 
| 180 | 
> | 
    /** Returns the total number of improper torsions in this molecule */ | 
| 181 | 
> | 
    unsigned int getNInversions() { | 
| 182 | 
> | 
      return inversions_.size(); | 
| 183 | 
> | 
    } | 
| 184 | 
> | 
     | 
| 185 | 
> | 
    /** Returns the total number of rigid bodies in this molecule */         | 
| 186 | 
> | 
    unsigned int getNRigidBodies() { | 
| 187 | 
> | 
      return rigidBodies_.size(); | 
| 188 | 
> | 
    } | 
| 189 | 
> | 
     | 
| 190 | 
> | 
    /** Returns the total number of integrable objects in this molecule */ | 
| 191 | 
> | 
    unsigned int getNIntegrableObjects() { | 
| 192 | 
> | 
      return integrableObjects_.size(); | 
| 193 | 
> | 
    } | 
| 194 | 
> | 
     | 
| 195 | 
> | 
    /** Returns the total number of cutoff groups in this molecule */ | 
| 196 | 
> | 
    unsigned int getNCutoffGroups() { | 
| 197 | 
> | 
      return cutoffGroups_.size(); | 
| 198 | 
> | 
    } | 
| 199 | 
> | 
     | 
| 200 | 
> | 
    /** Returns the total number of constraints in this molecule */ | 
| 201 | 
> | 
    unsigned int getNConstraintPairs() { | 
| 202 | 
> | 
      return constraintPairs_.size(); | 
| 203 | 
> | 
    } | 
| 204 | 
  | 
 | 
| 205 | 
< | 
  Atom**      getMyAtoms   ( void )    {return myAtoms;} | 
| 206 | 
< | 
  Bond**      getMyBonds   ( void )    {return myBonds;} | 
| 207 | 
< | 
  Bend**      getMyBends   ( void )    {return myBends;} | 
| 208 | 
< | 
  Torsion**   getMyTorsions( void )    {return myTorsions;} | 
| 62 | 
< | 
  vector<RigidBody*> getMyRigidBodies( void ) {return myRigidBodies;} | 
| 63 | 
< | 
  vector<StuntDouble*>& getIntegrableObjects(void) {return myIntegrableObjects;} | 
| 205 | 
> | 
    /** Returns the total number of fluctuating charges in this molecule */ | 
| 206 | 
> | 
    unsigned int getNFluctuatingCharges() { | 
| 207 | 
> | 
      return fluctuatingCharges_.size(); | 
| 208 | 
> | 
    } | 
| 209 | 
  | 
 | 
| 210 | 
< | 
  //beginCutoffGroup return the first group and initialize the iterator | 
| 211 | 
< | 
  CutoffGroup* beginCutoffGroup(vector<CutoffGroup*>::iterator& i){ | 
| 212 | 
< | 
    i = myCutoffGroups.begin(); | 
| 213 | 
< | 
    return i != myCutoffGroups.end()? *i : NULL; | 
| 214 | 
< | 
  } | 
| 210 | 
> | 
    Atom* getAtomAt(unsigned int i) { | 
| 211 | 
> | 
      assert(i < atoms_.size()); | 
| 212 | 
> | 
      return atoms_[i]; | 
| 213 | 
> | 
    } | 
| 214 | 
> | 
     | 
| 215 | 
> | 
    RigidBody* getRigidBodyAt(unsigned int i) { | 
| 216 | 
> | 
      assert(i < rigidBodies_.size()); | 
| 217 | 
> | 
      return rigidBodies_[i]; | 
| 218 | 
> | 
    } | 
| 219 | 
> | 
     | 
| 220 | 
> | 
    Atom* beginAtom(std::vector<Atom*>::iterator& i) { | 
| 221 | 
> | 
      i = atoms_.begin(); | 
| 222 | 
> | 
      return (i == atoms_.end()) ? NULL : *i; | 
| 223 | 
> | 
    } | 
| 224 | 
> | 
     | 
| 225 | 
> | 
    Atom* nextAtom(std::vector<Atom*>::iterator& i) { | 
| 226 | 
> | 
      ++i; | 
| 227 | 
> | 
      return (i == atoms_.end()) ? NULL : *i;     | 
| 228 | 
> | 
    } | 
| 229 | 
> | 
     | 
| 230 | 
> | 
    Bond* beginBond(std::vector<Bond*>::iterator& i) { | 
| 231 | 
> | 
      i = bonds_.begin(); | 
| 232 | 
> | 
      return (i == bonds_.end()) ? NULL : *i; | 
| 233 | 
> | 
    } | 
| 234 | 
> | 
     | 
| 235 | 
> | 
    Bond* nextBond(std::vector<Bond*>::iterator& i) { | 
| 236 | 
> | 
      ++i; | 
| 237 | 
> | 
      return (i == bonds_.end()) ? NULL : *i;     | 
| 238 | 
> | 
       | 
| 239 | 
> | 
    } | 
| 240 | 
> | 
     | 
| 241 | 
> | 
    Bend* beginBend(std::vector<Bend*>::iterator& i) { | 
| 242 | 
> | 
      i = bends_.begin(); | 
| 243 | 
> | 
      return (i == bends_.end()) ? NULL : *i; | 
| 244 | 
> | 
    } | 
| 245 | 
> | 
     | 
| 246 | 
> | 
    Bend* nextBend(std::vector<Bend*>::iterator& i) { | 
| 247 | 
> | 
      ++i; | 
| 248 | 
> | 
      return (i == bends_.end()) ? NULL : *i;     | 
| 249 | 
> | 
    } | 
| 250 | 
> | 
     | 
| 251 | 
> | 
    Torsion* beginTorsion(std::vector<Torsion*>::iterator& i) { | 
| 252 | 
> | 
      i = torsions_.begin(); | 
| 253 | 
> | 
      return (i == torsions_.end()) ? NULL : *i; | 
| 254 | 
> | 
    } | 
| 255 | 
> | 
     | 
| 256 | 
> | 
    Torsion* nextTorsion(std::vector<Torsion*>::iterator& i) { | 
| 257 | 
> | 
      ++i; | 
| 258 | 
> | 
      return (i == torsions_.end()) ? NULL : *i;     | 
| 259 | 
> | 
    }     | 
| 260 | 
  | 
 | 
| 261 | 
< | 
  //nextCutoffGroup return next cutoff group based on the iterator | 
| 262 | 
< | 
  CutoffGroup* nextCutoffGroup(vector<CutoffGroup*>::iterator& i){ | 
| 263 | 
< | 
    i++; | 
| 264 | 
< | 
    return i != myCutoffGroups.end()? *i : NULL; | 
| 265 | 
< | 
  } | 
| 261 | 
> | 
    Inversion* beginInversion(std::vector<Inversion*>::iterator& i) { | 
| 262 | 
> | 
      i = inversions_.begin(); | 
| 263 | 
> | 
      return (i == inversions_.end()) ? NULL : *i; | 
| 264 | 
> | 
    } | 
| 265 | 
> | 
     | 
| 266 | 
> | 
    Inversion* nextInversion(std::vector<Inversion*>::iterator& i) { | 
| 267 | 
> | 
      ++i; | 
| 268 | 
> | 
      return (i == inversions_.end()) ? NULL : *i;     | 
| 269 | 
> | 
    }     | 
| 270 | 
> | 
     | 
| 271 | 
> | 
    RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i) { | 
| 272 | 
> | 
      i = rigidBodies_.begin(); | 
| 273 | 
> | 
      return (i == rigidBodies_.end()) ? NULL : *i; | 
| 274 | 
> | 
    } | 
| 275 | 
> | 
     | 
| 276 | 
> | 
    RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i) { | 
| 277 | 
> | 
      ++i; | 
| 278 | 
> | 
      return (i == rigidBodies_.end()) ? NULL : *i;     | 
| 279 | 
> | 
    } | 
| 280 | 
> | 
     | 
| 281 | 
> | 
    StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i) { | 
| 282 | 
> | 
      i = integrableObjects_.begin(); | 
| 283 | 
> | 
      return (i == integrableObjects_.end()) ? NULL : *i; | 
| 284 | 
> | 
    } | 
| 285 | 
> | 
     | 
| 286 | 
> | 
    StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i) { | 
| 287 | 
> | 
      ++i; | 
| 288 | 
> | 
      return (i == integrableObjects_.end()) ? NULL : *i;     | 
| 289 | 
> | 
    }     | 
| 290 | 
> | 
     | 
| 291 | 
> | 
    CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i) { | 
| 292 | 
> | 
      i = cutoffGroups_.begin(); | 
| 293 | 
> | 
      return (i == cutoffGroups_.end()) ? NULL : *i; | 
| 294 | 
> | 
    } | 
| 295 | 
  | 
 | 
| 296 | 
< | 
  int getNCutoffGroups() {return nCutoffGroups;} | 
| 296 | 
> | 
    CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i) { | 
| 297 | 
> | 
      ++i; | 
| 298 | 
> | 
      return (i == cutoffGroups_.end()) ? NULL : *i;     | 
| 299 | 
> | 
    }  | 
| 300 | 
> | 
     | 
| 301 | 
> | 
    ConstraintPair* beginConstraintPair(std::vector<ConstraintPair*>::iterator& i) { | 
| 302 | 
> | 
      i = constraintPairs_.begin(); | 
| 303 | 
> | 
      return (i == constraintPairs_.end()) ? NULL : *i; | 
| 304 | 
> | 
    } | 
| 305 | 
> | 
     | 
| 306 | 
> | 
    ConstraintPair* nextConstraintPair(std::vector<ConstraintPair*>::iterator& i) {             | 
| 307 | 
> | 
      ++i; | 
| 308 | 
> | 
      return (i == constraintPairs_.end()) ? NULL : *i;     | 
| 309 | 
> | 
    }          | 
| 310 | 
> | 
     | 
| 311 | 
> | 
    ConstraintElem* beginConstraintElem(std::vector<ConstraintElem*>::iterator& i) { | 
| 312 | 
> | 
      i = constraintElems_.begin(); | 
| 313 | 
> | 
      return (i == constraintElems_.end()) ? NULL : *i; | 
| 314 | 
> | 
    } | 
| 315 | 
> | 
     | 
| 316 | 
> | 
    ConstraintElem* nextConstraintElem(std::vector<ConstraintElem*>::iterator& i) {             | 
| 317 | 
> | 
      ++i; | 
| 318 | 
> | 
      return (i == constraintElems_.end()) ? NULL : *i;     | 
| 319 | 
> | 
    } | 
| 320 | 
  | 
 | 
| 321 | 
< | 
  void setStampID( int info ) {stampID = info;}  | 
| 321 | 
> | 
    Atom* beginFluctuatingCharge(std::vector<Atom*>::iterator& i) { | 
| 322 | 
> | 
      i = fluctuatingCharges_.begin(); | 
| 323 | 
> | 
      return (i == fluctuatingCharges_.end()) ? NULL : *i; | 
| 324 | 
> | 
    } | 
| 325 | 
> | 
     | 
| 326 | 
> | 
    Atom* nextFluctuatingCharge(std::vector<Atom*>::iterator& i) { | 
| 327 | 
> | 
      ++i; | 
| 328 | 
> | 
      return (i == fluctuatingCharges_.end()) ? NULL : *i;     | 
| 329 | 
> | 
    } | 
| 330 | 
  | 
 | 
| 331 | 
< | 
  void calcForces( void ); | 
| 332 | 
< | 
  void atoms2rigidBodies( void ); | 
| 333 | 
< | 
  double getPotential( void ); | 
| 334 | 
< | 
   | 
| 335 | 
< | 
  void printMe( void ); | 
| 331 | 
> | 
         | 
| 332 | 
> | 
    /**  | 
| 333 | 
> | 
     * Returns the total potential energy of short range interaction | 
| 334 | 
> | 
     * of this molecule  | 
| 335 | 
> | 
     */     | 
| 336 | 
> | 
    RealType getPotential(); | 
| 337 | 
> | 
     | 
| 338 | 
> | 
    /** get total mass of this molecule */         | 
| 339 | 
> | 
    RealType getMass(); | 
| 340 | 
> | 
     | 
| 341 | 
> | 
    /** return the center of mass of this molecule */ | 
| 342 | 
> | 
    Vector3d getCom(); | 
| 343 | 
> | 
     | 
| 344 | 
> | 
    /** Moves the center of this molecule */ | 
| 345 | 
> | 
    void moveCom(const Vector3d& delta); | 
| 346 | 
> | 
     | 
| 347 | 
> | 
    /** Returns the velocity of center of mass of this molecule */ | 
| 348 | 
> | 
    Vector3d getComVel(); | 
| 349 | 
  | 
 | 
| 350 | 
< | 
  void getCOM( double COM[3] ); | 
| 351 | 
< | 
  void moveCOM( double delta[3] ); | 
| 352 | 
< | 
  double getCOMvel( double COMvel[3] ); | 
| 353 | 
< | 
   | 
| 354 | 
< | 
  double getTotalMass(); | 
| 350 | 
> | 
    std::string getMoleculeName() {  | 
| 351 | 
> | 
      return moleculeName_; | 
| 352 | 
> | 
    } | 
| 353 | 
> | 
         | 
| 354 | 
> | 
    friend std::ostream& operator <<(std::ostream& o, Molecule& mol); | 
| 355 | 
  | 
 | 
| 356 | 
< | 
private: | 
| 356 | 
> | 
    //below functions are just forward functions | 
| 357 | 
> | 
    /** | 
| 358 | 
> | 
     * Adds property into property map | 
| 359 | 
> | 
     * @param genData GenericData to be added into PropertyMap | 
| 360 | 
> | 
     */ | 
| 361 | 
> | 
    void addProperty(GenericData* genData); | 
| 362 | 
  | 
 | 
| 363 | 
< | 
  int stampID;   // the ID in the BASS component stamp array | 
| 364 | 
< | 
  int nAtoms;    // the number of atoms in the molecule | 
| 365 | 
< | 
  int nBonds;    // ... .. ..  . .bonds .. .. . . . .  | 
| 366 | 
< | 
  int nBends;    // . . . . .. . .bends . . . . .. .  | 
| 367 | 
< | 
  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; | 
| 363 | 
> | 
    /** | 
| 364 | 
> | 
     * Removes property from PropertyMap by name | 
| 365 | 
> | 
     * @param propName the name of property to be removed | 
| 366 | 
> | 
     */ | 
| 367 | 
> | 
    void removeProperty(const std::string& propName); | 
| 368 | 
  | 
 | 
| 369 | 
< | 
  Atom** myAtoms;     // the array of atoms | 
| 370 | 
< | 
  Bond** myBonds;     // arrays of all the short range interactions | 
| 371 | 
< | 
  Bend** myBends; | 
| 372 | 
< | 
  Torsion** myTorsions; | 
| 112 | 
< | 
  vector<RigidBody*>   myRigidBodies; | 
| 113 | 
< | 
  vector<StuntDouble*> myIntegrableObjects; | 
| 114 | 
< | 
  vector<CutoffGroup*> myCutoffGroups; | 
| 115 | 
< | 
}; | 
| 369 | 
> | 
    /** | 
| 370 | 
> | 
     * clear all of the properties | 
| 371 | 
> | 
     */ | 
| 372 | 
> | 
    void clearProperties(); | 
| 373 | 
  | 
 | 
| 374 | 
< | 
#endif | 
| 374 | 
> | 
    /** | 
| 375 | 
> | 
     * Returns all names of properties | 
| 376 | 
> | 
     * @return all names of properties | 
| 377 | 
> | 
     */ | 
| 378 | 
> | 
    std::vector<std::string> getPropertyNames(); | 
| 379 | 
> | 
 | 
| 380 | 
> | 
    /** | 
| 381 | 
> | 
     * Returns all of the properties in PropertyMap | 
| 382 | 
> | 
     * @return all of the properties in PropertyMap | 
| 383 | 
> | 
     */       | 
| 384 | 
> | 
    std::vector<GenericData*> getProperties(); | 
| 385 | 
> | 
 | 
| 386 | 
> | 
    /** | 
| 387 | 
> | 
     * Returns property  | 
| 388 | 
> | 
     * @param propName name of property | 
| 389 | 
> | 
     * @return a pointer point to property with propName. If no property named propName | 
| 390 | 
> | 
     * exists, return NULL | 
| 391 | 
> | 
     */       | 
| 392 | 
> | 
    GenericData* getPropertyByName(const std::string& propName); | 
| 393 | 
> | 
     | 
| 394 | 
> | 
  private: | 
| 395 | 
> | 
     | 
| 396 | 
> | 
    int globalIndex_; | 
| 397 | 
> | 
     | 
| 398 | 
> | 
    std::vector<Atom*> atoms_; | 
| 399 | 
> | 
    std::vector<Bond*> bonds_; | 
| 400 | 
> | 
    std::vector<Bend*> bends_; | 
| 401 | 
> | 
    std::vector<Torsion*> torsions_; | 
| 402 | 
> | 
    std::vector<Inversion*> inversions_; | 
| 403 | 
> | 
    std::vector<RigidBody*> rigidBodies_; | 
| 404 | 
> | 
    std::vector<StuntDouble*> integrableObjects_; | 
| 405 | 
> | 
    std::vector<CutoffGroup*> cutoffGroups_; | 
| 406 | 
> | 
    std::vector<ConstraintPair*> constraintPairs_; | 
| 407 | 
> | 
    std::vector<ConstraintElem*> constraintElems_; | 
| 408 | 
> | 
    std::vector<Atom*> fluctuatingCharges_; | 
| 409 | 
> | 
    int stampId_; | 
| 410 | 
> | 
    std::string moleculeName_; | 
| 411 | 
> | 
    PropertyMap properties_; | 
| 412 | 
> | 
    RealType constrainedCharge_; | 
| 413 | 
> | 
 | 
| 414 | 
> | 
  }; | 
| 415 | 
> | 
 | 
| 416 | 
> | 
} //namespace OpenMD | 
| 417 | 
> | 
#endif // |