--- trunk/OOPSE/libmdtools/ForceFields.cpp 2004/05/11 21:14:26 1158 +++ trunk/OOPSE/libmdtools/ForceFields.cpp 2004/05/12 16:38:45 1167 @@ -92,11 +92,8 @@ void ForceFields::doForces( int calcPot, int calcStres int numCutoffGroups; CutoffGroup* myCutoffGroup; vector::iterator iterCutoff; - Atom* cutoffAtom; - vector::iterator iterAtom; double com[3]; - double tempPos[3]; - int atomIndex; + vector rcGroup; short int passedCalcPot = (short int)calcPot; short int passedCalcStress = (short int)calcStress; @@ -131,46 +128,25 @@ void ForceFields::doForces( int calcPot, int calcStres u_l = config->getUlArray(); if(entry_plug->haveCutoffGroups){ - //if myMols = entry_plug->molecules; numMol = entry_plug->n_mol; for(int i = 0; i < numMol; i++){ - numAtom = myMols[i].getNAtoms(); - myAtoms = myMols[i].getMyAtoms(); - - - for(int j = 0; j < numAtom; j++){ -#ifdef IS_MPI - atomIndex = myAtoms[j]->getGlobalIndex(); -#else - atomIndex = myAtoms[j]->getIndex(); -#endif - - if(myMols[i].belongToCutoffGroup(atomIndex)) - continue; - else{ - myAtoms[j]->getPos(tempPos); - myAtoms[j]->setRc(tempPos); - } - - } numCutoffGroups = myMols[i].getNCutoffGroups(); for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ //get center of mass of the cutoff group - myCutoffGroup->getCOM(com); + myCutoffGroup->getCOM(com); - for(cutoffAtom = myCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL; - cutoffAtom = myCutoffGroup->nextAtom(iterAtom)){ - cutoffAtom->setRc(com); - } - + rcGroup.push_back(com[0]); + rcGroup.push_back(com[1]); + rcGroup.push_back(com[2]); + }// end for(myCutoffGroup) }//end for(int i = 0) - rc = config->getRcArray(); + rc = &rcGroup[0]; } else{ // center of mass of the group is the same as position of the atom if cutoff group does not exist