57 |
|
#include "primitives/Torsion.hpp" |
58 |
|
#include "primitives/Inversion.hpp" |
59 |
|
#include "nonbonded/NonBondedInteraction.hpp" |
60 |
< |
#include "perturbations/ElectricField.hpp" |
60 |
> |
#include "perturbations/UniformField.hpp" |
61 |
> |
#include "perturbations/UniformGradient.hpp" |
62 |
|
#include "parallel/ForceMatrixDecomposition.hpp" |
63 |
|
|
64 |
|
#include <cstdio> |
88 |
|
/** |
89 |
|
* setupCutoffs |
90 |
|
* |
91 |
< |
* Sets the values of cutoffRadius, switchingRadius, cutoffMethod, |
91 |
< |
* and cutoffPolicy |
91 |
> |
* Sets the values of cutoffRadius, switchingRadius, and cutoffMethod |
92 |
|
* |
93 |
|
* cutoffRadius : realType |
94 |
|
* If the cutoffRadius was explicitly set, use that value. |
102 |
|
* SHIFTED_POTENTIAL, or EWALD_FULL) |
103 |
|
* If cutoffMethod was explicitly set, use that choice. |
104 |
|
* If cutoffMethod was not explicitly set, use SHIFTED_FORCE |
105 |
– |
* |
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 |
105 |
|
* |
106 |
|
* switchingRadius : realType |
107 |
|
* If the cutoffMethod was set to SWITCHED: |
159 |
|
} |
160 |
|
} |
161 |
|
|
162 |
< |
fDecomp_->setUserCutoff(rCut_); |
162 |
> |
fDecomp_->setCutoffRadius(rCut_); |
163 |
|
interactionMan_->setCutoffRadius(rCut_); |
164 |
+ |
rCutSq_ = rCut_ * rCut_; |
165 |
|
|
166 |
|
map<string, CutoffMethod> stringToCutoffMethod; |
167 |
|
stringToCutoffMethod["HARD"] = HARD; |
270 |
|
} |
271 |
|
} |
272 |
|
} |
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(); |
273 |
|
} |
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_); |
274 |
|
|
275 |
|
// create the switching function object: |
276 |
|
|
350 |
|
switcher_->setSwitch(rSwitch_, rCut_); |
351 |
|
} |
352 |
|
|
397 |
– |
|
398 |
– |
|
399 |
– |
|
353 |
|
void ForceManager::initialize() { |
354 |
|
|
355 |
|
if (!info_->isTopologyDone()) { |
358 |
|
interactionMan_->setSimInfo(info_); |
359 |
|
interactionMan_->initialize(); |
360 |
|
|
361 |
< |
// We want to delay the cutoffs until after the interaction |
362 |
< |
// manager has set up the atom-atom interactions so that we can |
363 |
< |
// query them for suggested cutoff values |
361 |
> |
//! We want to delay the cutoffs until after the interaction |
362 |
> |
//! manager has set up the atom-atom interactions so that we can |
363 |
> |
//! query them for suggested cutoff values |
364 |
|
setupCutoffs(); |
365 |
|
|
366 |
|
info_->prepareTopology(); |
376 |
|
|
377 |
|
ForceFieldOptions& fopts = forceField_->getForceFieldOptions(); |
378 |
|
|
379 |
< |
// Force fields can set options on how to scale van der Waals and |
380 |
< |
// electrostatic interactions for atoms connected via bonds, bends |
381 |
< |
// and torsions in this case the topological distance between |
382 |
< |
// atoms is: |
383 |
< |
// 0 = topologically unconnected |
384 |
< |
// 1 = bonded together |
385 |
< |
// 2 = connected via a bend |
386 |
< |
// 3 = connected via a torsion |
379 |
> |
//! Force fields can set options on how to scale van der Waals and |
380 |
> |
//! electrostatic interactions for atoms connected via bonds, bends |
381 |
> |
//! and torsions in this case the topological distance between |
382 |
> |
//! atoms is: |
383 |
> |
//! 0 = topologically unconnected |
384 |
> |
//! 1 = bonded together |
385 |
> |
//! 2 = connected via a bend |
386 |
> |
//! 3 = connected via a torsion |
387 |
|
|
388 |
|
vdwScale_.reserve(4); |
389 |
|
fill(vdwScale_.begin(), vdwScale_.end(), 0.0); |
401 |
|
electrostaticScale_[2] = fopts.getelectrostatic13scale(); |
402 |
|
electrostaticScale_[3] = fopts.getelectrostatic14scale(); |
403 |
|
|
404 |
< |
if (info_->getSimParams()->haveElectricField()) { |
405 |
< |
ElectricField* eField = new ElectricField(info_); |
404 |
> |
if (info_->getSimParams()->haveUniformField()) { |
405 |
> |
UniformField* eField = new UniformField(info_); |
406 |
|
perturbations_.push_back(eField); |
407 |
|
} |
408 |
< |
|
408 |
> |
if (info_->getSimParams()->haveUniformGradientStrength() || |
409 |
> |
info_->getSimParams()->haveUniformGradientDirection1() || |
410 |
> |
info_->getSimParams()->haveUniformGradientDirection2() ) { |
411 |
> |
UniformGradient* eGrad = new UniformGradient(info_); |
412 |
> |
perturbations_.push_back(eGrad); |
413 |
> |
} |
414 |
> |
|
415 |
|
usePeriodicBoundaryConditions_ = info_->getSimParams()->getUsePeriodicBoundaryConditions(); |
416 |
|
|
417 |
|
fDecomp_->distributeInitialData(); |
626 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
627 |
|
DataStorage* config = &(curSnapshot->atomData); |
628 |
|
DataStorage* cgConfig = &(curSnapshot->cgData); |
629 |
+ |
int jstart, jend; |
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; |
678 |
|
Vector3d eField2(0.0); |
679 |
|
RealType sPot1(0.0); |
680 |
|
RealType sPot2(0.0); |
681 |
+ |
bool newAtom1; |
682 |
|
|
683 |
|
vector<int>::iterator ia, jb; |
684 |
|
|
685 |
|
int loopStart, loopEnd; |
686 |
|
|
687 |
< |
idat.rcut = &rCut; |
687 |
> |
idat.rcut = &rCut_; |
688 |
|
idat.vdwMult = &vdwMult; |
689 |
|
idat.electroMult = &electroMult; |
690 |
|
idat.pot = &workPot; |
701 |
|
idat.f1 = &f1; |
702 |
|
idat.sw = &sw; |
703 |
|
idat.shiftedPot = (cutoffMethod_ == SHIFTED_POTENTIAL) ? true : false; |
704 |
< |
idat.shiftedForce = (cutoffMethod_ == SHIFTED_FORCE || cutoffMethod_ == TAYLOR_SHIFTED) ? true : false; |
704 |
> |
idat.shiftedForce = (cutoffMethod_ == SHIFTED_FORCE || |
705 |
> |
cutoffMethod_ == TAYLOR_SHIFTED) ? true : false; |
706 |
|
idat.doParticlePot = doParticlePot_; |
707 |
|
idat.doElectricField = doElectricField_; |
708 |
|
idat.doSitePotential = doSitePotential_; |
721 |
|
if (update_nlist) { |
722 |
|
if (!usePeriodicBoundaryConditions_) |
723 |
|
Mat3x3d bbox = thermo->getBoundingBox(); |
724 |
< |
fDecomp_->buildNeighborList(neighborList_); |
724 |
> |
fDecomp_->buildNeighborList(neighborList_, point_); |
725 |
|
} |
726 |
|
} |
727 |
|
|
728 |
< |
for (vector<pair<int, int> >::iterator it = neighborList_.begin(); |
768 |
< |
it != neighborList_.end(); ++it) { |
769 |
< |
|
770 |
< |
cg1 = (*it).first; |
771 |
< |
cg2 = (*it).second; |
728 |
> |
for (unsigned int cg1 = 0; cg1 < point_.size() - 1; cg1++) { |
729 |
|
|
730 |
< |
fDecomp_->getGroupCutoffs(cg1, cg2, rCut, rCutSq, rListSq); |
730 |
> |
atomListRow = fDecomp_->getAtomsInGroupRow(cg1); |
731 |
> |
newAtom1 = true; |
732 |
> |
|
733 |
> |
for (int m2 = point_[cg1]; m2 < point_[cg1+1]; m2++) { |
734 |
|
|
735 |
< |
d_grp = fDecomp_->getIntergroupVector(cg1, cg2); |
776 |
< |
|
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 |
< |
} |
735 |
> |
cg2 = neighborList_[m2]; |
736 |
|
|
737 |
< |
in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, |
738 |
< |
rgrp); |
739 |
< |
|
740 |
< |
atomListRow = fDecomp_->getAtomsInGroupRow(cg1); |
741 |
< |
atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); |
742 |
< |
|
743 |
< |
if (doHeatFlux_) |
744 |
< |
gvel2 = fDecomp_->getGroupVelocityColumn(cg2); |
745 |
< |
|
746 |
< |
for (ia = atomListRow.begin(); |
747 |
< |
ia != atomListRow.end(); ++ia) { |
748 |
< |
atom1 = (*ia); |
749 |
< |
|
750 |
< |
for (jb = atomListColumn.begin(); |
751 |
< |
jb != atomListColumn.end(); ++jb) { |
752 |
< |
atom2 = (*jb); |
753 |
< |
|
754 |
< |
if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) { |
755 |
< |
|
756 |
< |
vpair = 0.0; |
757 |
< |
workPot = 0.0; |
758 |
< |
exPot = 0.0; |
759 |
< |
f1.zero(); |
760 |
< |
dVdFQ1 = 0.0; |
761 |
< |
dVdFQ2 = 0.0; |
762 |
< |
|
763 |
< |
fDecomp_->fillInteractionData(idat, atom1, atom2); |
764 |
< |
|
765 |
< |
topoDist = fDecomp_->getTopologicalDistance(atom1, atom2); |
766 |
< |
vdwMult = vdwScale_[topoDist]; |
767 |
< |
electroMult = electrostaticScale_[topoDist]; |
768 |
< |
|
769 |
< |
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
770 |
< |
idat.d = &d_grp; |
771 |
< |
idat.r2 = &rgrpsq; |
772 |
< |
if (doHeatFlux_) |
773 |
< |
vel2 = gvel2; |
774 |
< |
} else { |
775 |
< |
d = fDecomp_->getInteratomicVector(atom1, atom2); |
776 |
< |
curSnapshot->wrapVector( d ); |
777 |
< |
r2 = d.lengthSquare(); |
778 |
< |
idat.d = &d; |
779 |
< |
idat.r2 = &r2; |
780 |
< |
if (doHeatFlux_) |
781 |
< |
vel2 = fDecomp_->getAtomVelocityColumn(atom2); |
782 |
< |
} |
783 |
< |
|
784 |
< |
r = sqrt( *(idat.r2) ); |
785 |
< |
idat.rij = &r; |
786 |
< |
|
787 |
< |
if (iLoop == PREPAIR_LOOP) { |
788 |
< |
interactionMan_->doPrePair(idat); |
789 |
< |
} else { |
790 |
< |
interactionMan_->doPair(idat); |
791 |
< |
fDecomp_->unpackInteractionData(idat, atom1, atom2); |
792 |
< |
vij += vpair; |
793 |
< |
fij += f1; |
794 |
< |
stressTensor -= outProduct( *(idat.d), f1); |
795 |
< |
if (doHeatFlux_) |
796 |
< |
fDecomp_->addToHeatFlux(*(idat.d) * dot(f1, vel2)); |
737 |
> |
d_grp = fDecomp_->getIntergroupVector(cg1, cg2); |
738 |
> |
|
739 |
> |
// already wrapped in the getIntergroupVector call: |
740 |
> |
// curSnapshot->wrapVector(d_grp); |
741 |
> |
rgrpsq = d_grp.lengthSquare(); |
742 |
> |
|
743 |
> |
if (rgrpsq < rCutSq_) { |
744 |
> |
if (iLoop == PAIR_LOOP) { |
745 |
> |
vij = 0.0; |
746 |
> |
fij.zero(); |
747 |
> |
eField1.zero(); |
748 |
> |
eField2.zero(); |
749 |
> |
sPot1 = 0.0; |
750 |
> |
sPot2 = 0.0; |
751 |
> |
} |
752 |
> |
|
753 |
> |
in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, |
754 |
> |
rgrp); |
755 |
> |
|
756 |
> |
atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); |
757 |
> |
|
758 |
> |
if (doHeatFlux_) |
759 |
> |
gvel2 = fDecomp_->getGroupVelocityColumn(cg2); |
760 |
> |
|
761 |
> |
for (ia = atomListRow.begin(); |
762 |
> |
ia != atomListRow.end(); ++ia) { |
763 |
> |
atom1 = (*ia); |
764 |
> |
|
765 |
> |
for (jb = atomListColumn.begin(); |
766 |
> |
jb != atomListColumn.end(); ++jb) { |
767 |
> |
atom2 = (*jb); |
768 |
> |
|
769 |
> |
if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) { |
770 |
> |
|
771 |
> |
vpair = 0.0; |
772 |
> |
workPot = 0.0; |
773 |
> |
exPot = 0.0; |
774 |
> |
f1.zero(); |
775 |
> |
dVdFQ1 = 0.0; |
776 |
> |
dVdFQ2 = 0.0; |
777 |
> |
|
778 |
> |
fDecomp_->fillInteractionData(idat, atom1, atom2, newAtom1); |
779 |
> |
|
780 |
> |
topoDist = fDecomp_->getTopologicalDistance(atom1, atom2); |
781 |
> |
vdwMult = vdwScale_[topoDist]; |
782 |
> |
electroMult = electrostaticScale_[topoDist]; |
783 |
> |
|
784 |
> |
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
785 |
> |
idat.d = &d_grp; |
786 |
> |
idat.r2 = &rgrpsq; |
787 |
> |
if (doHeatFlux_) |
788 |
> |
vel2 = gvel2; |
789 |
> |
} else { |
790 |
> |
d = fDecomp_->getInteratomicVector(atom1, atom2); |
791 |
> |
curSnapshot->wrapVector( d ); |
792 |
> |
r2 = d.lengthSquare(); |
793 |
> |
idat.d = &d; |
794 |
> |
idat.r2 = &r2; |
795 |
> |
if (doHeatFlux_) |
796 |
> |
vel2 = fDecomp_->getAtomVelocityColumn(atom2); |
797 |
> |
} |
798 |
> |
|
799 |
> |
r = sqrt( *(idat.r2) ); |
800 |
> |
idat.rij = &r; |
801 |
> |
|
802 |
> |
if (iLoop == PREPAIR_LOOP) { |
803 |
> |
interactionMan_->doPrePair(idat); |
804 |
> |
} else { |
805 |
> |
interactionMan_->doPair(idat); |
806 |
> |
fDecomp_->unpackInteractionData(idat, atom1, atom2); |
807 |
> |
vij += vpair; |
808 |
> |
fij += f1; |
809 |
> |
stressTensor -= outProduct( *(idat.d), f1); |
810 |
> |
if (doHeatFlux_) |
811 |
> |
fDecomp_->addToHeatFlux(*(idat.d) * dot(f1, vel2)); |
812 |
> |
} |
813 |
|
} |
814 |
|
} |
815 |
|
} |
816 |
< |
} |
817 |
< |
|
818 |
< |
if (iLoop == PAIR_LOOP) { |
819 |
< |
if (in_switching_region) { |
820 |
< |
swderiv = vij * dswdr / rgrp; |
821 |
< |
fg = swderiv * d_grp; |
822 |
< |
fij += fg; |
823 |
< |
|
824 |
< |
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
825 |
< |
if (!fDecomp_->skipAtomPair(atomListRow[0], |
826 |
< |
atomListColumn[0], |
865 |
< |
cg1, cg2)) { |
816 |
> |
|
817 |
> |
if (iLoop == PAIR_LOOP) { |
818 |
> |
if (in_switching_region) { |
819 |
> |
swderiv = vij * dswdr / rgrp; |
820 |
> |
fg = swderiv * d_grp; |
821 |
> |
fij += fg; |
822 |
> |
|
823 |
> |
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
824 |
> |
if (!fDecomp_->skipAtomPair(atomListRow[0], |
825 |
> |
atomListColumn[0], |
826 |
> |
cg1, cg2)) { |
827 |
|
stressTensor -= outProduct( *(idat.d), fg); |
828 |
|
if (doHeatFlux_) |
829 |
|
fDecomp_->addToHeatFlux(*(idat.d) * dot(fg, vel2)); |
830 |
< |
} |
831 |
< |
} |
832 |
< |
|
833 |
< |
for (ia = atomListRow.begin(); |
834 |
< |
ia != atomListRow.end(); ++ia) { |
835 |
< |
atom1 = (*ia); |
836 |
< |
mf = fDecomp_->getMassFactorRow(atom1); |
837 |
< |
// fg is the force on atom ia due to cutoff group's |
838 |
< |
// presence in switching region |
839 |
< |
fg = swderiv * d_grp * mf; |
840 |
< |
fDecomp_->addForceToAtomRow(atom1, fg); |
841 |
< |
if (atomListRow.size() > 1) { |
842 |
< |
if (info_->usesAtomicVirial()) { |
843 |
< |
// find the distance between the atom |
844 |
< |
// and the center of the cutoff group: |
845 |
< |
dag = fDecomp_->getAtomToGroupVectorRow(atom1, cg1); |
846 |
< |
stressTensor -= outProduct(dag, fg); |
847 |
< |
if (doHeatFlux_) |
848 |
< |
fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); |
830 |
> |
} |
831 |
> |
} |
832 |
> |
|
833 |
> |
for (ia = atomListRow.begin(); |
834 |
> |
ia != atomListRow.end(); ++ia) { |
835 |
> |
atom1 = (*ia); |
836 |
> |
mf = fDecomp_->getMassFactorRow(atom1); |
837 |
> |
// fg is the force on atom ia due to cutoff group's |
838 |
> |
// presence in switching region |
839 |
> |
fg = swderiv * d_grp * mf; |
840 |
> |
fDecomp_->addForceToAtomRow(atom1, fg); |
841 |
> |
if (atomListRow.size() > 1) { |
842 |
> |
if (info_->usesAtomicVirial()) { |
843 |
> |
// find the distance between the atom |
844 |
> |
// and the center of the cutoff group: |
845 |
> |
dag = fDecomp_->getAtomToGroupVectorRow(atom1, cg1); |
846 |
> |
stressTensor -= outProduct(dag, fg); |
847 |
> |
if (doHeatFlux_) |
848 |
> |
fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); |
849 |
> |
} |
850 |
|
} |
851 |
|
} |
852 |
< |
} |
853 |
< |
for (jb = atomListColumn.begin(); |
854 |
< |
jb != atomListColumn.end(); ++jb) { |
855 |
< |
atom2 = (*jb); |
856 |
< |
mf = fDecomp_->getMassFactorColumn(atom2); |
857 |
< |
// fg is the force on atom jb due to cutoff group's |
858 |
< |
// presence in switching region |
859 |
< |
fg = -swderiv * d_grp * mf; |
860 |
< |
fDecomp_->addForceToAtomColumn(atom2, fg); |
861 |
< |
|
862 |
< |
if (atomListColumn.size() > 1) { |
863 |
< |
if (info_->usesAtomicVirial()) { |
864 |
< |
// find the distance between the atom |
865 |
< |
// and the center of the cutoff group: |
866 |
< |
dag = fDecomp_->getAtomToGroupVectorColumn(atom2, cg2); |
867 |
< |
stressTensor -= outProduct(dag, fg); |
868 |
< |
if (doHeatFlux_) |
869 |
< |
fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); |
852 |
> |
for (jb = atomListColumn.begin(); |
853 |
> |
jb != atomListColumn.end(); ++jb) { |
854 |
> |
atom2 = (*jb); |
855 |
> |
mf = fDecomp_->getMassFactorColumn(atom2); |
856 |
> |
// fg is the force on atom jb due to cutoff group's |
857 |
> |
// presence in switching region |
858 |
> |
fg = -swderiv * d_grp * mf; |
859 |
> |
fDecomp_->addForceToAtomColumn(atom2, fg); |
860 |
> |
|
861 |
> |
if (atomListColumn.size() > 1) { |
862 |
> |
if (info_->usesAtomicVirial()) { |
863 |
> |
// find the distance between the atom |
864 |
> |
// and the center of the cutoff group: |
865 |
> |
dag = fDecomp_->getAtomToGroupVectorColumn(atom2, cg2); |
866 |
> |
stressTensor -= outProduct(dag, fg); |
867 |
> |
if (doHeatFlux_) |
868 |
> |
fDecomp_->addToHeatFlux( dag * dot(fg, vel2)); |
869 |
> |
} |
870 |
|
} |
871 |
|
} |
872 |
|
} |
873 |
+ |
//if (!info_->usesAtomicVirial()) { |
874 |
+ |
// stressTensor -= outProduct(d_grp, fij); |
875 |
+ |
// if (doHeatFlux_) |
876 |
+ |
// fDecomp_->addToHeatFlux( d_grp * dot(fij, vel2)); |
877 |
+ |
//} |
878 |
|
} |
912 |
– |
//if (!info_->usesAtomicVirial()) { |
913 |
– |
// stressTensor -= outProduct(d_grp, fij); |
914 |
– |
// if (doHeatFlux_) |
915 |
– |
// fDecomp_->addToHeatFlux( d_grp * dot(fij, vel2)); |
916 |
– |
//} |
879 |
|
} |
880 |
|
} |
881 |
+ |
newAtom1 = false; |
882 |
|
} |
883 |
< |
|
883 |
> |
|
884 |
|
if (iLoop == PREPAIR_LOOP) { |
885 |
|
if (info_->requiresPrepair()) { |
886 |
< |
|
886 |
> |
|
887 |
|
fDecomp_->collectIntermediateData(); |
888 |
< |
|
888 |
> |
|
889 |
|
for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
890 |
|
fDecomp_->fillSelfData(sdat, atom1); |
891 |
|
interactionMan_->doPreForce(sdat); |
892 |
|
} |
893 |
< |
|
893 |
> |
|
894 |
|
fDecomp_->distributeIntermediateData(); |
895 |
< |
|
895 |
> |
|
896 |
|
} |
897 |
|
} |
898 |
|
} |
921 |
|
curSnapshot->setLongRangePotential(longRangePotential); |
922 |
|
|
923 |
|
curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedSelfPotential()) + |
924 |
< |
*(fDecomp_->getExcludedPotential())); |
924 |
> |
*(fDecomp_->getExcludedPotential())); |
925 |
|
|
926 |
|
} |
927 |
|
|
957 |
|
|
958 |
|
if (info_->getSimParams()->getUseLongRangeCorrections()) { |
959 |
|
/* |
960 |
< |
RealType vol = curSnapshot->getVolume(); |
961 |
< |
RealType Elrc(0.0); |
962 |
< |
RealType Wlrc(0.0); |
960 |
> |
RealType vol = curSnapshot->getVolume(); |
961 |
> |
RealType Elrc(0.0); |
962 |
> |
RealType Wlrc(0.0); |
963 |
|
|
964 |
< |
set<AtomType*>::iterator i; |
965 |
< |
set<AtomType*>::iterator j; |
964 |
> |
set<AtomType*>::iterator i; |
965 |
> |
set<AtomType*>::iterator j; |
966 |
|
|
967 |
< |
RealType n_i, n_j; |
968 |
< |
RealType rho_i, rho_j; |
969 |
< |
pair<RealType, RealType> LRI; |
967 |
> |
RealType n_i, n_j; |
968 |
> |
RealType rho_i, rho_j; |
969 |
> |
pair<RealType, RealType> LRI; |
970 |
|
|
971 |
< |
for (i = atomTypes_.begin(); i != atomTypes_.end(); ++i) { |
971 |
> |
for (i = atomTypes_.begin(); i != atomTypes_.end(); ++i) { |
972 |
|
n_i = RealType(info_->getGlobalCountOfType(*i)); |
973 |
|
rho_i = n_i / vol; |
974 |
|
for (j = atomTypes_.begin(); j != atomTypes_.end(); ++j) { |
975 |
< |
n_j = RealType(info_->getGlobalCountOfType(*j)); |
976 |
< |
rho_j = n_j / vol; |
975 |
> |
n_j = RealType(info_->getGlobalCountOfType(*j)); |
976 |
> |
rho_j = n_j / vol; |
977 |
|
|
978 |
< |
LRI = interactionMan_->getLongRangeIntegrals( (*i), (*j) ); |
978 |
> |
LRI = interactionMan_->getLongRangeIntegrals( (*i), (*j) ); |
979 |
|
|
980 |
< |
Elrc += n_i * rho_j * LRI.first; |
981 |
< |
Wlrc -= rho_i * rho_j * LRI.second; |
980 |
> |
Elrc += n_i * rho_j * LRI.first; |
981 |
> |
Wlrc -= rho_i * rho_j * LRI.second; |
982 |
|
} |
983 |
< |
} |
984 |
< |
Elrc *= 2.0 * NumericConstant::PI; |
985 |
< |
Wlrc *= 2.0 * NumericConstant::PI; |
983 |
> |
} |
984 |
> |
Elrc *= 2.0 * NumericConstant::PI; |
985 |
> |
Wlrc *= 2.0 * NumericConstant::PI; |
986 |
|
|
987 |
< |
RealType lrp = curSnapshot->getLongRangePotential(); |
988 |
< |
curSnapshot->setLongRangePotential(lrp + Elrc); |
989 |
< |
stressTensor += Wlrc * SquareMatrix3<RealType>::identity(); |
990 |
< |
curSnapshot->setStressTensor(stressTensor); |
987 |
> |
RealType lrp = curSnapshot->getLongRangePotential(); |
988 |
> |
curSnapshot->setLongRangePotential(lrp + Elrc); |
989 |
> |
stressTensor += Wlrc * SquareMatrix3<RealType>::identity(); |
990 |
> |
curSnapshot->setStressTensor(stressTensor); |
991 |
|
*/ |
992 |
|
|
993 |
|
} |