--- trunk/OOPSE/libmdtools/Molecule.cpp 2004/04/28 22:34:02 1140 +++ trunk/OOPSE/libmdtools/Molecule.cpp 2004/08/23 15:11:36 1452 @@ -12,11 +12,12 @@ Molecule::Molecule( void ){ myBonds = NULL; myBends = NULL; myTorsions = NULL; - hasMassRatio = false; } Molecule::~Molecule( void ){ int i; + CutoffGroup* cg; + vector::iterator iter; if( myAtoms != NULL ){ for(i=0; i::iterator iterCutoff; + Atom* cutoffAtom; + vector::iterator iterAtom; + int atomIndex; + GenericData* gdata; + ConsRbData* rbData; + RigidBody* oldRb; + nAtoms = theInit.nAtoms; nMembers = nAtoms; nBonds = theInit.nBonds; @@ -59,9 +73,28 @@ 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(); + + myConstraintPairs = theInit.myConstraintPairs; + } void Molecule::calcForces( void ){ @@ -73,19 +106,10 @@ void Molecule::calcForces( void ){ myRigidBodies[i]->updateAtoms(); } - //the mass ratio will never change during the simulation. Thus, we could - //just calculate it at the begining of the simulation - if (!hasMassRatio){ - double totMass = getTotalMass(); - for(int i = 0; i < nAtoms; i ++) - myAtoms[i]->setMassRatio(myAtoms[i]->getMass()/totMass); - hasMassRatio = true; - } - //calculate the center of mass of the molecule - getCOM(com); - for(int i = 0; i < nAtoms; i ++) - myAtoms[i]->setRc(com); + //getCOM(com); + //for(int i = 0; i < nAtoms; i ++) + // myAtoms[i]->setRc(com); for(i=0; i