99 |
|
* Use the maximum suggested value that was found. |
100 |
|
* |
101 |
|
* cutoffMethod : (one of HARD, SWITCHED, SHIFTED_FORCE, TAYLOR_SHIFTED, |
102 |
< |
* or SHIFTED_POTENTIAL) |
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 |
|
* |
172 |
|
stringToCutoffMethod["SHIFTED_POTENTIAL"] = SHIFTED_POTENTIAL; |
173 |
|
stringToCutoffMethod["SHIFTED_FORCE"] = SHIFTED_FORCE; |
174 |
|
stringToCutoffMethod["TAYLOR_SHIFTED"] = TAYLOR_SHIFTED; |
175 |
+ |
stringToCutoffMethod["EWALD_FULL"] = EWALD_FULL; |
176 |
|
|
177 |
|
if (simParams_->haveCutoffMethod()) { |
178 |
|
string cutMeth = toUpperCopy(simParams_->getCutoffMethod()); |
183 |
|
"ForceManager::setupCutoffs: Could not find chosen cutoffMethod %s\n" |
184 |
|
"\tShould be one of: " |
185 |
|
"HARD, SWITCHED, SHIFTED_POTENTIAL, TAYLOR_SHIFTED,\n" |
186 |
< |
"\tor SHIFTED_FORCE\n", |
186 |
> |
"\tSHIFTED_FORCE, or EWALD_FULL\n", |
187 |
|
cutMeth.c_str()); |
188 |
|
painCave.isFatal = 1; |
189 |
|
painCave.severity = OPENMD_ERROR; |
229 |
|
cutoffMethod_ = SHIFTED_FORCE; |
230 |
|
} else if (myMethod == "TAYLOR_SHIFTED") { |
231 |
|
cutoffMethod_ = TAYLOR_SHIFTED; |
232 |
+ |
} else if (myMethod == "EWALD_FULL") { |
233 |
+ |
cutoffMethod_ = EWALD_FULL; |
234 |
|
} |
235 |
|
|
236 |
|
if (simParams_->haveSwitchingRadius()) |
237 |
|
rSwitch_ = simParams_->getSwitchingRadius(); |
238 |
|
|
239 |
|
if (myMethod == "SHIFTED_POTENTIAL" || myMethod == "SHIFTED_FORCE" || |
240 |
< |
myMethod == "TAYLOR_SHIFTED") { |
240 |
> |
myMethod == "TAYLOR_SHIFTED" || myMethod == "EWALD_FULL") { |
241 |
|
if (simParams_->haveSwitchingRadius()){ |
242 |
|
sprintf(painCave.errMsg, |
243 |
|
"ForceManager::setupCutoffs : DEPRECATED ERROR MESSAGE\n" |
637 |
|
// Collect from all nodes. This should eventually be moved into a |
638 |
|
// SystemDecomposition, but this is a better place than in |
639 |
|
// Thermo to do the collection. |
640 |
< |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bondPotential, 1, MPI::REALTYPE, |
641 |
< |
MPI::SUM); |
642 |
< |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bendPotential, 1, MPI::REALTYPE, |
643 |
< |
MPI::SUM); |
644 |
< |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &torsionPotential, 1, |
645 |
< |
MPI::REALTYPE, MPI::SUM); |
646 |
< |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &inversionPotential, 1, |
647 |
< |
MPI::REALTYPE, MPI::SUM); |
640 |
> |
|
641 |
> |
MPI_Allreduce(MPI_IN_PLACE, &bondPotential, 1, MPI_REALTYPE, |
642 |
> |
MPI_SUM, MPI_COMM_WORLD); |
643 |
> |
MPI_Allreduce(MPI_IN_PLACE, &bendPotential, 1, MPI_REALTYPE, |
644 |
> |
MPI_SUM, MPI_COMM_WORLD); |
645 |
> |
MPI_Allreduce(MPI_IN_PLACE, &torsionPotential, 1, |
646 |
> |
MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); |
647 |
> |
MPI_Allreduce(MPI_IN_PLACE, &inversionPotential, 1, |
648 |
> |
MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); |
649 |
|
#endif |
650 |
|
|
651 |
|
Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
667 |
|
DataStorage* config = &(curSnapshot->atomData); |
668 |
|
DataStorage* cgConfig = &(curSnapshot->cgData); |
669 |
|
|
670 |
+ |
|
671 |
|
//calculate the center of mass of cutoff group |
672 |
|
|
673 |
|
SimInfo::MoleculeIterator mi; |
700 |
|
RealType vij; |
701 |
|
Vector3d fij, fg, f1; |
702 |
|
tuple3<RealType, RealType, RealType> cuts; |
703 |
< |
RealType rCutSq; |
703 |
> |
RealType rCut, rCutSq, rListSq; |
704 |
|
bool in_switching_region; |
705 |
|
RealType sw, dswdr, swderiv; |
706 |
|
vector<int> atomListColumn, atomListRow; |
710 |
|
RealType vpair; |
711 |
|
RealType dVdFQ1(0.0); |
712 |
|
RealType dVdFQ2(0.0); |
708 |
– |
Vector3d eField1(0.0); |
709 |
– |
Vector3d eField2(0.0); |
713 |
|
potVec longRangePotential(0.0); |
714 |
+ |
RealType reciprocalPotential(0.0); |
715 |
|
potVec workPot(0.0); |
716 |
|
potVec exPot(0.0); |
717 |
+ |
Vector3d eField1(0.0); |
718 |
+ |
Vector3d eField2(0.0); |
719 |
|
vector<int>::iterator ia, jb; |
720 |
|
|
721 |
|
int loopStart, loopEnd; |
722 |
< |
|
722 |
> |
|
723 |
> |
idat.rcut = &rCut; |
724 |
|
idat.vdwMult = &vdwMult; |
725 |
|
idat.electroMult = &electroMult; |
726 |
|
idat.pot = &workPot; |
753 |
|
if (update_nlist) { |
754 |
|
if (!usePeriodicBoundaryConditions_) |
755 |
|
Mat3x3d bbox = thermo->getBoundingBox(); |
756 |
< |
neighborList = fDecomp_->buildNeighborList(); |
756 |
> |
fDecomp_->buildNeighborList(neighborList_); |
757 |
|
} |
758 |
|
} |
759 |
|
|
760 |
< |
for (vector<pair<int, int> >::iterator it = neighborList.begin(); |
761 |
< |
it != neighborList.end(); ++it) { |
760 |
> |
for (vector<pair<int, int> >::iterator it = neighborList_.begin(); |
761 |
> |
it != neighborList_.end(); ++it) { |
762 |
|
|
763 |
|
cg1 = (*it).first; |
764 |
|
cg2 = (*it).second; |
765 |
|
|
766 |
< |
cuts = fDecomp_->getGroupCutoffs(cg1, cg2); |
766 |
> |
fDecomp_->getGroupCutoffs(cg1, cg2, rCut, rCutSq, rListSq); |
767 |
|
|
768 |
|
d_grp = fDecomp_->getIntergroupVector(cg1, cg2); |
769 |
|
|
770 |
< |
curSnapshot->wrapVector(d_grp); |
770 |
> |
// already wrapped in the getIntergroupVector call: |
771 |
> |
// curSnapshot->wrapVector(d_grp); |
772 |
|
rgrpsq = d_grp.lengthSquare(); |
765 |
– |
rCutSq = cuts.second; |
773 |
|
|
774 |
|
if (rgrpsq < rCutSq) { |
768 |
– |
idat.rcut = &cuts.first; |
775 |
|
if (iLoop == PAIR_LOOP) { |
776 |
|
vij = 0.0; |
777 |
|
fij.zero(); |
828 |
|
|
829 |
|
r = sqrt( *(idat.r2) ); |
830 |
|
idat.rij = &r; |
831 |
< |
|
831 |
> |
|
832 |
|
if (iLoop == PREPAIR_LOOP) { |
833 |
|
interactionMan_->doPrePair(idat); |
834 |
|
} else { |
924 |
|
} |
925 |
|
} |
926 |
|
} |
927 |
< |
|
927 |
> |
|
928 |
|
// collects pairwise information |
929 |
|
fDecomp_->collectData(); |
930 |
+ |
if (cutoffMethod_ == EWALD_FULL) { |
931 |
+ |
interactionMan_->doReciprocalSpaceSum(reciprocalPotential); |
932 |
+ |
|
933 |
+ |
curSnapshot->setReciprocalPotential(reciprocalPotential); |
934 |
+ |
} |
935 |
|
|
936 |
|
if (info_->requiresSelfCorrection()) { |
937 |
|
for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |
953 |
|
|
954 |
|
} |
955 |
|
|
945 |
– |
|
956 |
|
void ForceManager::postCalculation() { |
957 |
|
|
958 |
|
vector<Perturbation*>::iterator pi; |
978 |
|
} |
979 |
|
|
980 |
|
#ifdef IS_MPI |
981 |
< |
MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, stressTensor.getArrayPointer(), 9, |
982 |
< |
MPI::REALTYPE, MPI::SUM); |
981 |
> |
MPI_Allreduce(MPI_IN_PLACE, stressTensor.getArrayPointer(), 9, |
982 |
> |
MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); |
983 |
|
#endif |
984 |
|
curSnapshot->setStressTensor(stressTensor); |
985 |
|
|