--- trunk/src/brains/ForceManager.cpp 2005/04/15 22:04:00 507 +++ trunk/src/brains/ForceManager.cpp 2005/10/19 16:49:59 688 @@ -50,6 +50,8 @@ #include "brains/ForceManager.hpp" #include "primitives/Molecule.hpp" #include "UseTheForce/doForces_interface.h" +#define __C +#include "UseTheForce/DarkSide/fInteractionMap.h" #include "utils/simError.h" namespace oopse { @@ -126,13 +128,34 @@ namespace oopse { } - double shortRangePotential = 0.0; + + double bondPotential = 0.0; + double bendPotential = 0.0; + double torsionPotential = 0.0; + for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { - shortRangePotential += mol->getPotential(); - } + for (bond = mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) { + bondPotential += bond->getPotential(); + } + + for (bend = mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) { + bendPotential += bend->getPotential(); + } + + for (torsion = mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) { + torsionPotential += torsion->getPotential(); + } + + } + + double shortRangePotential = bondPotential + bendPotential + torsionPotential; Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] = shortRangePotential; + curSnapshot->statData[Stats::BOND_POTENTIAL] = bondPotential; + curSnapshot->statData[Stats::BEND_POTENTIAL] = bendPotential; + curSnapshot->statData[Stats::DIHEDRAL_POTENTIAL] = torsionPotential; + } void ForceManager::calcLongRangeInteraction(bool needPotential, bool needStress) { @@ -163,9 +186,9 @@ namespace oopse { CutoffGroup* cg; Vector3d com; std::vector rcGroup; - - if(info_->getNCutoffGroups() > 0){ + if(info_->getNCutoffGroups() > 0){ + for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { for(cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) { cg->getCOM(com); @@ -180,12 +203,20 @@ namespace oopse { } //initialize data before passing to fortran - double longRangePotential = 0.0; + double longRangePotential[LR_POT_TYPES]; + double lrPot = 0.0; + Mat3x3d tau; short int passedCalcPot = needPotential; short int passedCalcStress = needStress; int isError = 0; + for (int i=0; istatData[Stats::LONG_RANGE_POTENTIAL] = longRangePotential; + curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; + // curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = longRangePotential; + curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VDW_POT]; + curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_POT]; + curSnapshot->statData.setTau(tau); }