--- trunk/OOPSE/libmdtools/Molecule.cpp 2004/05/11 21:14:26 1158 +++ trunk/OOPSE/libmdtools/Molecule.cpp 2004/08/23 15:11:36 1452 @@ -16,6 +16,8 @@ Molecule::~Molecule( void ){ Molecule::~Molecule( void ){ int i; + CutoffGroup* cg; + vector::iterator iter; if( myAtoms != NULL ){ for(i=0; i::iterator iterAtom; int atomIndex; + GenericData* gdata; + ConsRbData* rbData; + RigidBody* oldRb; nAtoms = theInit.nAtoms; nMembers = nAtoms; @@ -55,7 +64,6 @@ void Molecule::initialize( molInit &theInit ){ nTorsions = theInit.nTorsions; nRigidBodies = theInit.nRigidBodies; nOriented = theInit.nOriented; - nCutoffGroups = theInit.nCutoffGroups; myAtoms = theInit.myAtoms; myBonds = theInit.myBonds; @@ -65,28 +73,27 @@ void Molecule::initialize( molInit &theInit ){ myIntegrableObjects = theInit.myIntegrableObjects; - for (int i = 0; i < myRigidBodies.size(); i++) + for (int i = 0; i < myRigidBodies.size(); i++){ myRigidBodies[i]->calcRefCoords(); + //just a quick hack + + gdata = myRigidBodies[i]->getProperty("OldState"); + if(gdata != NULL){ + rbData = dynamic_cast(gdata); + if(rbData ==NULL) + cerr << "dynamic_cast to ConsRbData Error in Molecule::initialize()" << endl; + else{ + oldRb = rbData->getData(); + oldRb->calcRefCoords(); + } + }//end if(gata != NULL) + + }//end for(int i = 0; i < myRigidBodies.size(); i++) myCutoffGroups = theInit.myCutoffGroups; + nCutoffGroups = myCutoffGroups.size(); - //creat a global index set of atoms which belong to cutoff group. - //it will be use to speed up the query whether an atom belongs to cutoff group or not - cutoffAtomSet.clear(); - - for(curCutoffGroup = beginCutoffGroup(iterCutoff); curCutoffGroup != NULL; - curCutoffGroup = nextCutoffGroup(iterCutoff)){ - - for(cutoffAtom = curCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; - cutoffAtom = curCutoffGroup->nextAtom(iterAtom)){ -#ifdef IS_MPI - atomIndex = cutoffAtom->getGlobalIndex(); -#else - atomIndex = cutoffAtom->getIndex(); -#endif - cutoffAtomSet.insert(atomIndex); - }// end for(cutoffAtom) - }//end for(curCutoffGroup) + myConstraintPairs = theInit.myConstraintPairs; }