44 |
|
namespace OpenMD { |
45 |
|
|
46 |
|
bool InteractionManager::initialized_ = false; |
47 |
+ |
RealType InteractionManager::rCut_ = -1.0; |
48 |
+ |
RealType InteractionManager::rSwitch_ = -1.0; |
49 |
|
ForceField* InteractionManager::forceField_ = NULL; |
50 |
|
InteractionManager* InteractionManager::_instance = NULL; |
51 |
|
map<int, AtomType*> InteractionManager::typeMap_; |
52 |
|
map<pair<AtomType*, AtomType*>, set<NonBondedInteraction*> > InteractionManager::interactions_; |
53 |
+ |
|
54 |
+ |
LJ* InteractionManager::lj_ = new LJ(); |
55 |
+ |
GB* InteractionManager::gb_ = new GB(); |
56 |
+ |
Sticky* InteractionManager::sticky_ = new Sticky(); |
57 |
+ |
Morse* InteractionManager::morse_ = new Morse(); |
58 |
+ |
EAM* InteractionManager::eam_ = new EAM(); |
59 |
+ |
SC* InteractionManager::sc_ = new SC(); |
60 |
+ |
Electrostatic* InteractionManager::electrostatic_ = new Electrostatic(); |
61 |
|
|
62 |
|
InteractionManager* InteractionManager::Instance() { |
63 |
|
if (!_instance) { |
68 |
|
|
69 |
|
void InteractionManager::initialize() { |
70 |
|
|
61 |
– |
lj_ = new LJ(); |
62 |
– |
gb_ = new GB(); |
63 |
– |
sticky_ = new Sticky(); |
64 |
– |
eam_ = new EAM(); |
65 |
– |
sc_ = new SC(); |
66 |
– |
morse_ = new Morse(); |
67 |
– |
electrostatic_ = new Electrostatic(); |
68 |
– |
|
71 |
|
lj_->setForceField(forceField_); |
72 |
|
gb_->setForceField(forceField_); |
73 |
|
sticky_->setForceField(forceField_); |
422 |
|
return cutoff; |
423 |
|
} |
424 |
|
|
425 |
+ |
RealType InteractionManager::getSuggestedCutoffRadius(AtomType* atype) { |
426 |
+ |
if (!initialized_) initialize(); |
427 |
+ |
|
428 |
+ |
pair<AtomType*, AtomType*> key = make_pair(atype, atype); |
429 |
+ |
set<NonBondedInteraction*>::iterator it; |
430 |
+ |
RealType cutoff = 0.0; |
431 |
+ |
|
432 |
+ |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it) |
433 |
+ |
cutoff = max(cutoff, (*it)->getSuggestedCutoffRadius(atype, atype)); |
434 |
+ |
return cutoff; |
435 |
+ |
} |
436 |
+ |
|
437 |
|
} //end namespace OpenMD |
438 |
|
|
439 |
|
extern "C" { |
452 |
|
rho_i_at_j, |
453 |
|
rho_j_at_i); |
454 |
|
} |
455 |
< |
void fortranDoPreforce(int *atid, RealType *rho, RealType *frho, |
455 |
> |
void fortranDoPreForce(int *atid, RealType *rho, RealType *frho, |
456 |
|
RealType *dfrhodrho) { |
457 |
|
|
458 |
|
return OpenMD::InteractionManager::Instance()->doPreForce(atid, rho, frho, |