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 1156 by tim, Wed Apr 28 22:34:02 2004 UTC vs.
Revision 1157 by tim, Tue May 11 20:33:41 2004 UTC

# Line 12 | Line 12 | Molecule::Molecule( void ){
12    myBonds = NULL;
13    myBends = NULL;
14    myTorsions = NULL;
15  hasMassRatio = false;
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 62 | 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 +  //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->beginAtom(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 73 | Line 99 | void Molecule::calcForces( void ){
99      myRigidBodies[i]->updateAtoms();
100    }
101  
76  //the mass ratio will never change during the simulation. Thus, we could
77  //just calculate it at the begining of the simulation
78  if (!hasMassRatio){
79    double totMass = getTotalMass();
80    for(int i = 0; i < nAtoms; i ++)
81      myAtoms[i]->setMassRatio(myAtoms[i]->getMass()/totMass);  
82    hasMassRatio =  true;
83  }
84
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