| 108 |
|
|
| 109 |
|
Globals* simParams_ = info_->getSimParams(); |
| 110 |
|
ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions(); |
| 111 |
+ |
int mdFileVersion; |
| 112 |
|
|
| 113 |
+ |
if (simParams_->haveMDfileVersion()) |
| 114 |
+ |
mdFileVersion = simParams_->getMDfileVersion(); |
| 115 |
+ |
else |
| 116 |
+ |
mdFileVersion = 0; |
| 117 |
+ |
|
| 118 |
|
if (simParams_->haveCutoffRadius()) { |
| 119 |
|
rCut_ = simParams_->getCutoffRadius(); |
| 120 |
|
} else { |
| 172 |
|
cutoffMethod_ = i->second; |
| 173 |
|
} |
| 174 |
|
} else { |
| 175 |
< |
sprintf(painCave.errMsg, |
| 176 |
< |
"ForceManager::setupCutoffs: No value was set for the cutoffMethod.\n" |
| 177 |
< |
"\tOpenMD will use SHIFTED_FORCE.\n"); |
| 178 |
< |
painCave.isFatal = 0; |
| 179 |
< |
painCave.severity = OPENMD_INFO; |
| 180 |
< |
simError(); |
| 181 |
< |
cutoffMethod_ = SHIFTED_FORCE; |
| 175 |
> |
if (mdFileVersion > 1) { |
| 176 |
> |
sprintf(painCave.errMsg, |
| 177 |
> |
"ForceManager::setupCutoffs: No value was set for the cutoffMethod.\n" |
| 178 |
> |
"\tOpenMD will use SHIFTED_FORCE.\n"); |
| 179 |
> |
painCave.isFatal = 0; |
| 180 |
> |
painCave.severity = OPENMD_INFO; |
| 181 |
> |
simError(); |
| 182 |
> |
cutoffMethod_ = SHIFTED_FORCE; |
| 183 |
> |
} else { |
| 184 |
> |
// handle the case where the old file version was in play |
| 185 |
> |
// (there should be no cutoffMethod, so we have to deduce it |
| 186 |
> |
// from other data). |
| 187 |
> |
|
| 188 |
> |
sprintf(painCave.errMsg, |
| 189 |
> |
"ForceManager::setupCutoffs : DEPRECATED FILE FORMAT!\n" |
| 190 |
> |
"\tOpenMD found a file which does not set a cutoffMethod.\n" |
| 191 |
> |
"\tOpenMD will attempt to deduce a cutoffMethod using the\n" |
| 192 |
> |
"\tbehavior of the older (version 1) code. To remove this\n" |
| 193 |
> |
"\twarning, add an explicit cutoffMethod and change the top\n" |
| 194 |
> |
"\tof the file so that it begins with <OpenMD version=2>\n"); |
| 195 |
> |
painCave.isFatal = 0; |
| 196 |
> |
painCave.severity = OPENMD_WARNING; |
| 197 |
> |
simError(); |
| 198 |
> |
|
| 199 |
> |
// The old file version tethered the shifting behavior to the |
| 200 |
> |
// electrostaticSummationMethod keyword. |
| 201 |
> |
|
| 202 |
> |
if (simParams_->haveElectrostaticSummationMethod()) { |
| 203 |
> |
std::string myMethod = simParams_->getElectrostaticSummationMethod(); |
| 204 |
> |
toUpper(myMethod); |
| 205 |
> |
|
| 206 |
> |
if (myMethod == "SHIFTED_POTENTIAL") { |
| 207 |
> |
cutoffMethod_ = SHIFTED_POTENTIAL; |
| 208 |
> |
} else if (myMethod == "SHIFTED_FORCE") { |
| 209 |
> |
cutoffMethod_ = SHIFTED_FORCE; |
| 210 |
> |
} |
| 211 |
> |
|
| 212 |
> |
if (simParams_->haveSwitchingRadius()) |
| 213 |
> |
rSwitch_ = simParams_->getSwitchingRadius(); |
| 214 |
> |
|
| 215 |
> |
if (myMethod == "SHIFTED_POTENTIAL" || myMethod == "SHIFTED_FORCE") { |
| 216 |
> |
if (simParams_->haveSwitchingRadius()){ |
| 217 |
> |
sprintf(painCave.errMsg, |
| 218 |
> |
"ForceManager::setupCutoffs : DEPRECATED ERROR MESSAGE\n" |
| 219 |
> |
"\tA value was set for the switchingRadius\n" |
| 220 |
> |
"\teven though the electrostaticSummationMethod was\n" |
| 221 |
> |
"\tset to %s\n", myMethod.c_str()); |
| 222 |
> |
painCave.severity = OPENMD_WARNING; |
| 223 |
> |
painCave.isFatal = 1; |
| 224 |
> |
simError(); |
| 225 |
> |
} |
| 226 |
> |
} |
| 227 |
> |
if (abs(rCut_ - rSwitch_) < 0.0001) { |
| 228 |
> |
if (cutoffMethod_ == SHIFTED_FORCE) { |
| 229 |
> |
sprintf(painCave.errMsg, |
| 230 |
> |
"ForceManager::setupCutoffs : DEPRECATED BEHAVIOR\n" |
| 231 |
> |
"\tcutoffRadius and switchingRadius are set to the\n" |
| 232 |
> |
"\tsame value. OpenMD will use shifted force\n" |
| 233 |
> |
"\tpotentials instead of switching functions.\n"); |
| 234 |
> |
painCave.isFatal = 0; |
| 235 |
> |
painCave.severity = OPENMD_WARNING; |
| 236 |
> |
simError(); |
| 237 |
> |
} else { |
| 238 |
> |
cutoffMethod_ = SHIFTED_POTENTIAL; |
| 239 |
> |
sprintf(painCave.errMsg, |
| 240 |
> |
"ForceManager::setupCutoffs : DEPRECATED BEHAVIOR\n" |
| 241 |
> |
"\tcutoffRadius and switchingRadius are set to the\n" |
| 242 |
> |
"\tsame value. OpenMD will use shifted potentials\n" |
| 243 |
> |
"\tinstead of switching functions.\n"); |
| 244 |
> |
painCave.isFatal = 0; |
| 245 |
> |
painCave.severity = OPENMD_WARNING; |
| 246 |
> |
simError(); |
| 247 |
> |
} |
| 248 |
> |
} |
| 249 |
> |
} |
| 250 |
> |
} |
| 251 |
|
} |
| 252 |
|
|
| 253 |
|
map<string, CutoffPolicy> stringToCutoffPolicy; |
| 317 |
|
simError(); |
| 318 |
|
} |
| 319 |
|
} else { |
| 320 |
< |
if (simParams_->haveSwitchingRadius()) { |
| 321 |
< |
map<string, CutoffMethod>::const_iterator it; |
| 322 |
< |
string theMeth; |
| 323 |
< |
for (it = stringToCutoffMethod.begin(); |
| 324 |
< |
it != stringToCutoffMethod.end(); ++it) { |
| 325 |
< |
if (it->second == cutoffMethod_) { |
| 326 |
< |
theMeth = it->first; |
| 327 |
< |
break; |
| 320 |
> |
if (mdFileVersion > 1) { |
| 321 |
> |
// throw an error if we define a switching radius and don't need one. |
| 322 |
> |
// older file versions should not do this. |
| 323 |
> |
if (simParams_->haveSwitchingRadius()) { |
| 324 |
> |
map<string, CutoffMethod>::const_iterator it; |
| 325 |
> |
string theMeth; |
| 326 |
> |
for (it = stringToCutoffMethod.begin(); |
| 327 |
> |
it != stringToCutoffMethod.end(); ++it) { |
| 328 |
> |
if (it->second == cutoffMethod_) { |
| 329 |
> |
theMeth = it->first; |
| 330 |
> |
break; |
| 331 |
> |
} |
| 332 |
|
} |
| 333 |
+ |
sprintf(painCave.errMsg, |
| 334 |
+ |
"ForceManager::setupCutoffs: the cutoffMethod (%s)\n" |
| 335 |
+ |
"\tis not set to SWITCHED, so switchingRadius value\n" |
| 336 |
+ |
"\twill be ignored for this simulation\n", theMeth.c_str()); |
| 337 |
+ |
painCave.isFatal = 0; |
| 338 |
+ |
painCave.severity = OPENMD_WARNING; |
| 339 |
+ |
simError(); |
| 340 |
|
} |
| 255 |
– |
sprintf(painCave.errMsg, |
| 256 |
– |
"ForceManager::setupCutoffs: the cutoffMethod (%s)\n" |
| 257 |
– |
"\tis not set to SWITCHED, so switchingRadius value\n" |
| 258 |
– |
"\twill be ignored for this simulation\n", theMeth.c_str()); |
| 259 |
– |
painCave.isFatal = 0; |
| 260 |
– |
painCave.severity = OPENMD_WARNING; |
| 261 |
– |
simError(); |
| 341 |
|
} |
| 263 |
– |
|
| 342 |
|
rSwitch_ = rCut_; |
| 343 |
|
} |
| 344 |
|
|
| 369 |
|
switcher_->setSwitch(rSwitch_, rCut_); |
| 370 |
|
interactionMan_->setSwitchingRadius(rSwitch_); |
| 371 |
|
} |
| 372 |
+ |
|
| 373 |
+ |
|
| 374 |
+ |
|
| 375 |
|
|
| 376 |
|
void ForceManager::initialize() { |
| 377 |
|
|
| 674 |
|
cuts = fDecomp_->getGroupCutoffs(cg1, cg2); |
| 675 |
|
|
| 676 |
|
d_grp = fDecomp_->getIntergroupVector(cg1, cg2); |
| 677 |
+ |
|
| 678 |
|
curSnapshot->wrapVector(d_grp); |
| 679 |
|
rgrpsq = d_grp.lengthSquare(); |
| 598 |
– |
|
| 680 |
|
rCutSq = cuts.second; |
| 681 |
|
|
| 682 |
|
if (rgrpsq < rCutSq) { |
| 688 |
|
|
| 689 |
|
in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr, |
| 690 |
|
rgrp); |
| 691 |
< |
|
| 691 |
> |
|
| 692 |
|
atomListRow = fDecomp_->getAtomsInGroupRow(cg1); |
| 693 |
|
atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2); |
| 694 |
|
|
| 730 |
|
} else { |
| 731 |
|
interactionMan_->doPair(idat); |
| 732 |
|
fDecomp_->unpackInteractionData(idat, atom1, atom2); |
| 652 |
– |
|
| 733 |
|
vij += vpair; |
| 734 |
|
fij += f1; |
| 735 |
|
tau -= outProduct( *(idat.d), f1); |
| 756 |
|
// presence in switching region |
| 757 |
|
fg = swderiv * d_grp * mf; |
| 758 |
|
fDecomp_->addForceToAtomRow(atom1, fg); |
| 679 |
– |
|
| 759 |
|
if (atomListRow.size() > 1) { |
| 760 |
|
if (info_->usesAtomicVirial()) { |
| 761 |
|
// find the distance between the atom |
| 784 |
|
} |
| 785 |
|
} |
| 786 |
|
} |
| 787 |
< |
//if (!SIM_uses_AtomicVirial) { |
| 787 |
> |
//if (!info_->usesAtomicVirial()) { |
| 788 |
|
// tau -= outProduct(d_grp, fij); |
| 789 |
|
//} |
| 790 |
|
} |
| 805 |
|
|
| 806 |
|
} |
| 807 |
|
} |
| 729 |
– |
|
| 808 |
|
} |
| 809 |
|
|
| 810 |
|
fDecomp_->collectData(); |