| 50 |  | #include "brains/ForceManager.hpp" | 
| 51 |  | #include "primitives/Molecule.hpp" | 
| 52 |  | #include "UseTheForce/doForces_interface.h" | 
| 53 | + | #define __C | 
| 54 | + | #include "UseTheForce/DarkSide/fInteractionMap.h" | 
| 55 |  | #include "utils/simError.h" | 
| 56 |  | namespace oopse { | 
| 57 |  |  | 
| 128 |  |  | 
| 129 |  | } | 
| 130 |  |  | 
| 131 | < | double  shortRangePotential = 0.0; | 
| 131 | > |  | 
| 132 | > | double bondPotential = 0.0; | 
| 133 | > | double bendPotential = 0.0; | 
| 134 | > | double torsionPotential = 0.0; | 
| 135 | > |  | 
| 136 |  | for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) { | 
| 131 | – | shortRangePotential += mol->getPotential(); | 
| 132 | – | } | 
| 137 |  |  | 
| 138 | + | for (bond = mol->beginBond(bondIter); bond != NULL; bond = mol->nextBond(bondIter)) { | 
| 139 | + | bondPotential += bond->getPotential(); | 
| 140 | + | } | 
| 141 | + |  | 
| 142 | + | for (bend = mol->beginBend(bendIter); bend != NULL; bend = mol->nextBend(bendIter)) { | 
| 143 | + | bendPotential += bend->getPotential(); | 
| 144 | + | } | 
| 145 | + |  | 
| 146 | + | for (torsion = mol->beginTorsion(torsionIter); torsion != NULL; torsion = mol->nextTorsion(torsionIter)) { | 
| 147 | + | torsionPotential += torsion->getPotential(); | 
| 148 | + | } | 
| 149 | + |  | 
| 150 | + | } | 
| 151 | + |  | 
| 152 | + | double  shortRangePotential = bondPotential + bendPotential + torsionPotential; | 
| 153 |  | Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); | 
| 154 |  | curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] = shortRangePotential; | 
| 155 | + | curSnapshot->statData[Stats::BOND_POTENTIAL] = bondPotential; | 
| 156 | + | curSnapshot->statData[Stats::BEND_POTENTIAL] = bendPotential; | 
| 157 | + | curSnapshot->statData[Stats::DIHEDRAL_POTENTIAL] = torsionPotential; | 
| 158 | + |  | 
| 159 |  | } | 
| 160 |  |  | 
| 161 |  | void ForceManager::calcLongRangeInteraction(bool needPotential, bool needStress) { | 
| 203 |  | } | 
| 204 |  |  | 
| 205 |  | //initialize data before passing to fortran | 
| 206 | < | double longRangePotential = 0.0; | 
| 206 | > | double longRangePotential[LR_POT_TYPES]; | 
| 207 | > | double lrPot = 0.0; | 
| 208 | > |  | 
| 209 |  | Mat3x3d tau; | 
| 210 |  | short int passedCalcPot = needPotential; | 
| 211 |  | short int passedCalcStress = needStress; | 
| 212 |  | int isError = 0; | 
| 213 |  |  | 
| 214 | + | for (int i=0; i<LR_POT_TYPES;i++){ | 
| 215 | + | longRangePotential[i]=0.0; //Initialize array | 
| 216 | + | } | 
| 217 | + |  | 
| 218 | + |  | 
| 219 | + |  | 
| 220 |  | doForceLoop( pos, | 
| 221 |  | rc, | 
| 222 |  | A, | 
| 224 |  | frc, | 
| 225 |  | trq, | 
| 226 |  | tau.getArrayPointer(), | 
| 227 | < | &longRangePotential, | 
| 227 | > | longRangePotential, | 
| 228 |  | &passedCalcPot, | 
| 229 |  | &passedCalcStress, | 
| 230 |  | &isError ); | 
| 235 |  | painCave.isFatal = 1; | 
| 236 |  | simError(); | 
| 237 |  | } | 
| 238 | + | for (int i=0; i<LR_POT_TYPES;i++){ | 
| 239 | + | lrPot += longRangePotential[i]; //Quick hack | 
| 240 | + | } | 
| 241 |  |  | 
| 242 |  | //store the tau and long range potential | 
| 243 | < | curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = longRangePotential; | 
| 243 | > | curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; | 
| 244 | > | //    curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = longRangePotential; | 
| 245 | > | curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VDW_POT]; | 
| 246 | > | curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_POT]; | 
| 247 | > |  | 
| 248 |  | curSnapshot->statData.setTau(tau); | 
| 249 |  | } | 
| 250 |  |  |