ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Molecule.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Molecule.cpp (file contents):
Revision 1113 by tim, Thu Apr 15 16:18:26 2004 UTC vs.
Revision 1158 by tim, Tue May 11 21:14:26 2004 UTC

# Line 12 | Line 12 | Molecule::Molecule( void ){
12    myBonds = NULL;
13    myBends = NULL;
14    myTorsions = NULL;
15
15   }
16  
17   Molecule::~Molecule( void ){
# Line 43 | Line 42 | void Molecule::initialize( molInit &theInit ){
42  
43   void Molecule::initialize( molInit &theInit ){
44  
45 +  CutoffGroup* curCutoffGroup;
46 +  vector<CutoffGroup*>::iterator iterCutoff;
47 +  Atom* cutoffAtom;
48 +  vector<Atom*>::iterator iterAtom;
49 +  int atomIndex;
50 +  
51    nAtoms = theInit.nAtoms;
52    nMembers = nAtoms;
53    nBonds = theInit.nBonds;
# Line 50 | Line 55 | void Molecule::initialize( molInit &theInit ){
55    nTorsions = theInit.nTorsions;
56    nRigidBodies = theInit.nRigidBodies;
57    nOriented = theInit.nOriented;
58 +  nCutoffGroups = theInit.nCutoffGroups;
59  
60    myAtoms = theInit.myAtoms;
61    myBonds = theInit.myBonds;
# Line 61 | Line 67 | void Molecule::initialize( molInit &theInit ){
67  
68    for (int i = 0; i < myRigidBodies.size(); i++)
69        myRigidBodies[i]->calcRefCoords();
70 <    
70 >
71 >  myCutoffGroups = theInit.myCutoffGroups;
72 >
73 >  //creat a global index set of atoms which belong to cutoff group.
74 >  //it will be use to speed up the query whether an atom belongs to cutoff group or not
75 >  cutoffAtomSet.clear();
76 >
77 >  for(curCutoffGroup = beginCutoffGroup(iterCutoff); curCutoffGroup != NULL;
78 >                                                  curCutoffGroup = nextCutoffGroup(iterCutoff)){
79 >
80 >      for(cutoffAtom = curCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL;
81 >                                           cutoffAtom = curCutoffGroup->nextAtom(iterAtom)){
82 > #ifdef IS_MPI
83 >        atomIndex = cutoffAtom->getGlobalIndex();
84 > #else
85 >        atomIndex = cutoffAtom->getIndex();
86 > #endif
87 >        cutoffAtomSet.insert(atomIndex);
88 >     }// end for(cutoffAtom)    
89 >  }//end for(curCutoffGroup)
90 >  
91   }
92  
93   void Molecule::calcForces( void ){
94    
95    int i;
96 +  double com[3];
97  
98    for(i=0; i<myRigidBodies.size(); i++) {
99      myRigidBodies[i]->updateAtoms();
100    }
101  
102 +  //calculate the center of mass of the molecule
103 +  //getCOM(com);  
104 +  //for(int i = 0; i < nAtoms; i ++)
105 +  //  myAtoms[i]->setRc(com);  
106 +  
107 +
108    for(i=0; i<nBonds; i++){
109      myBonds[i]->calc_forces();
110    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines