--- trunk/src/brains/ForceManager.cpp 2005/12/02 15:38:03 770 +++ trunk/src/brains/ForceManager.cpp 2006/07/03 13:18:43 998 @@ -108,16 +108,14 @@ namespace oopse { std::sort(bendOrderStruct.begin(), bendOrderStruct.end(), std::ptr_fun(BendSortFunctor)); std::sort(torsionOrderStruct.begin(), torsionOrderStruct.end(), std::ptr_fun(TorsionSortFunctor)); - std::cout << "bend" << std::endl; for (std::vector::iterator k = bendOrderStruct.begin(); k != bendOrderStruct.end(); ++k) { Bend* bend = k->bend; - std::cout << "atom1=" <getAtomA()->getGlobalIndex() << ",atom2 = "<< bend->getAtomB()->getGlobalIndex() << ",atom3="<getAtomC()->getGlobalIndex() << " "; + std::cout << "Bend: atom1=" <getAtomA()->getGlobalIndex() << ",atom2 = "<< bend->getAtomB()->getGlobalIndex() << ",atom3="<getAtomC()->getGlobalIndex() << " "; std::cout << "deltaV=" << k->dataSet.deltaV << ",p_theta=" << k->dataSet.prev.angle <<",p_pot=" << k->dataSet.prev.potential<< ",c_theta=" << k->dataSet.curr.angle << ", c_pot = " << k->dataSet.curr.potential <::iterator l = torsionOrderStruct.begin(); l != torsionOrderStruct.end(); ++l) { Torsion* torsion = l->torsion; - std::cout << "atom1=" <getAtomA()->getGlobalIndex() << ",atom2 = "<< torsion->getAtomB()->getGlobalIndex() << ",atom3="<getAtomC()->getGlobalIndex() << ",atom4="<getAtomD()->getGlobalIndex()<< " "; + std::cout << "Torsion: atom1=" <getAtomA()->getGlobalIndex() << ",atom2 = "<< torsion->getAtomB()->getGlobalIndex() << ",atom3="<getAtomC()->getGlobalIndex() << ",atom4="<getAtomD()->getGlobalIndex()<< " "; std::cout << "deltaV=" << l->dataSet.deltaV << ",p_theta=" << l->dataSet.prev.angle <<",p_pot=" << l->dataSet.prev.potential<< ",c_theta=" << l->dataSet.curr.angle << ", c_pot = " << l->dataSet.curr.potential <beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { @@ -177,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()) { @@ -198,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()) { @@ -220,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; @@ -232,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(); @@ -274,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; @@ -308,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]; @@ -328,7 +335,7 @@ namespace oopse { for (rb = mol->beginRigidBody(rbIter); rb != NULL; rb = mol->nextRigidBody(rbIter)) { rb->calcForcesAndTorques(); } - } + } }