| 64 |
|
|
| 65 |
|
ForceManager::ForceManager(SimInfo * info) : info_(info) { |
| 66 |
|
forceField_ = info_->getForceField(); |
| 67 |
– |
fDecomp_ = new ForceMatrixDecomposition(info_); |
| 67 |
|
interactionMan_ = new InteractionManager(); |
| 68 |
+ |
fDecomp_ = new ForceMatrixDecomposition(info_, interactionMan_); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
/** |
| 122 |
|
painCave.isFatal = 0; |
| 123 |
|
painCave.severity = OPENMD_INFO; |
| 124 |
|
simError(); |
| 125 |
< |
} |
| 125 |
> |
} |
| 126 |
> |
fDecomp_->setUserCutoff(rCut_); |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
map<string, CutoffMethod> stringToCutoffMethod; |
| 196 |
|
simError(); |
| 197 |
|
cutoffPolicy_ = TRADITIONAL; |
| 198 |
|
} |
| 199 |
+ |
fDecomp_->setCutoffPolicy(cutoffPolicy_); |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
/** |
| 475 |
|
} |
| 476 |
|
|
| 477 |
|
void ForceManager::longRangeInteractions() { |
| 476 |
– |
|
| 478 |
|
// some of this initial stuff will go away: |
| 479 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 480 |
|
DataStorage* config = &(curSnapshot->atomData); |
| 485 |
|
RealType* A = config->getArrayPointer(DataStorage::dslAmat); |
| 486 |
|
RealType* electroFrame = config->getArrayPointer(DataStorage::dslElectroFrame); |
| 487 |
|
RealType* particlePot = config->getArrayPointer(DataStorage::dslParticlePot); |
| 487 |
– |
RealType* rc; |
| 488 |
|
|
| 489 |
– |
if(info_->getNGlobalCutoffGroups() != info_->getNGlobalAtoms()){ |
| 490 |
– |
rc = cgConfig->getArrayPointer(DataStorage::dslPosition); |
| 491 |
– |
} else { |
| 492 |
– |
// center of mass of the group is the same as position of the atom |
| 493 |
– |
// if cutoff group does not exist |
| 494 |
– |
rc = pos; |
| 495 |
– |
} |
| 496 |
– |
|
| 489 |
|
// new stuff starts here: |
| 490 |
+ |
|
| 491 |
|
fDecomp_->zeroWorkArrays(); |
| 492 |
|
fDecomp_->distributeData(); |
| 493 |
< |
|
| 494 |
< |
int cg1, cg2, atom1, atom2; |
| 495 |
< |
Vector3d d_grp, dag; |
| 496 |
< |
RealType rgrpsq, rgrp; |
| 493 |
> |
|
| 494 |
> |
int cg1, cg2, atom1, atom2, topoDist; |
| 495 |
> |
Vector3d d_grp, dag, d; |
| 496 |
> |
RealType rgrpsq, rgrp, r2, r; |
| 497 |
> |
RealType electroMult, vdwMult; |
| 498 |
|
RealType vij; |
| 499 |
|
Vector3d fij, fg; |
| 500 |
|
tuple3<RealType, RealType, RealType> cuts; |
| 508 |
|
potVec pot(0.0); |
| 509 |
|
potVec longRangePotential(0.0); |
| 510 |
|
RealType lrPot; |
| 511 |
+ |
RealType vpair; |
| 512 |
|
|
| 513 |
|
int loopStart, loopEnd; |
| 514 |
|
|
| 518 |
|
} else { |
| 519 |
|
loopStart = PAIR_LOOP; |
| 520 |
|
} |
| 521 |
+ |
|
| 522 |
|
|
| 523 |
< |
for (int iLoop = loopStart; iLoop < loopEnd; iLoop++) { |
| 524 |
< |
|
| 523 |
> |
for (int iLoop = loopStart; iLoop <= loopEnd; iLoop++) { |
| 524 |
> |
|
| 525 |
|
if (iLoop == loopStart) { |
| 526 |
|
bool update_nlist = fDecomp_->checkNeighborList(); |
| 527 |
|
if (update_nlist) |
| 528 |
|
neighborList = fDecomp_->buildNeighborList(); |
| 529 |
< |
} |
| 530 |
< |
|
| 529 |
> |
} |
| 530 |
> |
|
| 531 |
|
for (vector<pair<int, int> >::iterator it = neighborList.begin(); |
| 532 |
|
it != neighborList.end(); ++it) { |
| 533 |
< |
|
| 533 |
> |
|
| 534 |
|
cg1 = (*it).first; |
| 535 |
|
cg2 = (*it).second; |
| 536 |
|
|
| 543 |
|
rCutSq = cuts.second; |
| 544 |
|
|
| 545 |
|
if (rgrpsq < rCutSq) { |
| 546 |
< |
*(idat.rcut) = cuts.first; |
| 546 |
> |
idat.rcut = &cuts.first; |
| 547 |
|
if (iLoop == PAIR_LOOP) { |
| 548 |
|
vij *= 0.0; |
| 549 |
|
fij = V3Zero; |
| 550 |
|
} |
| 551 |
|
|
| 552 |
< |
in_switching_region = switcher_->getSwitch(rgrpsq, *(idat.sw), dswdr, |
| 552 |
> |
in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, |
| 553 |
|
rgrp); |
| 554 |
+ |
|
| 555 |
+ |
idat.sw = &sw; |
| 556 |
|
|
| 557 |
|
atomListRow = fDecomp_->getAtomsInGroupRow(cg1); |
| 558 |
|
atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); |
| 565 |
|
jb != atomListColumn.end(); ++jb) { |
| 566 |
|
atom2 = (*jb); |
| 567 |
|
|
| 568 |
+ |
cerr << "doing atoms " << atom1 << " " << atom2 << "\n"; |
| 569 |
|
if (!fDecomp_->skipAtomPair(atom1, atom2)) { |
| 570 |
|
|
| 571 |
< |
pot *= 0.0; |
| 571 |
> |
vpair = 0.0; |
| 572 |
|
|
| 573 |
+ |
cerr << "filling idat atoms " << atom1 << " " << atom2 << "\n"; |
| 574 |
|
idat = fDecomp_->fillInteractionData(atom1, atom2); |
| 575 |
< |
*(idat.pot) = pot; |
| 575 |
> |
cerr << "done with idat\n"; |
| 576 |
> |
|
| 577 |
> |
topoDist = fDecomp_->getTopologicalDistance(atom1, atom2); |
| 578 |
> |
vdwMult = vdwScale_[topoDist]; |
| 579 |
> |
electroMult = electrostaticScale_[topoDist]; |
| 580 |
|
|
| 581 |
+ |
idat.vdwMult = &vdwMult; |
| 582 |
+ |
idat.electroMult = &electroMult; |
| 583 |
+ |
idat.pot = &pot; |
| 584 |
+ |
idat.vpair = &vpair; |
| 585 |
+ |
|
| 586 |
|
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
| 587 |
< |
*(idat.d) = d_grp; |
| 588 |
< |
*(idat.r2) = rgrpsq; |
| 587 |
> |
idat.d = &d_grp; |
| 588 |
> |
idat.r2 = &rgrpsq; |
| 589 |
|
} else { |
| 590 |
< |
*(idat.d) = fDecomp_->getInteratomicVector(atom1, atom2); |
| 591 |
< |
curSnapshot->wrapVector( *(idat.d) ); |
| 592 |
< |
*(idat.r2) = idat.d->lengthSquare(); |
| 590 |
> |
d = fDecomp_->getInteratomicVector(atom1, atom2); |
| 591 |
> |
curSnapshot->wrapVector( d ); |
| 592 |
> |
r2 = d.lengthSquare(); |
| 593 |
> |
idat.d = &d; |
| 594 |
> |
idat.r2 = &r2; |
| 595 |
|
} |
| 596 |
|
|
| 597 |
< |
*(idat.rij) = sqrt( *(idat.r2) ); |
| 597 |
> |
cerr << "d = " << d << "\n"; |
| 598 |
> |
cerr << "r2 = " << r2 << "\n"; |
| 599 |
> |
r = sqrt( r2 ); |
| 600 |
> |
idat.rij = &r; |
| 601 |
|
|
| 602 |
|
if (iLoop == PREPAIR_LOOP) { |
| 603 |
|
interactionMan_->doPrePair(idat); |
| 604 |
|
} else { |
| 605 |
+ |
cerr << "doing doPair " << atom1 << " " << atom2 << " " << r << "\n"; |
| 606 |
|
interactionMan_->doPair(idat); |
| 607 |
|
fDecomp_->unpackInteractionData(idat, atom1, atom2); |
| 608 |
|
vij += *(idat.vpair); |
| 689 |
|
|
| 690 |
|
for (int atom1 = 0; atom1 < fDecomp_->getNAtomsInRow(); atom1++) { |
| 691 |
|
|
| 692 |
< |
vector<int> skipList = fDecomp_->getSkipsForRowAtom( atom1 ); |
| 692 |
> |
vector<int> skipList = fDecomp_->getSkipsForAtom( atom1 ); |
| 693 |
|
|
| 694 |
|
for (vector<int>::iterator jb = skipList.begin(); |
| 695 |
|
jb != skipList.end(); ++jb) { |