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(); |
423 |
|
if (iLoop == PREPAIR_LOOP) { |
424 |
|
if (info_->requiresPrepair()) { |
425 |
|
fDecomp_->collectIntermediateData(); |
426 |
< |
atomListLocal = fDecomp_->getAtomList(); |
427 |
< |
for (vector<int>::iterator ia = atomListLocal.begin(); |
432 |
< |
ia != atomListLocal.end(); ++ia) { |
433 |
< |
atom1 = (*ia); |
426 |
> |
|
427 |
> |
for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
428 |
|
sdat = fDecomp_->fillSelfData(atom1); |
429 |
|
interactionMan_->doPreForce(sdat); |
430 |
|
} |
431 |
+ |
|
432 |
|
fDecomp_->distributeIntermediateData(); |
433 |
|
} |
434 |
|
} |
437 |
|
|
438 |
|
fDecomp_->collectData(); |
439 |
|
|
440 |
< |
if (info_->requiresSkipCorrection() || info_->requiresSelfCorrection()) { |
441 |
< |
atomListLocal = fDecomp_->getAtomList(); |
442 |
< |
for (vector<int>::iterator ia = atomListLocal.begin(); |
448 |
< |
ia != atomListLocal.end(); ++ia) { |
449 |
< |
atom1 = (*ia); |
440 |
> |
if ( info_->requiresSkipCorrection() ) { |
441 |
> |
|
442 |
> |
for (int atom1 = 0; atom1 < fDecomp_->getNAtomsInRow(); atom1++) { |
443 |
|
|
444 |
< |
if (info_->requiresSkipCorrection()) { |
445 |
< |
vector<int> skipList = fDecomp_->getSkipsForAtom(atom1); |
446 |
< |
for (vector<int>::iterator jb = skipList.begin(); |
447 |
< |
jb != skipList.end(); ++jb) { |
448 |
< |
atom2 = (*jb); |
449 |
< |
idat = fDecomp_->fillSkipData(atom1, atom2); |
450 |
< |
interactionMan_->doSkipCorrection(idat); |
451 |
< |
} |
444 |
> |
vector<int> skipList = fDecomp_->getSkipsForRowAtom( atom1 ); |
445 |
> |
|
446 |
> |
for (vector<int>::iterator jb = skipList.begin(); |
447 |
> |
jb != skipList.end(); ++jb) { |
448 |
> |
|
449 |
> |
atom2 = (*jb); |
450 |
> |
idat = fDecomp_->fillSkipData(atom1, atom2); |
451 |
> |
interactionMan_->doSkipCorrection(idat); |
452 |
> |
|
453 |
|
} |
460 |
– |
|
461 |
– |
if (info_->requiresSelfCorrection()) { |
462 |
– |
sdat = fDecomp_->fillSelfData(atom1); |
463 |
– |
interactionMan_->doSelfCorrection(sdat); |
464 |
– |
} |
454 |
|
} |
455 |
|
} |
456 |
+ |
|
457 |
+ |
if (info_->requiresSelfCorrection()) { |
458 |
|
|
459 |
+ |
for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
460 |
+ |
sdat = fDecomp_->fillSelfData(atom1); |
461 |
+ |
interactionMan_->doSelfCorrection(sdat); |
462 |
+ |
} |
463 |
+ |
|
464 |
+ |
} |
465 |
+ |
|
466 |
|
// dangerous to iterate over enums, but we'll live on the edge: |
467 |
|
for (int i = NO_FAMILY; i != N_INTERACTION_FAMILIES; ++i){ |
468 |
|
lrPot += longRangePotential[i]; //Quick hack |