| 58 |  | #include "primitives/Inversion.hpp" | 
| 59 |  | #include "nonbonded/NonBondedInteraction.hpp" | 
| 60 |  | #include "perturbations/UniformField.hpp" | 
| 61 | + | #include "perturbations/UniformGradient.hpp" | 
| 62 |  | #include "parallel/ForceMatrixDecomposition.hpp" | 
| 63 |  |  | 
| 64 |  | #include <cstdio> | 
| 68 |  | using namespace std; | 
| 69 |  | namespace OpenMD { | 
| 70 |  |  | 
| 71 | < | ForceManager::ForceManager(SimInfo * info) : info_(info), switcher_(NULL), | 
| 72 | < | initialized_(false) { | 
| 71 | > | ForceManager::ForceManager(SimInfo * info) : info_(info), | 
| 72 | > | initialized_(false), | 
| 73 | > | switcher_(NULL) { | 
| 74 |  | forceField_ = info_->getForceField(); | 
| 75 |  | interactionMan_ = new InteractionManager(); | 
| 76 |  | fDecomp_ = new ForceMatrixDecomposition(info_, interactionMan_); | 
| 89 |  | /** | 
| 90 |  | * setupCutoffs | 
| 91 |  | * | 
| 92 | < | * Sets the values of cutoffRadius, switchingRadius, cutoffMethod, | 
| 91 | < | * and cutoffPolicy | 
| 92 | > | * Sets the values of cutoffRadius, switchingRadius, and cutoffMethod | 
| 93 |  | * | 
| 94 |  | * cutoffRadius : realType | 
| 95 |  | *  If the cutoffRadius was explicitly set, use that value. | 
| 104 |  | *      If cutoffMethod was explicitly set, use that choice. | 
| 105 |  | *      If cutoffMethod was not explicitly set, use SHIFTED_FORCE | 
| 106 |  | * | 
| 106 | – | * cutoffPolicy : (one of MIX, MAX, TRADITIONAL) | 
| 107 | – | *      If cutoffPolicy was explicitly set, use that choice. | 
| 108 | – | *      If cutoffPolicy was not explicitly set, use TRADITIONAL | 
| 109 | – | * | 
| 107 |  | * switchingRadius : realType | 
| 108 |  | *  If the cutoffMethod was set to SWITCHED: | 
| 109 |  | *      If the switchingRadius was explicitly set, use that value | 
| 160 |  | } | 
| 161 |  | } | 
| 162 |  |  | 
| 163 | < | fDecomp_->setUserCutoff(rCut_); | 
| 163 | > | fDecomp_->setCutoffRadius(rCut_); | 
| 164 |  | interactionMan_->setCutoffRadius(rCut_); | 
| 165 | + | rCutSq_ = rCut_ * rCut_; | 
| 166 |  |  | 
| 167 |  | map<string, CutoffMethod> stringToCutoffMethod; | 
| 168 |  | stringToCutoffMethod["HARD"] = HARD; | 
| 271 |  | } | 
| 272 |  | } | 
| 273 |  | } | 
| 276 | – | } | 
| 277 | – |  | 
| 278 | – | map<string, CutoffPolicy> stringToCutoffPolicy; | 
| 279 | – | stringToCutoffPolicy["MIX"] = MIX; | 
| 280 | – | stringToCutoffPolicy["MAX"] = MAX; | 
| 281 | – | stringToCutoffPolicy["TRADITIONAL"] = TRADITIONAL; | 
| 282 | – |  | 
| 283 | – | string cutPolicy; | 
| 284 | – | if (forceFieldOptions_.haveCutoffPolicy()){ | 
| 285 | – | cutPolicy = forceFieldOptions_.getCutoffPolicy(); | 
| 286 | – | }else if (simParams_->haveCutoffPolicy()) { | 
| 287 | – | cutPolicy = simParams_->getCutoffPolicy(); | 
| 274 |  | } | 
| 289 | – |  | 
| 290 | – | if (!cutPolicy.empty()){ | 
| 291 | – | toUpper(cutPolicy); | 
| 292 | – | map<string, CutoffPolicy>::iterator i; | 
| 293 | – | i = stringToCutoffPolicy.find(cutPolicy); | 
| 294 | – |  | 
| 295 | – | if (i == stringToCutoffPolicy.end()) { | 
| 296 | – | sprintf(painCave.errMsg, | 
| 297 | – | "ForceManager::setupCutoffs: Could not find chosen cutoffPolicy %s\n" | 
| 298 | – | "\tShould be one of: " | 
| 299 | – | "MIX, MAX, or TRADITIONAL\n", | 
| 300 | – | cutPolicy.c_str()); | 
| 301 | – | painCave.isFatal = 1; | 
| 302 | – | painCave.severity = OPENMD_ERROR; | 
| 303 | – | simError(); | 
| 304 | – | } else { | 
| 305 | – | cutoffPolicy_ = i->second; | 
| 306 | – | } | 
| 307 | – | } else { | 
| 308 | – | sprintf(painCave.errMsg, | 
| 309 | – | "ForceManager::setupCutoffs: No value was set for the cutoffPolicy.\n" | 
| 310 | – | "\tOpenMD will use TRADITIONAL.\n"); | 
| 311 | – | painCave.isFatal = 0; | 
| 312 | – | painCave.severity = OPENMD_INFO; | 
| 313 | – | simError(); | 
| 314 | – | cutoffPolicy_ = TRADITIONAL; | 
| 315 | – | } | 
| 316 | – |  | 
| 317 | – | fDecomp_->setCutoffPolicy(cutoffPolicy_); | 
| 275 |  |  | 
| 276 |  | // create the switching function object: | 
| 277 |  |  | 
| 351 |  | switcher_->setSwitch(rSwitch_, rCut_); | 
| 352 |  | } | 
| 353 |  |  | 
| 397 | – |  | 
| 398 | – |  | 
| 399 | – |  | 
| 354 |  | void ForceManager::initialize() { | 
| 355 |  |  | 
| 356 |  | if (!info_->isTopologyDone()) { | 
| 406 |  | UniformField* eField = new UniformField(info_); | 
| 407 |  | perturbations_.push_back(eField); | 
| 408 |  | } | 
| 409 | < |  | 
| 409 | > | if (info_->getSimParams()->haveUniformGradientStrength() || | 
| 410 | > | info_->getSimParams()->haveUniformGradientDirection1() || | 
| 411 | > | info_->getSimParams()->haveUniformGradientDirection2() ) { | 
| 412 | > | UniformGradient* eGrad = new UniformGradient(info_); | 
| 413 | > | perturbations_.push_back(eGrad); | 
| 414 | > | } | 
| 415 | > |  | 
| 416 |  | usePeriodicBoundaryConditions_ = info_->getSimParams()->getUsePeriodicBoundaryConditions(); | 
| 417 |  |  | 
| 418 |  | fDecomp_->distributeInitialData(); | 
| 628 |  | DataStorage* config = &(curSnapshot->atomData); | 
| 629 |  | DataStorage* cgConfig = &(curSnapshot->cgData); | 
| 630 |  |  | 
| 671 | – |  | 
| 631 |  | //calculate the center of mass of cutoff group | 
| 632 |  |  | 
| 633 |  | SimInfo::MoleculeIterator mi; | 
| 634 |  | Molecule* mol; | 
| 635 |  | Molecule::CutoffGroupIterator ci; | 
| 636 |  | CutoffGroup* cg; | 
| 637 | < |  | 
| 638 | < | if(info_->getNCutoffGroups() > 0){ | 
| 637 | > |  | 
| 638 | > | if(info_->getNCutoffGroups() != info_->getNAtoms()){ | 
| 639 |  | for (mol = info_->beginMolecule(mi); mol != NULL; | 
| 640 |  | mol = info_->nextMolecule(mi)) { | 
| 641 |  | for(cg = mol->beginCutoffGroup(ci); cg != NULL; | 
| 659 |  | RealType electroMult, vdwMult; | 
| 660 |  | RealType vij; | 
| 661 |  | Vector3d fij, fg, f1; | 
| 703 | – | tuple3<RealType, RealType, RealType> cuts; | 
| 704 | – | RealType rCut, rCutSq, rListSq; | 
| 662 |  | bool in_switching_region; | 
| 663 |  | RealType sw, dswdr, swderiv; | 
| 664 |  | vector<int> atomListColumn, atomListRow; | 
| 676 |  | Vector3d eField2(0.0); | 
| 677 |  | RealType sPot1(0.0); | 
| 678 |  | RealType sPot2(0.0); | 
| 679 | + | bool newAtom1; | 
| 680 |  |  | 
| 681 |  | vector<int>::iterator ia, jb; | 
| 682 |  |  | 
| 683 |  | int loopStart, loopEnd; | 
| 684 |  |  | 
| 685 | < | idat.rcut = &rCut; | 
| 685 | > | idat.rcut = &rCut_; | 
| 686 |  | idat.vdwMult = &vdwMult; | 
| 687 |  | idat.electroMult = &electroMult; | 
| 688 |  | idat.pot = &workPot; | 
| 699 |  | idat.f1 = &f1; | 
| 700 |  | idat.sw = &sw; | 
| 701 |  | idat.shiftedPot = (cutoffMethod_ == SHIFTED_POTENTIAL) ? true : false; | 
| 702 | < | idat.shiftedForce = (cutoffMethod_ == SHIFTED_FORCE || cutoffMethod_ == TAYLOR_SHIFTED) ? true : false; | 
| 702 | > | idat.shiftedForce = (cutoffMethod_ == SHIFTED_FORCE || | 
| 703 | > | cutoffMethod_ == TAYLOR_SHIFTED) ? true : false; | 
| 704 |  | idat.doParticlePot = doParticlePot_; | 
| 705 |  | idat.doElectricField = doElectricField_; | 
| 706 |  | idat.doSitePotential = doSitePotential_; | 
| 719 |  | if (update_nlist) { | 
| 720 |  | if (!usePeriodicBoundaryConditions_) | 
| 721 |  | Mat3x3d bbox = thermo->getBoundingBox(); | 
| 722 | < | fDecomp_->buildNeighborList(neighborList_); | 
| 722 | > | fDecomp_->buildNeighborList(neighborList_, point_); | 
| 723 |  | } | 
| 724 |  | } | 
| 725 |  |  | 
| 726 | < | for (vector<pair<int, int> >::iterator it = neighborList_.begin(); | 
| 768 | < | it != neighborList_.end(); ++it) { | 
| 769 | < |  | 
| 770 | < | cg1 = (*it).first; | 
| 771 | < | cg2 = (*it).second; | 
| 726 | > | for (cg1 = 0; cg1 < point_.size() - 1; cg1++) { | 
| 727 |  |  | 
| 728 | < | fDecomp_->getGroupCutoffs(cg1, cg2, rCut, rCutSq, rListSq); | 
| 729 | < |  | 
| 730 | < | d_grp  = fDecomp_->getIntergroupVector(cg1, cg2); | 
| 731 | < |  | 
| 777 | < | // already wrapped in the getIntergroupVector call: | 
| 778 | < | // curSnapshot->wrapVector(d_grp); | 
| 779 | < | rgrpsq = d_grp.lengthSquare(); | 
| 780 | < |  | 
| 781 | < | if (rgrpsq < rCutSq) { | 
| 782 | < | if (iLoop == PAIR_LOOP) { | 
| 783 | < | vij = 0.0; | 
| 784 | < | fij.zero(); | 
| 785 | < | eField1.zero(); | 
| 786 | < | eField2.zero(); | 
| 787 | < | sPot1 = 0.0; | 
| 788 | < | sPot2 = 0.0; | 
| 789 | < | } | 
| 790 | < |  | 
| 791 | < | in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, | 
| 792 | < | rgrp); | 
| 728 | > | atomListRow = fDecomp_->getAtomsInGroupRow(cg1); | 
| 729 | > | newAtom1 = true; | 
| 730 | > |  | 
| 731 | > | for (int m2 = point_[cg1]; m2 < point_[cg1+1]; m2++) { | 
| 732 |  |  | 
| 733 | < | atomListRow = fDecomp_->getAtomsInGroupRow(cg1); | 
| 734 | < | atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); | 
| 735 | < |  | 
| 736 | < | if (doHeatFlux_) | 
| 737 | < | gvel2 = fDecomp_->getGroupVelocityColumn(cg2); | 
| 738 | < |  | 
| 739 | < | for (ia = atomListRow.begin(); | 
| 740 | < | ia != atomListRow.end(); ++ia) { | 
| 741 | < | atom1 = (*ia); | 
| 742 | < |  | 
| 743 | < | for (jb = atomListColumn.begin(); | 
| 744 | < | jb != atomListColumn.end(); ++jb) { | 
| 745 | < | atom2 = (*jb); | 
| 746 | < |  | 
| 747 | < | if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) { | 
| 748 | < |  | 
| 749 | < | vpair = 0.0; | 
| 750 | < | workPot = 0.0; | 
| 751 | < | exPot = 0.0; | 
| 752 | < | f1.zero(); | 
| 753 | < | dVdFQ1 = 0.0; | 
| 754 | < | dVdFQ2 = 0.0; | 
| 755 | < |  | 
| 756 | < | fDecomp_->fillInteractionData(idat, atom1, atom2); | 
| 757 | < |  | 
| 758 | < | topoDist = fDecomp_->getTopologicalDistance(atom1, atom2); | 
| 759 | < | vdwMult = vdwScale_[topoDist]; | 
| 760 | < | electroMult = electrostaticScale_[topoDist]; | 
| 761 | < |  | 
| 762 | < | if (atomListRow.size() == 1 && atomListColumn.size() == 1) { | 
| 763 | < | idat.d = &d_grp; | 
| 764 | < | idat.r2 = &rgrpsq; | 
| 765 | < | if (doHeatFlux_) | 
| 766 | < | vel2 = gvel2; | 
| 767 | < | } else { | 
| 768 | < | d = fDecomp_->getInteratomicVector(atom1, atom2); | 
| 769 | < | curSnapshot->wrapVector( d ); | 
| 770 | < | r2 = d.lengthSquare(); | 
| 771 | < | idat.d = &d; | 
| 772 | < | idat.r2 = &r2; | 
| 773 | < | if (doHeatFlux_) | 
| 774 | < | vel2 = fDecomp_->getAtomVelocityColumn(atom2); | 
| 775 | < | } | 
| 776 | < |  | 
| 777 | < | r = sqrt( *(idat.r2) ); | 
| 778 | < | idat.rij = &r; | 
| 779 | < |  | 
| 780 | < | if (iLoop == PREPAIR_LOOP) { | 
| 781 | < | interactionMan_->doPrePair(idat); | 
| 782 | < | } else { | 
| 783 | < | interactionMan_->doPair(idat); | 
| 784 | < | fDecomp_->unpackInteractionData(idat, atom1, atom2); | 
| 785 | < | vij += vpair; | 
| 786 | < | fij += f1; | 
| 787 | < | stressTensor -= outProduct( *(idat.d), f1); | 
| 788 | < | if (doHeatFlux_) | 
| 789 | < | fDecomp_->addToHeatFlux(*(idat.d) * dot(f1, vel2)); | 
| 733 | > | cg2 = neighborList_[m2]; | 
| 734 | > |  | 
| 735 | > | d_grp  = fDecomp_->getIntergroupVector(cg1, cg2); | 
| 736 | > |  | 
| 737 | > | // already wrapped in the getIntergroupVector call: | 
| 738 | > | // curSnapshot->wrapVector(d_grp); | 
| 739 | > | rgrpsq = d_grp.lengthSquare(); | 
| 740 | > |  | 
| 741 | > | if (rgrpsq < rCutSq_) { | 
| 742 | > | if (iLoop == PAIR_LOOP) { | 
| 743 | > | vij = 0.0; | 
| 744 | > | fij.zero(); | 
| 745 | > | eField1.zero(); | 
| 746 | > | eField2.zero(); | 
| 747 | > | sPot1 = 0.0; | 
| 748 | > | sPot2 = 0.0; | 
| 749 | > | } | 
| 750 | > |  | 
| 751 | > | in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, | 
| 752 | > | rgrp); | 
| 753 | > |  | 
| 754 | > | atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); | 
| 755 | > |  | 
| 756 | > | if (doHeatFlux_) | 
| 757 | > | gvel2 = fDecomp_->getGroupVelocityColumn(cg2); | 
| 758 | > |  | 
| 759 | > | for (ia = atomListRow.begin(); | 
| 760 | > | ia != atomListRow.end(); ++ia) { | 
| 761 | > | atom1 = (*ia); | 
| 762 | > |  | 
| 763 | > | for (jb = atomListColumn.begin(); | 
| 764 | > | jb != atomListColumn.end(); ++jb) { | 
| 765 | > | atom2 = (*jb); | 
| 766 | > |  | 
| 767 | > | if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) { | 
| 768 | > |  | 
| 769 | > | vpair = 0.0; | 
| 770 | > | workPot = 0.0; | 
| 771 | > | exPot = 0.0; | 
| 772 | > | f1.zero(); | 
| 773 | > | dVdFQ1 = 0.0; | 
| 774 | > | dVdFQ2 = 0.0; | 
| 775 | > |  | 
| 776 | > | fDecomp_->fillInteractionData(idat, atom1, atom2, newAtom1); | 
| 777 | > |  | 
| 778 | > | topoDist = fDecomp_->getTopologicalDistance(atom1, atom2); | 
| 779 | > | vdwMult = vdwScale_[topoDist]; | 
| 780 | > | electroMult = electrostaticScale_[topoDist]; | 
| 781 | > |  | 
| 782 | > | if (atomListRow.size() == 1 && atomListColumn.size() == 1) { | 
| 783 | > | idat.d = &d_grp; | 
| 784 | > | idat.r2 = &rgrpsq; | 
| 785 | > | if (doHeatFlux_) | 
| 786 | > | vel2 = gvel2; | 
| 787 | > | } else { | 
| 788 | > | d = fDecomp_->getInteratomicVector(atom1, atom2); | 
| 789 | > | curSnapshot->wrapVector( d ); | 
| 790 | > | r2 = d.lengthSquare(); | 
| 791 | > | idat.d = &d; | 
| 792 | > | idat.r2 = &r2; | 
| 793 | > | if (doHeatFlux_) | 
| 794 | > | vel2 = fDecomp_->getAtomVelocityColumn(atom2); | 
| 795 | > | } | 
| 796 | > |  | 
| 797 | > | r = sqrt( *(idat.r2) ); | 
| 798 | > | idat.rij = &r; | 
| 799 | > |  | 
| 800 | > | if (iLoop == PREPAIR_LOOP) { | 
| 801 | > | interactionMan_->doPrePair(idat); | 
| 802 | > | } else { | 
| 803 | > | interactionMan_->doPair(idat); | 
| 804 | > | fDecomp_->unpackInteractionData(idat, atom1, atom2); | 
| 805 | > | vij += vpair; | 
| 806 | > | fij += f1; | 
| 807 | > | stressTensor -= outProduct( *(idat.d), f1); | 
| 808 | > | if (doHeatFlux_) | 
| 809 | > | fDecomp_->addToHeatFlux(*(idat.d) * dot(f1, vel2)); | 
| 810 | > | } | 
| 811 |  | } | 
| 812 |  | } | 
| 813 |  | } | 
| 814 | < | } | 
| 815 | < |  | 
| 816 | < | if (iLoop == PAIR_LOOP) { | 
| 817 | < | if (in_switching_region) { | 
| 818 | < | swderiv = vij * dswdr / rgrp; | 
| 819 | < | fg = swderiv * d_grp; | 
| 820 | < | fij += fg; | 
| 821 | < |  | 
| 822 | < | if (atomListRow.size() == 1 && atomListColumn.size() == 1) { | 
| 823 | < | if (!fDecomp_->skipAtomPair(atomListRow[0], | 
| 824 | < | atomListColumn[0], | 
| 865 | < | cg1, cg2)) { | 
| 814 | > |  | 
| 815 | > | if (iLoop == PAIR_LOOP) { | 
| 816 | > | if (in_switching_region) { | 
| 817 | > | swderiv = vij * dswdr / rgrp; | 
| 818 | > | fg = swderiv * d_grp; | 
| 819 | > | fij += fg; | 
| 820 | > |  | 
| 821 | > | if (atomListRow.size() == 1 && atomListColumn.size() == 1) { | 
| 822 | > | if (!fDecomp_->skipAtomPair(atomListRow[0], | 
| 823 | > | atomListColumn[0], | 
| 824 | > | cg1, cg2)) { | 
| 825 |  | stressTensor -= outProduct( *(idat.d), fg); | 
| 826 |  | if (doHeatFlux_) | 
| 827 |  | fDecomp_->addToHeatFlux(*(idat.d) * dot(fg, vel2)); | 
| 828 | < | } | 
| 829 | < | } | 
| 830 | < |  | 
| 831 | < | for (ia = atomListRow.begin(); | 
| 832 | < | ia != atomListRow.end(); ++ia) { | 
| 833 | < | atom1 = (*ia); | 
| 834 | < | mf = fDecomp_->getMassFactorRow(atom1); | 
| 835 | < | // fg is the force on atom ia due to cutoff group's | 
| 836 | < | // presence in switching region | 
| 837 | < | fg = swderiv * d_grp * mf; | 
| 838 | < | fDecomp_->addForceToAtomRow(atom1, fg); | 
| 839 | < | if (atomListRow.size() > 1) { | 
| 840 | < | if (info_->usesAtomicVirial()) { | 
| 841 | < | // find the distance between the atom | 
| 842 | < | // and the center of the cutoff group: | 
| 843 | < | dag = fDecomp_->getAtomToGroupVectorRow(atom1, cg1); | 
| 844 | < | stressTensor -= outProduct(dag, fg); | 
| 845 | < | if (doHeatFlux_) | 
| 846 | < | fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); | 
| 828 | > | } | 
| 829 | > | } | 
| 830 | > |  | 
| 831 | > | for (ia = atomListRow.begin(); | 
| 832 | > | ia != atomListRow.end(); ++ia) { | 
| 833 | > | atom1 = (*ia); | 
| 834 | > | mf = fDecomp_->getMassFactorRow(atom1); | 
| 835 | > | // fg is the force on atom ia due to cutoff group's | 
| 836 | > | // presence in switching region | 
| 837 | > | fg = swderiv * d_grp * mf; | 
| 838 | > | fDecomp_->addForceToAtomRow(atom1, fg); | 
| 839 | > | if (atomListRow.size() > 1) { | 
| 840 | > | if (info_->usesAtomicVirial()) { | 
| 841 | > | // find the distance between the atom | 
| 842 | > | // and the center of the cutoff group: | 
| 843 | > | dag = fDecomp_->getAtomToGroupVectorRow(atom1, cg1); | 
| 844 | > | stressTensor -= outProduct(dag, fg); | 
| 845 | > | if (doHeatFlux_) | 
| 846 | > | fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); | 
| 847 | > | } | 
| 848 |  | } | 
| 849 |  | } | 
| 850 | < | } | 
| 851 | < | for (jb = atomListColumn.begin(); | 
| 852 | < | jb != atomListColumn.end(); ++jb) { | 
| 853 | < | atom2 = (*jb); | 
| 854 | < | mf = fDecomp_->getMassFactorColumn(atom2); | 
| 855 | < | // fg is the force on atom jb due to cutoff group's | 
| 856 | < | // presence in switching region | 
| 857 | < | fg = -swderiv * d_grp * mf; | 
| 858 | < | fDecomp_->addForceToAtomColumn(atom2, fg); | 
| 859 | < |  | 
| 860 | < | if (atomListColumn.size() > 1) { | 
| 861 | < | if (info_->usesAtomicVirial()) { | 
| 862 | < | // find the distance between the atom | 
| 863 | < | // and the center of the cutoff group: | 
| 864 | < | dag = fDecomp_->getAtomToGroupVectorColumn(atom2, cg2); | 
| 865 | < | stressTensor -= outProduct(dag, fg); | 
| 866 | < | if (doHeatFlux_) | 
| 867 | < | fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); | 
| 850 | > | for (jb = atomListColumn.begin(); | 
| 851 | > | jb != atomListColumn.end(); ++jb) { | 
| 852 | > | atom2 = (*jb); | 
| 853 | > | mf = fDecomp_->getMassFactorColumn(atom2); | 
| 854 | > | // fg is the force on atom jb due to cutoff group's | 
| 855 | > | // presence in switching region | 
| 856 | > | fg = -swderiv * d_grp * mf; | 
| 857 | > | fDecomp_->addForceToAtomColumn(atom2, fg); | 
| 858 | > |  | 
| 859 | > | if (atomListColumn.size() > 1) { | 
| 860 | > | if (info_->usesAtomicVirial()) { | 
| 861 | > | // find the distance between the atom | 
| 862 | > | // and the center of the cutoff group: | 
| 863 | > | dag = fDecomp_->getAtomToGroupVectorColumn(atom2, cg2); | 
| 864 | > | stressTensor -= outProduct(dag, fg); | 
| 865 | > | if (doHeatFlux_) | 
| 866 | > | fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); | 
| 867 | > | } | 
| 868 |  | } | 
| 869 |  | } | 
| 870 |  | } | 
| 871 | + | //if (!info_->usesAtomicVirial()) { | 
| 872 | + | //  stressTensor -= outProduct(d_grp, fij); | 
| 873 | + | //  if (doHeatFlux_) | 
| 874 | + | //     fDecomp_->addToHeatFlux( d_grp * dot(fij, vel2)); | 
| 875 | + | //} | 
| 876 |  | } | 
| 912 | – | //if (!info_->usesAtomicVirial()) { | 
| 913 | – | //  stressTensor -= outProduct(d_grp, fij); | 
| 914 | – | //  if (doHeatFlux_) | 
| 915 | – | //     fDecomp_->addToHeatFlux( d_grp * dot(fij, vel2)); | 
| 916 | – | //} | 
| 877 |  | } | 
| 878 |  | } | 
| 879 | + | newAtom1 = false; | 
| 880 |  | } | 
| 881 | < |  | 
| 881 | > |  | 
| 882 |  | if (iLoop == PREPAIR_LOOP) { | 
| 883 |  | if (info_->requiresPrepair()) { | 
| 884 | < |  | 
| 884 | > |  | 
| 885 |  | fDecomp_->collectIntermediateData(); | 
| 886 | < |  | 
| 886 | > |  | 
| 887 |  | for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { | 
| 888 |  | fDecomp_->fillSelfData(sdat, atom1); | 
| 889 |  | interactionMan_->doPreForce(sdat); | 
| 890 |  | } | 
| 891 | < |  | 
| 891 | > |  | 
| 892 |  | fDecomp_->distributeIntermediateData(); | 
| 893 | < |  | 
| 893 | > |  | 
| 894 |  | } | 
| 895 |  | } | 
| 896 |  | } | 
| 919 |  | curSnapshot->setLongRangePotential(longRangePotential); | 
| 920 |  |  | 
| 921 |  | curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedSelfPotential()) + | 
| 922 | < | *(fDecomp_->getExcludedPotential())); | 
| 922 | > | *(fDecomp_->getExcludedPotential())); | 
| 923 |  |  | 
| 924 |  | } | 
| 925 |  |  | 
| 955 |  |  | 
| 956 |  | if (info_->getSimParams()->getUseLongRangeCorrections()) { | 
| 957 |  | /* | 
| 958 | < | RealType vol = curSnapshot->getVolume(); | 
| 959 | < | RealType Elrc(0.0); | 
| 960 | < | RealType Wlrc(0.0); | 
| 958 | > | RealType vol = curSnapshot->getVolume(); | 
| 959 | > | RealType Elrc(0.0); | 
| 960 | > | RealType Wlrc(0.0); | 
| 961 |  |  | 
| 962 | < | set<AtomType*>::iterator i; | 
| 963 | < | set<AtomType*>::iterator j; | 
| 962 | > | set<AtomType*>::iterator i; | 
| 963 | > | set<AtomType*>::iterator j; | 
| 964 |  |  | 
| 965 | < | RealType n_i, n_j; | 
| 966 | < | RealType rho_i, rho_j; | 
| 967 | < | pair<RealType, RealType> LRI; | 
| 965 | > | RealType n_i, n_j; | 
| 966 | > | RealType rho_i, rho_j; | 
| 967 | > | pair<RealType, RealType> LRI; | 
| 968 |  |  | 
| 969 | < | for (i = atomTypes_.begin(); i != atomTypes_.end(); ++i) { | 
| 969 | > | for (i = atomTypes_.begin(); i != atomTypes_.end(); ++i) { | 
| 970 |  | n_i = RealType(info_->getGlobalCountOfType(*i)); | 
| 971 |  | rho_i = n_i /  vol; | 
| 972 |  | for (j = atomTypes_.begin(); j != atomTypes_.end(); ++j) { | 
| 973 | < | n_j = RealType(info_->getGlobalCountOfType(*j)); | 
| 974 | < | rho_j = n_j / vol; | 
| 973 | > | n_j = RealType(info_->getGlobalCountOfType(*j)); | 
| 974 | > | rho_j = n_j / vol; | 
| 975 |  |  | 
| 976 | < | LRI = interactionMan_->getLongRangeIntegrals( (*i), (*j) ); | 
| 976 | > | LRI = interactionMan_->getLongRangeIntegrals( (*i), (*j) ); | 
| 977 |  |  | 
| 978 | < | Elrc += n_i   * rho_j * LRI.first; | 
| 979 | < | Wlrc -= rho_i * rho_j * LRI.second; | 
| 978 | > | Elrc += n_i   * rho_j * LRI.first; | 
| 979 | > | Wlrc -= rho_i * rho_j * LRI.second; | 
| 980 |  | } | 
| 981 | < | } | 
| 982 | < | Elrc *= 2.0 * NumericConstant::PI; | 
| 983 | < | Wlrc *= 2.0 * NumericConstant::PI; | 
| 981 | > | } | 
| 982 | > | Elrc *= 2.0 * NumericConstant::PI; | 
| 983 | > | Wlrc *= 2.0 * NumericConstant::PI; | 
| 984 |  |  | 
| 985 | < | RealType lrp = curSnapshot->getLongRangePotential(); | 
| 986 | < | curSnapshot->setLongRangePotential(lrp + Elrc); | 
| 987 | < | stressTensor += Wlrc * SquareMatrix3<RealType>::identity(); | 
| 988 | < | curSnapshot->setStressTensor(stressTensor); | 
| 985 | > | RealType lrp = curSnapshot->getLongRangePotential(); | 
| 986 | > | curSnapshot->setLongRangePotential(lrp + Elrc); | 
| 987 | > | stressTensor += Wlrc * SquareMatrix3<RealType>::identity(); | 
| 988 | > | curSnapshot->setStressTensor(stressTensor); | 
| 989 |  | */ | 
| 990 |  |  | 
| 991 |  | } |