| 67 |
|
eam_->setForceField(forceField_); |
| 68 |
|
sc_->setForceField(forceField_); |
| 69 |
|
morse_->setForceField(forceField_); |
| 70 |
+ |
electrostatic_->setSimInfo(info_); |
| 71 |
|
electrostatic_->setForceField(forceField_); |
| 72 |
|
maw_->setForceField(forceField_); |
| 73 |
|
|
| 242 |
|
} |
| 243 |
|
|
| 244 |
|
|
| 245 |
< |
// make sure every pair of atom types in this simulation has a |
| 246 |
< |
// non-bonded interaction: |
| 245 |
> |
// Make sure every pair of atom types in this simulation has a |
| 246 |
> |
// non-bonded interaction. If not, just inform the user. |
| 247 |
|
|
| 248 |
|
set<AtomType*> simTypes = info_->getSimulatedAtomTypes(); |
| 249 |
|
set<AtomType*>::iterator it, jt; |
| 250 |
+ |
|
| 251 |
|
for (it = simTypes.begin(); it != simTypes.end(); ++it) { |
| 252 |
|
atype1 = (*it); |
| 253 |
< |
for (jt = simTypes.begin(); jt != simTypes.end(); ++jt) { |
| 253 |
> |
for (jt = it; jt != simTypes.end(); ++jt) { |
| 254 |
|
atype2 = (*jt); |
| 255 |
|
key = make_pair(atype1, atype2); |
| 256 |
|
|
| 257 |
|
if (interactions_[key].size() == 0) { |
| 258 |
|
sprintf( painCave.errMsg, |
| 259 |
< |
"InteractionManager unable to find an appropriate non-bonded\n" |
| 260 |
< |
"\tinteraction for atom types %s - %s\n", |
| 259 |
> |
"InteractionManager could not find a matching non-bonded\n" |
| 260 |
> |
"\tinteraction for atom types %s - %s\n" |
| 261 |
> |
"\tProceeding without this interaction.\n", |
| 262 |
|
atype1->getName().c_str(), atype2->getName().c_str()); |
| 263 |
|
painCave.severity = OPENMD_INFO; |
| 264 |
< |
painCave.isFatal = 1; |
| 264 |
> |
painCave.isFatal = 0; |
| 265 |
|
simError(); |
| 266 |
|
} |
| 267 |
|
} |
| 269 |
|
|
| 270 |
|
initialized_ = true; |
| 271 |
|
} |
| 272 |
+ |
|
| 273 |
+ |
void InteractionManager::setCutoffRadius(RealType rcut) { |
| 274 |
+ |
|
| 275 |
+ |
electrostatic_->setCutoffRadius(rcut); |
| 276 |
+ |
eam_->setCutoffRadius(rcut); |
| 277 |
+ |
} |
| 278 |
+ |
|
| 279 |
+ |
void InteractionManager::setSwitchingRadius(RealType rswitch) { |
| 280 |
+ |
electrostatic_->setSwitchingRadius(rswitch); |
| 281 |
+ |
} |
| 282 |
|
|
| 283 |
|
void InteractionManager::doPrePair(InteractionData idat){ |
| 284 |
< |
|
| 285 |
< |
if (!initialized_) initialize(); |
| 284 |
> |
printf("%s\tERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", __FUNCTION__); |
| 285 |
> |
/* if (!initialized_) initialize(); |
| 286 |
|
|
| 287 |
+ |
// excluded interaction, so just return |
| 288 |
+ |
if (idat.excluded) return; |
| 289 |
+ |
|
| 290 |
|
set<NonBondedInteraction*>::iterator it; |
| 291 |
|
|
| 292 |
|
for (it = interactions_[ idat.atypes ].begin(); |
| 294 |
|
if ((*it)->getFamily() == METALLIC_FAMILY) { |
| 295 |
|
dynamic_cast<MetallicInteraction*>(*it)->calcDensity(idat); |
| 296 |
|
} |
| 297 |
< |
} |
| 297 |
> |
}*/ |
| 298 |
|
|
| 299 |
|
return; |
| 300 |
|
} |
| 301 |
|
|
| 302 |
+ |
void InteractionManager::initializeOMP() { |
| 303 |
+ |
if (!initialized_) initialize(); |
| 304 |
+ |
} |
| 305 |
+ |
|
| 306 |
+ |
void InteractionManager::doPrePairOMP(InteractionDataPrv idatThread){ |
| 307 |
+ |
InteractionData idat; |
| 308 |
+ |
// excluded interaction, so just return |
| 309 |
+ |
if (idat.excluded) return; |
| 310 |
+ |
|
| 311 |
+ |
wrapData(idatThread, idat); |
| 312 |
+ |
|
| 313 |
+ |
set<NonBondedInteraction*>::iterator it; |
| 314 |
+ |
|
| 315 |
+ |
for (it = interactions_[ idat.atypes ].begin(); |
| 316 |
+ |
it != interactions_[ idat.atypes ].end(); ++it){ |
| 317 |
+ |
if ((*it)->getFamily() == METALLIC_FAMILY) { |
| 318 |
+ |
dynamic_cast<MetallicInteraction*>(*it)->calcDensity(idat); |
| 319 |
+ |
} |
| 320 |
+ |
} |
| 321 |
+ |
|
| 322 |
+ |
return; |
| 323 |
+ |
} |
| 324 |
+ |
|
| 325 |
|
void InteractionManager::doPreForce(SelfData sdat){ |
| 326 |
|
|
| 327 |
|
if (!initialized_) initialize(); |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
void InteractionManager::doPair(InteractionData idat){ |
| 342 |
< |
|
| 343 |
< |
if (!initialized_) initialize(); |
| 344 |
< |
|
| 342 |
> |
printf("%s\tERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", __FUNCTION__); |
| 343 |
> |
/*if (!initialized_) initialize(); |
| 344 |
> |
|
| 345 |
|
set<NonBondedInteraction*>::iterator it; |
| 346 |
|
|
| 347 |
|
for (it = interactions_[ idat.atypes ].begin(); |
| 348 |
< |
it != interactions_[ idat.atypes ].end(); ++it) |
| 349 |
< |
(*it)->calcForce(idat); |
| 348 |
> |
it != interactions_[ idat.atypes ].end(); ++it) { |
| 349 |
> |
|
| 350 |
> |
// electrostatics still has to worry about indirect |
| 351 |
> |
// contributions from excluded pairs of atoms: |
| 352 |
> |
|
| 353 |
> |
if (!idat.excluded || (*it)->getFamily() == ELECTROSTATIC_FAMILY) { |
| 354 |
> |
(*it)->calcForce(idat); |
| 355 |
> |
} |
| 356 |
> |
}*/ |
| 357 |
|
|
| 358 |
|
return; |
| 359 |
|
} |
| 360 |
|
|
| 361 |
< |
void InteractionManager::doSkipCorrection(InteractionData idat){ |
| 361 |
> |
void InteractionManager::wrapData(InteractionDataPrv &src, InteractionData &dst) { |
| 362 |
> |
dst.A1 = src.A1; |
| 363 |
> |
dst.A2 = src.A2; |
| 364 |
> |
dst.atypes = src.atypes; |
| 365 |
> |
dst.d = &src.d; |
| 366 |
> |
dst.dfrho1 = src.dfrho1; |
| 367 |
> |
dst.dfrho2 = src.dfrho2; |
| 368 |
> |
dst.eFrame1 = src.eFrame1; |
| 369 |
> |
dst.eFrame2 = src.eFrame2; |
| 370 |
> |
dst.electroMult = &src.electroMult; |
| 371 |
> |
dst.excluded = src.excluded; |
| 372 |
> |
dst.f1 = &src.f1; |
| 373 |
> |
dst.frho1 = src.frho1; |
| 374 |
> |
dst.frho2 = src.frho2; |
| 375 |
> |
dst.particlePot1 = src.particlePot1; |
| 376 |
> |
dst.particlePot2 = src.particlePot2; |
| 377 |
> |
dst.pot = &src.pot; |
| 378 |
> |
dst.r2 = &src.r2; |
| 379 |
> |
dst.rcut = &src.rcut; |
| 380 |
> |
dst.rho1 = src.rho1; |
| 381 |
> |
dst.rho2 = src.rho2; |
| 382 |
> |
dst.rij = &src.rij; |
| 383 |
> |
dst.shiftedForce = src.shiftedForce; |
| 384 |
> |
dst.shiftedPot = src.shiftedPot; |
| 385 |
> |
dst.skippedCharge1 = src.skippedCharge1; |
| 386 |
> |
dst.skippedCharge2 = src.skippedCharge2; |
| 387 |
> |
dst.sw = &src.sw; |
| 388 |
> |
dst.t1 = src.t1; |
| 389 |
> |
dst.t2 = src.t2; |
| 390 |
> |
dst.topoDist = src.topoDist; |
| 391 |
> |
dst.vdwMult = &src.vdwMult; |
| 392 |
> |
dst.vpair = &src.vpair; |
| 393 |
> |
} |
| 394 |
|
|
| 395 |
< |
if (!initialized_) initialize(); |
| 318 |
< |
|
| 395 |
> |
void InteractionManager::doPairOMP(InteractionDataPrv &idatThread){ |
| 396 |
|
set<NonBondedInteraction*>::iterator it; |
| 397 |
+ |
InteractionData idat; |
| 398 |
|
|
| 399 |
< |
for (it = interactions_[ idat.atypes ].begin(); |
| 400 |
< |
it != interactions_[ idat.atypes ].end(); ++it){ |
| 401 |
< |
if ((*it)->getFamily() == ELECTROSTATIC_FAMILY) { |
| 402 |
< |
dynamic_cast<ElectrostaticInteraction*>(*it)->calcSkipCorrection(idat); |
| 399 |
> |
wrapData(idatThread, idat); |
| 400 |
> |
|
| 401 |
> |
for (it = interactions_[ idat.atypes ].begin(); |
| 402 |
> |
it != interactions_[ idat.atypes ].end(); ++it) { |
| 403 |
> |
|
| 404 |
> |
// electrostatics still has to worry about indirect |
| 405 |
> |
// contributions from excluded pairs of atoms: |
| 406 |
> |
|
| 407 |
> |
if (!idat.excluded || (*it)->getFamily() == ELECTROSTATIC_FAMILY) { |
| 408 |
> |
(*it)->calcForce(idat); |
| 409 |
|
} |
| 410 |
|
} |
| 411 |
< |
|
| 412 |
< |
return; |
| 411 |
> |
|
| 412 |
> |
return; |
| 413 |
|
} |
| 414 |
|
|
| 415 |
|
void InteractionManager::doSelfCorrection(SelfData sdat){ |