62 |
|
|
63 |
|
ForceManager::ForceManager(SimInfo * info) : info_(info), |
64 |
|
NBforcesInitialized_(false) { |
65 |
– |
lj_ = LJ::Instance(); |
66 |
– |
lj_->setForceField(info_->getForceField()); |
67 |
– |
|
68 |
– |
gb_ = GB::Instance(); |
69 |
– |
gb_->setForceField(info_->getForceField()); |
70 |
– |
|
71 |
– |
sticky_ = Sticky::Instance(); |
72 |
– |
sticky_->setForceField(info_->getForceField()); |
73 |
– |
|
74 |
– |
eam_ = EAM::Instance(); |
75 |
– |
eam_->setForceField(info_->getForceField()); |
76 |
– |
|
77 |
– |
sc_ = SC::Instance(); |
78 |
– |
sc_->setForceField(info_->getForceField()); |
65 |
|
} |
66 |
|
|
67 |
|
void ForceManager::calcForces() { |
68 |
|
|
69 |
+ |
|
70 |
|
if (!info_->isFortranInitialized()) { |
71 |
|
info_->update(); |
72 |
+ |
nbiMan_->setSimInfo(info_); |
73 |
+ |
nbiMan_->initialize(); |
74 |
+ |
info_->setupFortran(); |
75 |
|
} |
76 |
|
|
77 |
|
preCalculation(); |
284 |
|
//initialize data before passing to fortran |
285 |
|
RealType longRangePotential[LR_POT_TYPES]; |
286 |
|
RealType lrPot = 0.0; |
297 |
– |
Vector3d totalDipole; |
287 |
|
int isError = 0; |
288 |
|
|
289 |
|
for (int i=0; i<LR_POT_TYPES;i++){ |
310 |
|
for (int i=0; i<LR_POT_TYPES;i++){ |
311 |
|
lrPot += longRangePotential[i]; //Quick hack |
312 |
|
} |
313 |
< |
|
325 |
< |
// grab the simulation box dipole moment if specified |
326 |
< |
if (info_->getCalcBoxDipole()){ |
327 |
< |
getAccumulatedBoxDipole(totalDipole.getArrayPointer()); |
328 |
< |
|
329 |
< |
curSnapshot->statData[Stats::BOX_DIPOLE_X] = totalDipole(0); |
330 |
< |
curSnapshot->statData[Stats::BOX_DIPOLE_Y] = totalDipole(1); |
331 |
< |
curSnapshot->statData[Stats::BOX_DIPOLE_Z] = totalDipole(2); |
332 |
< |
} |
333 |
< |
|
313 |
> |
|
314 |
|
//store the tau and long range potential |
315 |
|
curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; |
316 |
|
curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VDW_POT]; |