--- trunk/OOPSE/libmdtools/Molecule.cpp 2004/04/14 16:32:15 1109 +++ trunk/OOPSE/libmdtools/Molecule.cpp 2004/04/15 16:18:26 1113 @@ -58,6 +58,9 @@ void Molecule::initialize( molInit &theInit ){ myRigidBodies = theInit.myRigidBodies; myIntegrableObjects = theInit.myIntegrableObjects; + + for (int i = 0; i < myRigidBodies.size(); i++) + myRigidBodies[i]->calcRefCoords(); } @@ -132,15 +135,15 @@ void Molecule::moveCOM(double delta[3]){ double aPos[3]; int i, j; - for(i=0; igetPos( aPos ); + myIntegrableObjects[i]->getPos( aPos ); for (j=0; j< 3; j++) aPos[j] += delta[j]; - myAtoms[i]->setPos( aPos ); + myIntegrableObjects[i]->setPos( aPos ); } } @@ -173,13 +176,13 @@ void Molecule::getCOM( double COM[3] ) { mtot = 0.0; - for (i=0; i < nAtoms; i++) { - if (myAtoms[i] != NULL) { + for (i=0; i < myIntegrableObjects.size(); i++) { + if (myIntegrableObjects[i] != NULL) { - mass = myAtoms[i]->getMass(); + mass = myIntegrableObjects[i]->getMass(); mtot += mass; - myAtoms[i]->getPos( aPos ); + myIntegrableObjects[i]->getPos( aPos ); for( j = 0; j < 3; j++) COM[j] += aPos[j] * mass; @@ -203,13 +206,13 @@ double Molecule::getCOMvel( double COMvel[3] ) { mtot = 0.0; - for (i=0; i < nAtoms; i++) { - if (myAtoms[i] != NULL) { + for (i=0; i < myIntegrableObjects.size(); i++) { + if (myIntegrableObjects[i] != NULL) { - mass = myAtoms[i]->getMass(); + mass = myIntegrableObjects[i]->getMass(); mtot += mass; - myAtoms[i]->getVel(aVel); + myIntegrableObjects[i]->getVel(aVel); for (j=0; j<3; j++) COMvel[j] += aVel[j]*mass; @@ -226,15 +229,12 @@ double Molecule::getTotalMass() double Molecule::getTotalMass() { - int natoms; - Atom** atoms; + double totalMass; - natoms = getNAtoms(); - atoms = getMyAtoms(); totalMass = 0; - for(int i =0; i < natoms; i++){ - totalMass += atoms[i]->getMass(); + for(int i =0; i < myIntegrableObjects.size(); i++){ + totalMass += myIntegrableObjects[i]->getMass(); } return totalMass;