--- trunk/src/brains/ForceManager.cpp 2005/12/02 20:10:49 776 +++ trunk/src/brains/ForceManager.cpp 2006/07/03 13:18:43 998 @@ -155,9 +155,9 @@ namespace oopse { Molecule::BondIterator bondIter;; Molecule::BendIterator bendIter; Molecule::TorsionIterator torsionIter; - double bondPotential = 0.0; - double bendPotential = 0.0; - double torsionPotential = 0.0; + RealType bondPotential = 0.0; + RealType bendPotential = 0.0; + RealType torsionPotential = 0.0; //calculate short range interactions for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { @@ -175,9 +175,9 @@ namespace oopse { for (bend = mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) { - double angle; + RealType angle; bend->calcForce(angle); - double currBendPot = bend->getPotential(); + RealType currBendPot = bend->getPotential(); bendPotential += bend->getPotential(); std::map::iterator i = bendDataSets.find(bend); if (i == bendDataSets.end()) { @@ -196,9 +196,9 @@ namespace oopse { } for (torsion = mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) { - double angle; + RealType angle; torsion->calcForce(angle); - double currTorsionPot = torsion->getPotential(); + RealType currTorsionPot = torsion->getPotential(); torsionPotential += torsion->getPotential(); std::map::iterator i = torsionDataSets.find(torsion); if (i == torsionDataSets.end()) { @@ -218,7 +218,7 @@ namespace oopse { } - double shortRangePotential = bondPotential + bendPotential + torsionPotential; + RealType shortRangePotential = bondPotential + bendPotential + torsionPotential; Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] = shortRangePotential; curSnapshot->statData[Stats::BOND_POTENTIAL] = bondPotential; @@ -230,12 +230,12 @@ namespace oopse { void ForceManager::calcLongRangeInteraction(bool needPotential, bool needStress) { Snapshot* curSnapshot; DataStorage* config; - double* frc; - double* pos; - double* trq; - double* A; - double* electroFrame; - double* rc; + RealType* frc; + RealType* pos; + RealType* trq; + RealType* A; + RealType* electroFrame; + RealType* rc; //get current snapshot from SimInfo curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); @@ -272,9 +272,9 @@ namespace oopse { } //initialize data before passing to fortran - double longRangePotential[LR_POT_TYPES]; - double lrPot = 0.0; - + RealType longRangePotential[LR_POT_TYPES]; + RealType lrPot = 0.0; + Vector3d totalDipole; Mat3x3d tau; short int passedCalcPot = needPotential; short int passedCalcStress = needStress; @@ -306,6 +306,15 @@ namespace oopse { lrPot += longRangePotential[i]; //Quick hack } + // grab the simulation box dipole moment if specified + if (info_->getCalcBoxDipole()){ + getAccumulatedBoxDipole(totalDipole.getArrayPointer()); + + curSnapshot->statData[Stats::BOX_DIPOLE_X] = totalDipole(0); + curSnapshot->statData[Stats::BOX_DIPOLE_Y] = totalDipole(1); + curSnapshot->statData[Stats::BOX_DIPOLE_Z] = totalDipole(2); + } + //store the tau and long range potential curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VDW_POT]; @@ -326,7 +335,7 @@ namespace oopse { for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { rb->calcForcesAndTorques(); } - } + } }