| 449 |
|
Molecule::CutoffGroupIterator ci; |
| 450 |
|
CutoffGroup* cg; |
| 451 |
|
|
| 452 |
< |
// forces are zeroed here, before any are accumulated. |
| 452 |
> |
// forces and potentials are zeroed here, before any are |
| 453 |
> |
// accumulated. |
| 454 |
|
|
| 455 |
+ |
Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 456 |
+ |
|
| 457 |
+ |
snap->setBondPotential(0.0); |
| 458 |
+ |
snap->setBendPotential(0.0); |
| 459 |
+ |
snap->setTorsionPotential(0.0); |
| 460 |
+ |
snap->setInversionPotential(0.0); |
| 461 |
+ |
|
| 462 |
+ |
potVec zeroPot(0.0); |
| 463 |
+ |
snap->setLongRangePotential(zeroPot); |
| 464 |
+ |
snap->setExcludedPotentials(zeroPot); |
| 465 |
+ |
|
| 466 |
+ |
snap->setRestraintPotential(0.0); |
| 467 |
+ |
snap->setRawPotential(0.0); |
| 468 |
+ |
|
| 469 |
|
for (mol = info_->beginMolecule(mi); mol != NULL; |
| 470 |
|
mol = info_->nextMolecule(mi)) { |
| 471 |
|
for(atom = mol->beginAtom(ai); atom != NULL; |
| 601 |
|
} |
| 602 |
|
} |
| 603 |
|
} |
| 604 |
< |
|
| 605 |
< |
RealType shortRangePotential = bondPotential + bendPotential + |
| 606 |
< |
torsionPotential + inversionPotential; |
| 604 |
> |
|
| 605 |
> |
#ifdef IS_MPI |
| 606 |
> |
// Collect from all nodes. This should eventually be moved into a |
| 607 |
> |
// SystemDecomposition, but this is a better place than in |
| 608 |
> |
// Thermo to do the collection. |
| 609 |
> |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bondPotential, 1, MPI::REALTYPE, |
| 610 |
> |
MPI::SUM); |
| 611 |
> |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bendPotential, 1, MPI::REALTYPE, |
| 612 |
> |
MPI::SUM); |
| 613 |
> |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &torsionPotential, 1, |
| 614 |
> |
MPI::REALTYPE, MPI::SUM); |
| 615 |
> |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &inversionPotential, 1, |
| 616 |
> |
MPI::REALTYPE, MPI::SUM); |
| 617 |
> |
#endif |
| 618 |
> |
|
| 619 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 620 |
< |
curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] = shortRangePotential; |
| 621 |
< |
curSnapshot->statData[Stats::BOND_POTENTIAL] = bondPotential; |
| 622 |
< |
curSnapshot->statData[Stats::BEND_POTENTIAL] = bendPotential; |
| 623 |
< |
curSnapshot->statData[Stats::DIHEDRAL_POTENTIAL] = torsionPotential; |
| 624 |
< |
curSnapshot->statData[Stats::INVERSION_POTENTIAL] = inversionPotential; |
| 620 |
> |
|
| 621 |
> |
curSnapshot->setBondPotential(bondPotential); |
| 622 |
> |
curSnapshot->setBendPotential(bendPotential); |
| 623 |
> |
curSnapshot->setTorsionPotential(torsionPotential); |
| 624 |
> |
curSnapshot->setInversionPotential(inversionPotential); |
| 625 |
> |
|
| 626 |
> |
// RealType shortRangePotential = bondPotential + bendPotential + |
| 627 |
> |
// torsionPotential + inversionPotential; |
| 628 |
> |
|
| 629 |
> |
// curSnapshot->setShortRangePotential(shortRangePotential); |
| 630 |
|
} |
| 631 |
|
|
| 632 |
|
void ForceManager::longRangeInteractions() { |
| 675 |
|
InteractionData idat; |
| 676 |
|
SelfData sdat; |
| 677 |
|
RealType mf; |
| 646 |
– |
RealType lrPot; |
| 678 |
|
RealType vpair; |
| 679 |
|
RealType dVdFQ1(0.0); |
| 680 |
|
RealType dVdFQ2(0.0); |
| 681 |
|
potVec longRangePotential(0.0); |
| 682 |
|
potVec workPot(0.0); |
| 683 |
+ |
potVec exPot(0.0); |
| 684 |
|
vector<int>::iterator ia, jb; |
| 685 |
|
|
| 686 |
|
int loopStart, loopEnd; |
| 688 |
|
idat.vdwMult = &vdwMult; |
| 689 |
|
idat.electroMult = &electroMult; |
| 690 |
|
idat.pot = &workPot; |
| 691 |
+ |
idat.excludedPot = &exPot; |
| 692 |
|
sdat.pot = fDecomp_->getEmbeddingPotential(); |
| 693 |
+ |
sdat.excludedPot = fDecomp_->getExcludedSelfPotential(); |
| 694 |
|
idat.vpair = &vpair; |
| 695 |
|
idat.dVdFQ1 = &dVdFQ1; |
| 696 |
|
idat.dVdFQ2 = &dVdFQ2; |
| 738 |
|
|
| 739 |
|
in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, |
| 740 |
|
rgrp); |
| 741 |
+ |
|
| 742 |
|
atomListRow = fDecomp_->getAtomsInGroupRow(cg1); |
| 743 |
|
atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); |
| 744 |
|
|
| 753 |
|
jb != atomListColumn.end(); ++jb) { |
| 754 |
|
atom2 = (*jb); |
| 755 |
|
|
| 756 |
< |
if (!fDecomp_->skipAtomPair(atom1, atom2)) { |
| 756 |
> |
if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) { |
| 757 |
> |
|
| 758 |
|
vpair = 0.0; |
| 759 |
|
workPot = 0.0; |
| 760 |
+ |
exPot = 0.0; |
| 761 |
|
f1 = V3Zero; |
| 762 |
|
dVdFQ1 = 0.0; |
| 763 |
|
dVdFQ2 = 0.0; |
| 868 |
|
|
| 869 |
|
fDecomp_->collectIntermediateData(); |
| 870 |
|
|
| 871 |
< |
for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
| 871 |
> |
for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
| 872 |
|
fDecomp_->fillSelfData(sdat, atom1); |
| 873 |
|
interactionMan_->doPreForce(sdat); |
| 874 |
|
} |
| 879 |
|
} |
| 880 |
|
} |
| 881 |
|
|
| 882 |
+ |
// collects pairwise information |
| 883 |
|
fDecomp_->collectData(); |
| 884 |
|
|
| 885 |
|
if (info_->requiresSelfCorrection()) { |
| 886 |
< |
|
| 849 |
< |
for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
| 886 |
> |
for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
| 887 |
|
fDecomp_->fillSelfData(sdat, atom1); |
| 888 |
|
interactionMan_->doSelfCorrection(sdat); |
| 889 |
|
} |
| 853 |
– |
|
| 890 |
|
} |
| 891 |
|
|
| 892 |
+ |
// collects single-atom information |
| 893 |
+ |
fDecomp_->collectSelfData(); |
| 894 |
+ |
|
| 895 |
|
longRangePotential = *(fDecomp_->getEmbeddingPotential()) + |
| 896 |
|
*(fDecomp_->getPairwisePotential()); |
| 897 |
|
|
| 898 |
< |
lrPot = longRangePotential.sum(); |
| 898 |
> |
curSnapshot->setLongRangePotential(longRangePotential); |
| 899 |
> |
|
| 900 |
> |
curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedSelfPotential()) + |
| 901 |
> |
*(fDecomp_->getExcludedPotential())); |
| 902 |
|
|
| 861 |
– |
//store the stressTensor and long range potential |
| 862 |
– |
curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot; |
| 863 |
– |
curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VANDERWAALS_FAMILY]; |
| 864 |
– |
curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_FAMILY]; |
| 903 |
|
} |
| 904 |
|
|
| 905 |
|
|
| 909 |
|
Molecule::RigidBodyIterator rbIter; |
| 910 |
|
RigidBody* rb; |
| 911 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 912 |
< |
|
| 912 |
> |
|
| 913 |
|
// collect the atomic forces onto rigid bodies |
| 914 |
|
|
| 915 |
|
for (mol = info_->beginMolecule(mi); mol != NULL; |
| 922 |
|
} |
| 923 |
|
|
| 924 |
|
#ifdef IS_MPI |
| 887 |
– |
|
| 925 |
|
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, stressTensor.getArrayPointer(), 9, |
| 926 |
|
MPI::REALTYPE, MPI::SUM); |
| 927 |
|
#endif |