63 |
|
|
64 |
|
ForceManager::ForceManager(SimInfo * info) : info_(info) { |
65 |
|
|
66 |
– |
#ifdef IS_MPI |
66 |
|
fDecomp_ = new ForceMatrixDecomposition(info_); |
68 |
– |
#else |
69 |
– |
// fDecomp_ = new ForceSerialDecomposition(info); |
70 |
– |
#endif |
67 |
|
} |
68 |
|
|
69 |
|
void ForceManager::calcForces() { |
73 |
|
interactionMan_->setSimInfo(info_); |
74 |
|
interactionMan_->initialize(); |
75 |
|
swfun_ = interactionMan_->getSwitchingFunction(); |
80 |
– |
fDecomp_->distributeInitialData(); |
76 |
|
info_->prepareTopology(); |
77 |
+ |
fDecomp_->distributeInitialData(); |
78 |
|
} |
79 |
|
|
80 |
|
preCalculation(); |
261 |
|
rc = pos; |
262 |
|
} |
263 |
|
|
268 |
– |
//initialize data before passing to fortran |
269 |
– |
RealType longRangePotential[N_INTERACTION_FAMILIES]; |
270 |
– |
RealType lrPot = 0.0; |
271 |
– |
int isError = 0; |
272 |
– |
|
273 |
– |
// dangerous to iterate over enums, but we'll live on the edge: |
274 |
– |
for (int i = NO_FAMILY; i != N_INTERACTION_FAMILIES; ++i){ |
275 |
– |
longRangePotential[i]=0.0; //Initialize array |
276 |
– |
} |
277 |
– |
|
264 |
|
// new stuff starts here: |
265 |
< |
|
265 |
> |
fDecomp_->zeroWorkArrays(); |
266 |
|
fDecomp_->distributeData(); |
267 |
|
|
268 |
|
int cg1, cg2, atom1, atom2; |
278 |
|
InteractionData idat; |
279 |
|
SelfData sdat; |
280 |
|
RealType mf; |
281 |
+ |
potVec pot(0.0); |
282 |
+ |
potVec longRangePotential(0.0); |
283 |
+ |
RealType lrPot; |
284 |
|
|
285 |
|
int loopStart, loopEnd; |
286 |
|
|
333 |
|
|
334 |
|
if (!fDecomp_->skipAtomPair(atom1, atom2)) { |
335 |
|
|
336 |
+ |
pot *= 0.0; |
337 |
+ |
|
338 |
|
idat = fDecomp_->fillInteractionData(atom1, atom2); |
339 |
+ |
*(idat.pot) = pot; |
340 |
|
|
341 |
|
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
342 |
|
*(idat.d) = d_grp; |
353 |
|
interactionMan_->doPrePair(idat); |
354 |
|
} else { |
355 |
|
interactionMan_->doPair(idat); |
356 |
+ |
fDecomp_->unpackInteractionData(idat, atom1, atom2); |
357 |
|
vij += *(idat.vpair); |
358 |
|
fij += *(idat.f1); |
359 |
|
tau -= outProduct( *(idat.d), *(idat.f1)); |
460 |
|
|
461 |
|
} |
462 |
|
|
463 |
< |
// dangerous to iterate over enums, but we'll live on the edge: |
464 |
< |
for (int i = NO_FAMILY; i != N_INTERACTION_FAMILIES; ++i){ |
465 |
< |
lrPot += longRangePotential[i]; //Quick hack |
473 |
< |
} |
474 |
< |
|
463 |
> |
longRangePotential = fDecomp_->getLongRangePotential(); |
464 |
> |
lrPot = longRangePotential.sum(); |
465 |
> |
|
466 |
|
//store the tau and long range potential |
467 |
|
curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; |
468 |
|
curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VANDERWAALS_FAMILY]; |