void ThermoIntegrationForceManager::calcForces(){ Snapshot* curSnapshot; SimInfo::MoleculeIterator mi; Molecule* mol; Molecule::IntegrableObjectIterator ii; StuntDouble* sd; Vector3d frc; Vector3d trq; Mat3x3d tempTau; // perform the standard calcForces first ForceManager::calcForces(); curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); // now scale forces and torques of all the sds for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { for (sd = mol->beginIntegrableObject(ii); sd != NULL; sd = mol->nextIntegrableObject(ii)) { frc = sd->getFrc(); frc *= factor_; sd->setFrc(frc); if (sd->isDirectional()){ trq = sd->getTrq(); trq *= factor_; sd->setTrq(trq); } } } // set rawPotential to be the unmodulated potential lrPot_ = curSnapshot->getLongRangePotential(); curSnapshot->setRawPotential(lrPot_); // modulate the potential and update the snapshot lrPot_ *= factor_; curSnapshot->setLongRangePotential(lrPot_); // scale the pressure tensor tempTau = curSnapshot->getStressTensor(); tempTau *= factor_; curSnapshot->setStressTensor(tempTau); // now, on to the applied restraining potentials (if needed): RealType restPot_local = 0.0; RealType vHarm_local = 0.0; if (simParam->getUseRestraints()) { // do restraints from RestraintForceManager: restPot_local = doRestraints(1.0 - factor_); vHarm_local = getUnscaledPotential(); } #ifdef IS_MPI RealType restPot; MPI::COMM_WORLD.Allreduce(&restPot_local, &restPot, 1, MPI::REALTYPE, MPI::SUM); MPI::COMM_WORLD.Allreduce(&vHarm_local, &vHarm_, 1, MPI::REALTYPE, MPI::SUM); lrPot_ += restPot; #else lrPot_ += restPot_local; vHarm_ = vHarm_local; #endif // give the final values to stats curSnapshot->setLongRangePotential(lrPot_); curSnapshot->setRestraintPotential(vHarm_); }