75 |
|
/** |
76 |
|
* setupCutoffs |
77 |
|
* |
78 |
< |
* Sets the values of cutoffRadius, cutoffMethod, and cutoffPolicy |
78 |
> |
* Sets the values of cutoffRadius, switchingRadius, cutoffMethod, |
79 |
> |
* and cutoffPolicy |
80 |
|
* |
81 |
|
* cutoffRadius : realType |
82 |
|
* If the cutoffRadius was explicitly set, use that value. |
93 |
|
* cutoffPolicy : (one of MIX, MAX, TRADITIONAL) |
94 |
|
* If cutoffPolicy was explicitly set, use that choice. |
95 |
|
* If cutoffPolicy was not explicitly set, use TRADITIONAL |
96 |
+ |
* |
97 |
+ |
* switchingRadius : realType |
98 |
+ |
* If the cutoffMethod was set to SWITCHED: |
99 |
+ |
* If the switchingRadius was explicitly set, use that value |
100 |
+ |
* (but do a sanity check first). |
101 |
+ |
* If the switchingRadius was not explicitly set: use 0.85 * |
102 |
+ |
* cutoffRadius_ |
103 |
+ |
* If the cutoffMethod was not set to SWITCHED: |
104 |
+ |
* Set switchingRadius equal to cutoffRadius for safety. |
105 |
|
*/ |
106 |
|
void ForceManager::setupCutoffs() { |
107 |
|
|
212 |
|
simError(); |
213 |
|
cutoffPolicy_ = TRADITIONAL; |
214 |
|
} |
205 |
– |
fDecomp_->setCutoffPolicy(cutoffPolicy_); |
206 |
– |
} |
215 |
|
|
216 |
< |
/** |
217 |
< |
* setupSwitching |
210 |
< |
* |
211 |
< |
* Sets the values of switchingRadius and |
212 |
< |
* If the switchingRadius was explicitly set, use that value (but check it) |
213 |
< |
* If the switchingRadius was not explicitly set: use 0.85 * cutoffRadius_ |
214 |
< |
*/ |
215 |
< |
void ForceManager::setupSwitching() { |
216 |
< |
Globals* simParams_ = info_->getSimParams(); |
217 |
< |
|
216 |
> |
fDecomp_->setCutoffPolicy(cutoffPolicy_); |
217 |
> |
|
218 |
|
// create the switching function object: |
219 |
+ |
|
220 |
|
switcher_ = new SwitchingFunction(); |
221 |
< |
|
222 |
< |
if (simParams_->haveSwitchingRadius()) { |
223 |
< |
rSwitch_ = simParams_->getSwitchingRadius(); |
224 |
< |
if (rSwitch_ > rCut_) { |
221 |
> |
|
222 |
> |
if (cutoffMethod_ == SWITCHED) { |
223 |
> |
if (simParams_->haveSwitchingRadius()) { |
224 |
> |
rSwitch_ = simParams_->getSwitchingRadius(); |
225 |
> |
if (rSwitch_ > rCut_) { |
226 |
> |
sprintf(painCave.errMsg, |
227 |
> |
"ForceManager::setupCutoffs: switchingRadius (%f) is larger " |
228 |
> |
"than the cutoffRadius(%f)\n", rSwitch_, rCut_); |
229 |
> |
painCave.isFatal = 1; |
230 |
> |
painCave.severity = OPENMD_ERROR; |
231 |
> |
simError(); |
232 |
> |
} |
233 |
> |
} else { |
234 |
> |
rSwitch_ = 0.85 * rCut_; |
235 |
|
sprintf(painCave.errMsg, |
236 |
< |
"ForceManager::setupSwitching: switchingRadius (%f) is larger " |
237 |
< |
"than the cutoffRadius(%f)\n", rSwitch_, rCut_); |
238 |
< |
painCave.isFatal = 1; |
239 |
< |
painCave.severity = OPENMD_ERROR; |
236 |
> |
"ForceManager::setupCutoffs: No value was set for the switchingRadius.\n" |
237 |
> |
"\tOpenMD will use a default value of 85 percent of the cutoffRadius.\n" |
238 |
> |
"\tswitchingRadius = %f. for this simulation\n", rSwitch_); |
239 |
> |
painCave.isFatal = 0; |
240 |
> |
painCave.severity = OPENMD_WARNING; |
241 |
> |
simError(); |
242 |
> |
} |
243 |
> |
} else { |
244 |
> |
if (simParams_->haveSwitchingRadius()) { |
245 |
> |
map<string, CutoffMethod>::const_iterator it; |
246 |
> |
string theMeth; |
247 |
> |
for (it = stringToCutoffMethod.begin(); |
248 |
> |
it != stringToCutoffMethod.end(); ++it) { |
249 |
> |
if (it->second == cutoffMethod_) { |
250 |
> |
theMeth = it->first; |
251 |
> |
break; |
252 |
> |
} |
253 |
> |
} |
254 |
> |
sprintf(painCave.errMsg, |
255 |
> |
"ForceManager::setupCutoffs: the cutoffMethod (%s)\n" |
256 |
> |
"\tis not set to SWITCHED, so switchingRadius value\n" |
257 |
> |
"\twill be ignored for this simulation\n", theMeth.c_str()); |
258 |
> |
painCave.isFatal = 0; |
259 |
> |
painCave.severity = OPENMD_WARNING; |
260 |
|
simError(); |
261 |
|
} |
262 |
< |
} else { |
263 |
< |
rSwitch_ = 0.85 * rCut_; |
264 |
< |
sprintf(painCave.errMsg, |
234 |
< |
"ForceManager::setupSwitching: No value was set for the switchingRadius.\n" |
235 |
< |
"\tOpenMD will use a default value of 85 percent of the cutoffRadius.\n" |
236 |
< |
"\tswitchingRadius = %f. for this simulation\n", rSwitch_); |
237 |
< |
painCave.isFatal = 0; |
238 |
< |
painCave.severity = OPENMD_WARNING; |
239 |
< |
simError(); |
240 |
< |
} |
262 |
> |
|
263 |
> |
rSwitch_ = rCut_; |
264 |
> |
} |
265 |
|
|
266 |
|
// Default to cubic switching function. |
267 |
|
sft_ = cubic; |
303 |
|
// query them for suggested cutoff values |
304 |
|
|
305 |
|
setupCutoffs(); |
282 |
– |
setupSwitching(); |
306 |
|
|
307 |
|
info_->prepareTopology(); |
308 |
|
} |
597 |
|
if (rgrpsq < rCutSq) { |
598 |
|
idat.rcut = &cuts.first; |
599 |
|
if (iLoop == PAIR_LOOP) { |
600 |
< |
vij *= 0.0; |
600 |
> |
vij = 0.0; |
601 |
|
fij = V3Zero; |
602 |
|
} |
603 |
|
|
657 |
|
if (in_switching_region) { |
658 |
|
swderiv = vij * dswdr / rgrp; |
659 |
|
fg = swderiv * d_grp; |
637 |
– |
|
660 |
|
fij += fg; |
661 |
|
|
662 |
|
if (atomListRow.size() == 1 && atomListColumn.size() == 1) { |
724 |
|
} |
725 |
|
|
726 |
|
fDecomp_->collectData(); |
705 |
– |
|
706 |
– |
if ( info_->requiresSkipCorrection() ) { |
707 |
– |
|
708 |
– |
for (int atom1 = 0; atom1 < fDecomp_->getNAtomsInRow(); atom1++) { |
709 |
– |
|
710 |
– |
vector<int> skipList = fDecomp_->getSkipsForAtom( atom1 ); |
727 |
|
|
712 |
– |
for (vector<int>::iterator jb = skipList.begin(); |
713 |
– |
jb != skipList.end(); ++jb) { |
714 |
– |
|
715 |
– |
atom2 = (*jb); |
716 |
– |
fDecomp_->fillSkipData(idat, atom1, atom2); |
717 |
– |
interactionMan_->doSkipCorrection(idat); |
718 |
– |
fDecomp_->unpackSkipData(idat, atom1, atom2); |
719 |
– |
|
720 |
– |
} |
721 |
– |
} |
722 |
– |
} |
723 |
– |
|
728 |
|
if (info_->requiresSelfCorrection()) { |
729 |
|
|
730 |
|
for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) { |