40 |
|
*/ |
41 |
|
|
42 |
|
#include "nonbonded/InteractionManager.hpp" |
43 |
– |
#include "UseTheForce/doForces_interface.h" |
43 |
|
|
44 |
|
namespace OpenMD { |
45 |
|
|
49 |
|
|
50 |
|
RealType InteractionManager::rCut_ = 0.0; |
51 |
|
RealType InteractionManager::rSwitch_ = 0.0; |
53 |
– |
RealType InteractionManager::skinThickness_ = 0.0; |
54 |
– |
RealType InteractionManager::listRadius_ = 0.0; |
52 |
|
CutoffMethod InteractionManager::cutoffMethod_ = SHIFTED_FORCE; |
53 |
|
SwitchingFunctionType InteractionManager::sft_ = cubic; |
54 |
|
RealType InteractionManager::vdwScale_[4] = {1.0, 0.0, 0.0, 0.0}; |
303 |
|
|
304 |
|
setupCutoffs(); |
305 |
|
setupSwitching(); |
309 |
– |
setupNeighborlists(); |
306 |
|
|
307 |
|
//int ljsp = cutoffMethod_ == SHIFTED_POTENTIAL ? 1 : 0; |
308 |
|
//int ljsf = cutoffMethod_ == SHIFTED_FORCE ? 1 : 0; |
309 |
|
//notifyFortranCutoffs(&rCut_, &rSwitch_, &ljsp, &ljsf); |
314 |
– |
//notifyFortranSkinThickness(&skinThickness_); |
310 |
|
|
311 |
|
initialized_ = true; |
312 |
|
} |
452 |
|
|
453 |
|
switcher_->setSwitchType(sft_); |
454 |
|
switcher_->setSwitch(rSwitch_, rCut_); |
460 |
– |
} |
461 |
– |
|
462 |
– |
/** |
463 |
– |
* setupNeighborlists |
464 |
– |
* |
465 |
– |
* If the skinThickness was explicitly set, use that value (but check it) |
466 |
– |
* If the skinThickness was not explicitly set: use 1.0 angstroms |
467 |
– |
*/ |
468 |
– |
void InteractionManager::setupNeighborlists() { |
469 |
– |
|
470 |
– |
Globals* simParams_ = info_->getSimParams(); |
471 |
– |
|
472 |
– |
if (simParams_->haveSkinThickness()) { |
473 |
– |
skinThickness_ = simParams_->getSkinThickness(); |
474 |
– |
} else { |
475 |
– |
skinThickness_ = 1.0; |
476 |
– |
sprintf(painCave.errMsg, |
477 |
– |
"InteractionManager::setupNeighborlists: No value was set for the skinThickness.\n" |
478 |
– |
"\tOpenMD will use a default value of %f Angstroms\n" |
479 |
– |
"\tfor this simulation\n", skinThickness_); |
480 |
– |
painCave.severity = OPENMD_INFO; |
481 |
– |
painCave.isFatal = 0; |
482 |
– |
simError(); |
483 |
– |
} |
484 |
– |
|
485 |
– |
listRadius_ = rCut_ + skinThickness_; |
455 |
|
} |
456 |
|
|
488 |
– |
|
457 |
|
void InteractionManager::doPrePair(InteractionData idat){ |
458 |
|
|
459 |
|
if (!initialized_) initialize(); |
460 |
|
|
461 |
|
set<NonBondedInteraction*>::iterator it; |
462 |
|
|
463 |
< |
for (it = interactions_[idat.atypes].begin(); |
464 |
< |
it != interactions_[idat.atypes].end(); ++it){ |
463 |
> |
for (it = interactions_[ *(idat.atypes) ].begin(); |
464 |
> |
it != interactions_[ *(idat.atypes) ].end(); ++it){ |
465 |
|
if ((*it)->getFamily() == METALLIC_FAMILY) { |
466 |
|
dynamic_cast<MetallicInteraction*>(*it)->calcDensity(idat); |
467 |
|
} |
492 |
|
|
493 |
|
set<NonBondedInteraction*>::iterator it; |
494 |
|
|
495 |
< |
for (it = interactions_[idat.atypes].begin(); |
496 |
< |
it != interactions_[idat.atypes].end(); ++it) |
495 |
> |
for (it = interactions_[ *(idat.atypes) ].begin(); |
496 |
> |
it != interactions_[ *(idat.atypes) ].end(); ++it) |
497 |
|
(*it)->calcForce(idat); |
498 |
|
|
499 |
|
return; |
505 |
|
|
506 |
|
set<NonBondedInteraction*>::iterator it; |
507 |
|
|
508 |
< |
for (it = interactions_[idat.atypes].begin(); |
509 |
< |
it != interactions_[idat.atypes].end(); ++it){ |
508 |
> |
for (it = interactions_[ *(idat.atypes) ].begin(); |
509 |
> |
it != interactions_[ *(idat.atypes) ].end(); ++it){ |
510 |
|
if ((*it)->getFamily() == ELECTROSTATIC_FAMILY) { |
511 |
|
dynamic_cast<ElectrostaticInteraction*>(*it)->calcSkipCorrection(idat); |
512 |
|
} |