| 57 |
|
#include "primitives/Bend.hpp" |
| 58 |
|
#include "primitives/Torsion.hpp" |
| 59 |
|
#include "primitives/Inversion.hpp" |
| 60 |
– |
#include "nonbonded/LJ.hpp" |
| 60 |
|
|
| 61 |
|
namespace OpenMD { |
| 62 |
< |
|
| 62 |
> |
|
| 63 |
> |
ForceManager::ForceManager(SimInfo * info) : info_(info), |
| 64 |
> |
NBforcesInitialized_(false) { |
| 65 |
> |
} |
| 66 |
> |
|
| 67 |
|
void ForceManager::calcForces() { |
| 68 |
|
|
| 69 |
|
if (!info_->isFortranInitialized()) { |
| 70 |
|
info_->update(); |
| 71 |
|
} |
| 72 |
|
|
| 70 |
– |
if (!NBforcesInitialized_) { |
| 71 |
– |
LJ* lj = new LJ(info_->getForceField()); |
| 72 |
– |
lj->initialize(); |
| 73 |
– |
} |
| 74 |
– |
|
| 73 |
|
preCalculation(); |
| 74 |
|
|
| 75 |
|
calcShortRangeInteraction(); |
| 280 |
|
//initialize data before passing to fortran |
| 281 |
|
RealType longRangePotential[LR_POT_TYPES]; |
| 282 |
|
RealType lrPot = 0.0; |
| 285 |
– |
Vector3d totalDipole; |
| 283 |
|
int isError = 0; |
| 284 |
|
|
| 285 |
|
for (int i=0; i<LR_POT_TYPES;i++){ |
| 306 |
|
for (int i=0; i<LR_POT_TYPES;i++){ |
| 307 |
|
lrPot += longRangePotential[i]; //Quick hack |
| 308 |
|
} |
| 309 |
< |
|
| 313 |
< |
// grab the simulation box dipole moment if specified |
| 314 |
< |
if (info_->getCalcBoxDipole()){ |
| 315 |
< |
getAccumulatedBoxDipole(totalDipole.getArrayPointer()); |
| 316 |
< |
|
| 317 |
< |
curSnapshot->statData[Stats::BOX_DIPOLE_X] = totalDipole(0); |
| 318 |
< |
curSnapshot->statData[Stats::BOX_DIPOLE_Y] = totalDipole(1); |
| 319 |
< |
curSnapshot->statData[Stats::BOX_DIPOLE_Z] = totalDipole(2); |
| 320 |
< |
} |
| 321 |
< |
|
| 309 |
> |
|
| 310 |
|
//store the tau and long range potential |
| 311 |
|
curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; |
| 312 |
|
curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VDW_POT]; |