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 1136 by tim, Tue Apr 27 16:26:44 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 42 | Line 41 | void Molecule::initialize( molInit &theInit ){
41  
42  
43   void Molecule::initialize( molInit &theInit ){
44 <  double totMass;
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;
# Line 51 | 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 63 | Line 68 | void Molecule::initialize( molInit &theInit ){
68    for (int i = 0; i < myRigidBodies.size(); i++)
69        myRigidBodies[i]->calcRefCoords();
70  
71 +  myCutoffGroups = theInit.myCutoffGroups;
72  
73 <  //the mass ratio will never change during the simulation. Thus, we could
74 <  //just calculate it at the begining of the simulation
75 <  totMass = getTotalMass();
76 <  for(int i = 0; i < nAtoms; i ++)
77 <    myAtoms[i]->setMassRatio(myAtoms[i]->getMass()/totMass);  
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 ){
# Line 81 | Line 100 | void Molecule::calcForces( void ){
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);  
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++){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines