--- trunk/src/brains/Thermo.cpp 2005/05/22 21:05:15 541 +++ trunk/src/brains/Thermo.cpp 2006/04/25 02:09:01 945 @@ -70,12 +70,12 @@ namespace oopse { for (mol = info_->beginMolecule(miter); mol != NULL; mol = info_->nextMolecule(miter)) { for (integrableObject = mol->beginIntegrableObject(iiter); integrableObject != NULL; integrableObject = mol->nextIntegrableObject(iiter)) { - + double mass = integrableObject->getMass(); Vector3d vel = integrableObject->getVel(); - + kinetic += mass * (vel[0]*vel[0] + vel[1]*vel[1] + vel[2]*vel[2]); - + if (integrableObject->isDirectional()) { angMom = integrableObject->getJ(); I = integrableObject->getI(); @@ -110,19 +110,19 @@ namespace oopse { double Thermo::getPotential() { double potential = 0.0; Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); - double potential_local = curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] + - curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] ; + double shortRangePot_local = curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] ; // Get total potential for entire system from MPI. #ifdef IS_MPI - MPI_Allreduce(&potential_local, &potential, 1, MPI_DOUBLE, MPI_SUM, + MPI_Allreduce(&shortRangePot_local, &potential, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + potential += curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL]; #else - potential = potential_local; + potential = shortRangePot_local + curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL]; #endif // is_mpi