| 1 | 
gezelter | 
2 | 
#ifndef _MOLECULE_H_ | 
| 2 | 
  | 
  | 
#define _MOLECULE_H_ | 
| 3 | 
  | 
  | 
 | 
| 4 | 
  | 
  | 
#include <set> | 
| 5 | 
  | 
  | 
#include <vector> | 
| 6 | 
  | 
  | 
 | 
| 7 | 
tim | 
3 | 
#include "primitives/Atom.hpp" | 
| 8 | 
  | 
  | 
#include "primitives/SRI.hpp" | 
| 9 | 
  | 
  | 
#include "types/MoleculeStamp.hpp" | 
| 10 | 
  | 
  | 
#include "primitives/RigidBody.hpp" | 
| 11 | 
  | 
  | 
#include "primitives/CutoffGroup.hpp" | 
| 12 | 
gezelter | 
2 | 
 | 
| 13 | 
  | 
  | 
using namespace std; | 
| 14 | 
  | 
  | 
 | 
| 15 | 
  | 
  | 
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; | 
| 33 | 
  | 
  | 
 | 
| 34 | 
  | 
  | 
class Molecule{ | 
| 35 | 
  | 
  | 
 | 
| 36 | 
  | 
  | 
public: | 
| 37 | 
  | 
  | 
   | 
| 38 | 
  | 
  | 
  Molecule( void ); | 
| 39 | 
  | 
  | 
  ~Molecule( void ); | 
| 40 | 
  | 
  | 
 | 
| 41 | 
  | 
  | 
  void initialize( molInit &theInit ); | 
| 42 | 
  | 
  | 
 | 
| 43 | 
  | 
  | 
  void setMyIndex( int theIndex ){ myIndex = theIndex;} | 
| 44 | 
  | 
  | 
  int getMyIndex( void ) { return myIndex; } | 
| 45 | 
  | 
  | 
 | 
| 46 | 
  | 
  | 
  int getGlobalIndex( void ) { return globalIndex; } | 
| 47 | 
  | 
  | 
  void setGlobalIndex( int theIndex ) { globalIndex = theIndex; } | 
| 48 | 
  | 
  | 
 | 
| 49 | 
  | 
  | 
  int getNAtoms   ( void )    {return nAtoms;} | 
| 50 | 
  | 
  | 
  int getNBonds   ( void )    {return nBonds;} | 
| 51 | 
  | 
  | 
  int getNBends   ( void )    {return nBends;} | 
| 52 | 
  | 
  | 
  int getNTorsions( void )    {return nTorsions;} | 
| 53 | 
  | 
  | 
  int getNRigidBodies( void ) {return myRigidBodies.size();} | 
| 54 | 
  | 
  | 
  int getNOriented( void )    {return nOriented;} | 
| 55 | 
  | 
  | 
  int getNMembers ( void )    {return nMembers;} | 
| 56 | 
  | 
  | 
  int getStampID  ( void )    {return stampID;} | 
| 57 | 
  | 
  | 
 | 
| 58 | 
  | 
  | 
  Atom**      getMyAtoms   ( void )    {return myAtoms;} | 
| 59 | 
  | 
  | 
  Bond**      getMyBonds   ( void )    {return myBonds;} | 
| 60 | 
  | 
  | 
  Bend**      getMyBends   ( void )    {return myBends;} | 
| 61 | 
  | 
  | 
  Torsion**   getMyTorsions( void )    {return myTorsions;} | 
| 62 | 
  | 
  | 
  vector<RigidBody*> getMyRigidBodies( void ) {return myRigidBodies;} | 
| 63 | 
  | 
  | 
  vector<StuntDouble*>& getIntegrableObjects(void) {return myIntegrableObjects;} | 
| 64 | 
  | 
  | 
 | 
| 65 | 
  | 
  | 
  //beginCutoffGroup return the first group and initialize the iterator | 
| 66 | 
  | 
  | 
  CutoffGroup* beginCutoffGroup(vector<CutoffGroup*>::iterator& i){ | 
| 67 | 
  | 
  | 
    i = myCutoffGroups.begin(); | 
| 68 | 
  | 
  | 
    return i != myCutoffGroups.end()? *i : NULL; | 
| 69 | 
  | 
  | 
  } | 
| 70 | 
  | 
  | 
 | 
| 71 | 
  | 
  | 
  //nextCutoffGroup return next cutoff group based on the iterator | 
| 72 | 
  | 
  | 
  CutoffGroup* nextCutoffGroup(vector<CutoffGroup*>::iterator& i){ | 
| 73 | 
  | 
  | 
    i++; | 
| 74 | 
  | 
  | 
    return i != myCutoffGroups.end()? *i : NULL; | 
| 75 | 
  | 
  | 
  } | 
| 76 | 
  | 
  | 
 | 
| 77 | 
  | 
  | 
  int getNCutoffGroups() {return nCutoffGroups;} | 
| 78 | 
  | 
  | 
 | 
| 79 | 
  | 
  | 
  void setStampID( int info ) {stampID = info;}  | 
| 80 | 
  | 
  | 
 | 
| 81 | 
  | 
  | 
  void calcForces( void ); | 
| 82 | 
  | 
  | 
  void atoms2rigidBodies( void ); | 
| 83 | 
  | 
  | 
  double getPotential( void ); | 
| 84 | 
  | 
  | 
   | 
| 85 | 
  | 
  | 
  void printMe( void ); | 
| 86 | 
  | 
  | 
 | 
| 87 | 
  | 
  | 
  void getCOM( double COM[3] ); | 
| 88 | 
  | 
  | 
  void moveCOM( double delta[3] ); | 
| 89 | 
  | 
  | 
  double getCOMvel( double COMvel[3] ); | 
| 90 | 
  | 
  | 
   | 
| 91 | 
  | 
  | 
  double getTotalMass(); | 
| 92 | 
  | 
  | 
 | 
| 93 | 
  | 
  | 
private: | 
| 94 | 
  | 
  | 
 | 
| 95 | 
  | 
  | 
  int stampID;   // the ID in the BASS component stamp array | 
| 96 | 
  | 
  | 
  int nAtoms;    // the number of atoms in the molecule | 
| 97 | 
  | 
  | 
  int nBonds;    // ... .. ..  . .bonds .. .. . . . .  | 
| 98 | 
  | 
  | 
  int nBends;    // . . . . .. . .bends . . . . .. .  | 
| 99 | 
  | 
  | 
  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; | 
| 107 | 
  | 
  | 
 | 
| 108 | 
  | 
  | 
  Atom** myAtoms;     // the array of atoms | 
| 109 | 
  | 
  | 
  Bond** myBonds;     // arrays of all the short range interactions | 
| 110 | 
  | 
  | 
  Bend** myBends; | 
| 111 | 
  | 
  | 
  Torsion** myTorsions; | 
| 112 | 
  | 
  | 
  vector<RigidBody*>   myRigidBodies; | 
| 113 | 
  | 
  | 
  vector<StuntDouble*> myIntegrableObjects; | 
| 114 | 
  | 
  | 
  vector<CutoffGroup*> myCutoffGroups; | 
| 115 | 
  | 
  | 
}; | 
| 116 | 
  | 
  | 
 | 
| 117 | 
  | 
  | 
#endif |