| 48 |
|
InteractionManager* InteractionManager::_instance = NULL; |
| 49 |
|
map<int, AtomType*> InteractionManager::typeMap_; |
| 50 |
|
map<pair<AtomType*, AtomType*>, set<NonBondedInteraction*> > InteractionManager::interactions_; |
| 51 |
+ |
|
| 52 |
+ |
LJ* InteractionManager::lj_ = new LJ(); |
| 53 |
+ |
GB* InteractionManager::gb_ = new GB(); |
| 54 |
+ |
Sticky* InteractionManager::sticky_ = new Sticky(); |
| 55 |
+ |
Morse* InteractionManager::morse_ = new Morse(); |
| 56 |
+ |
EAM* InteractionManager::eam_ = new EAM(); |
| 57 |
+ |
SC* InteractionManager::sc_ = new SC(); |
| 58 |
+ |
Electrostatic* InteractionManager::electrostatic_ = new Electrostatic(); |
| 59 |
|
|
| 60 |
|
InteractionManager* InteractionManager::Instance() { |
| 61 |
|
if (!_instance) { |
| 66 |
|
|
| 67 |
|
void InteractionManager::initialize() { |
| 68 |
|
|
| 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 |
– |
|
| 69 |
|
lj_->setForceField(forceField_); |
| 70 |
|
gb_->setForceField(forceField_); |
| 71 |
|
sticky_->setForceField(forceField_); |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
|
|
| 235 |
< |
void InteractionManager::do_prepair(int *atid1, int *atid2, RealType *rij, RealType *rho_i_at_j, RealType *rho_j_at_i){ |
| 235 |
> |
void InteractionManager::doPrePair(int *atid1, int *atid2, RealType *rij, RealType *rho_i_at_j, RealType *rho_j_at_i){ |
| 236 |
|
|
| 237 |
|
if (!initialized_) initialize(); |
| 238 |
|
|
| 256 |
|
return; |
| 257 |
|
} |
| 258 |
|
|
| 259 |
< |
void InteractionManager::do_preforce(int *atid, RealType *rho, RealType *frho, RealType *dfrhodrho){ |
| 259 |
> |
void InteractionManager::doPreForce(int *atid, RealType *rho, RealType *frho, RealType *dfrhodrho){ |
| 260 |
|
|
| 261 |
|
if (!initialized_) initialize(); |
| 262 |
|
|
| 279 |
|
return; |
| 280 |
|
} |
| 281 |
|
|
| 282 |
< |
void InteractionManager::do_pair(int *atid1, int *atid2, RealType *d, RealType *r, RealType *r2, RealType *rcut, RealType *sw, RealType *vdwMult,RealType *electroMult, RealType *pot, RealType *vpair, RealType *f1, RealType *eFrame1, RealType *eFrame2, RealType *A1, RealType *A2, RealType *t1, RealType *t2, RealType *rho1, RealType *rho2, RealType *dfrho1, RealType *dfrho2, RealType *fshift1, RealType *fshift2){ |
| 282 |
> |
void InteractionManager::doPair(int *atid1, int *atid2, RealType *d, RealType *r, RealType *r2, RealType *rcut, RealType *sw, RealType *vdwMult,RealType *electroMult, RealType *pot, RealType *vpair, RealType *f1, RealType *eFrame1, RealType *eFrame2, RealType *A1, RealType *A2, RealType *t1, RealType *t2, RealType *rho1, RealType *rho2, RealType *dfrho1, RealType *dfrho2, RealType *fshift1, RealType *fshift2){ |
| 283 |
|
|
| 284 |
|
if (!initialized_) initialize(); |
| 285 |
|
|
| 331 |
|
return; |
| 332 |
|
} |
| 333 |
|
|
| 334 |
< |
void InteractionManager::do_skip_correction(int *atid1, int *atid2, RealType *d, RealType *r, RealType *skippedCharge1, RealType *skippedCharge2, RealType *sw, RealType *electroMult, RealType *pot, RealType *vpair, RealType *f1, RealType *eFrame1, RealType *eFrame2, RealType *t1, RealType *t2){ |
| 334 |
> |
void InteractionManager::doSkipCorrection(int *atid1, int *atid2, RealType *d, RealType *r, RealType *skippedCharge1, RealType *skippedCharge2, RealType *sw, RealType *electroMult, RealType *pot, RealType *vpair, RealType *f1, RealType *eFrame1, RealType *eFrame2, RealType *t1, RealType *t2){ |
| 335 |
|
|
| 336 |
|
if (!initialized_) initialize(); |
| 337 |
|
|
| 377 |
|
return; |
| 378 |
|
} |
| 379 |
|
|
| 380 |
< |
void InteractionManager::do_self_correction(int *atid, RealType *eFrame, RealType *skippedCharge, RealType *pot, RealType *t){ |
| 380 |
> |
void InteractionManager::doSelfCorrection(int *atid, RealType *eFrame, RealType *skippedCharge, RealType *pot, RealType *t){ |
| 381 |
|
|
| 382 |
|
if (!initialized_) initialize(); |
| 383 |
|
|
| 403 |
|
t[2] = scdat.t.z(); |
| 404 |
|
|
| 405 |
|
return; |
| 406 |
+ |
} |
| 407 |
+ |
|
| 408 |
+ |
|
| 409 |
+ |
RealType InteractionManager::getSuggestedCutoffRadius(int *atid) { |
| 410 |
+ |
if (!initialized_) initialize(); |
| 411 |
+ |
|
| 412 |
+ |
AtomType* atype = typeMap_[*atid]; |
| 413 |
+ |
|
| 414 |
+ |
pair<AtomType*, AtomType*> key = make_pair(atype, atype); |
| 415 |
+ |
set<NonBondedInteraction*>::iterator it; |
| 416 |
+ |
RealType cutoff = 0.0; |
| 417 |
+ |
|
| 418 |
+ |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it) |
| 419 |
+ |
cutoff = max(cutoff, (*it)->getSuggestedCutoffRadius(atype, atype)); |
| 420 |
+ |
return cutoff; |
| 421 |
|
} |
| 422 |
|
|
| 423 |
+ |
RealType InteractionManager::getSuggestedCutoffRadius(AtomType* atype) { |
| 424 |
+ |
if (!initialized_) initialize(); |
| 425 |
+ |
|
| 426 |
+ |
pair<AtomType*, AtomType*> key = make_pair(atype, atype); |
| 427 |
+ |
set<NonBondedInteraction*>::iterator it; |
| 428 |
+ |
RealType cutoff = 0.0; |
| 429 |
+ |
|
| 430 |
+ |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it) |
| 431 |
+ |
cutoff = max(cutoff, (*it)->getSuggestedCutoffRadius(atype, atype)); |
| 432 |
+ |
return cutoff; |
| 433 |
+ |
} |
| 434 |
+ |
|
| 435 |
|
} //end namespace OpenMD |
| 436 |
|
|
| 437 |
|
extern "C" { |
| 446 |
|
void fortranDoPrePair(int *atid1, int *atid2, RealType *rij, |
| 447 |
|
RealType *rho_i_at_j, RealType *rho_j_at_i) { |
| 448 |
|
|
| 449 |
< |
return OpenMD::InteractionManager::Instance()->do_prepair(atid1, atid2, rij, |
| 450 |
< |
rho_i_at_j, |
| 451 |
< |
rho_j_at_i); |
| 449 |
> |
return OpenMD::InteractionManager::Instance()->doPrePair(atid1, atid2, rij, |
| 450 |
> |
rho_i_at_j, |
| 451 |
> |
rho_j_at_i); |
| 452 |
|
} |
| 453 |
< |
void fortranDoPreforce(int *atid, RealType *rho, RealType *frho, |
| 453 |
> |
void fortranDoPreForce(int *atid, RealType *rho, RealType *frho, |
| 454 |
|
RealType *dfrhodrho) { |
| 455 |
|
|
| 456 |
< |
return OpenMD::InteractionManager::Instance()->do_preforce(atid, rho, frho, |
| 457 |
< |
dfrhodrho); |
| 456 |
> |
return OpenMD::InteractionManager::Instance()->doPreForce(atid, rho, frho, |
| 457 |
> |
dfrhodrho); |
| 458 |
|
} |
| 459 |
|
|
| 460 |
|
void fortranDoPair(int *atid1, int *atid2, RealType *d, RealType *r, |
| 466 |
|
RealType *dfrho1, RealType *dfrho2, RealType *fshift1, |
| 467 |
|
RealType *fshift2){ |
| 468 |
|
|
| 469 |
< |
return OpenMD::InteractionManager::Instance()->do_pair(atid1, atid2, d, r, r2, rcut, |
| 470 |
< |
sw, vdwMult, electroMult, pot, |
| 471 |
< |
vpair, f1, eFrame1, eFrame2, |
| 472 |
< |
A1, A2, t1, t2, rho1, rho2, |
| 473 |
< |
dfrho1, dfrho2, fshift1, fshift2); |
| 469 |
> |
return OpenMD::InteractionManager::Instance()->doPair(atid1, atid2, d, r, |
| 470 |
> |
r2, rcut, sw, |
| 471 |
> |
vdwMult, electroMult, |
| 472 |
> |
pot, vpair, f1, |
| 473 |
> |
eFrame1, eFrame2, |
| 474 |
> |
A1, A2, t1, t2, rho1, |
| 475 |
> |
rho2, dfrho1, dfrho2, |
| 476 |
> |
fshift1, fshift2); |
| 477 |
|
} |
| 478 |
< |
|
| 479 |
< |
void fortranDoSkipCorrection(int *atid1, int *atid2, RealType *d, RealType *r, |
| 480 |
< |
RealType *skippedCharge1, RealType *skippedCharge2, |
| 481 |
< |
RealType *sw, RealType *electroMult, RealType *pot, |
| 478 |
> |
|
| 479 |
> |
void fortranDoSkipCorrection(int *atid1, int *atid2, RealType *d, |
| 480 |
> |
RealType *r, RealType *skippedCharge1, |
| 481 |
> |
RealType *skippedCharge2, RealType *sw, |
| 482 |
> |
RealType *electroMult, RealType *pot, |
| 483 |
|
RealType *vpair, RealType *f1, |
| 484 |
|
RealType *eFrame1, RealType *eFrame2, |
| 485 |
|
RealType *t1, RealType *t2){ |
| 486 |
|
|
| 487 |
< |
return OpenMD::InteractionManager::Instance()->do_skip_correction(atid1, atid2, d, r, |
| 488 |
< |
skippedCharge1, |
| 489 |
< |
skippedCharge2, |
| 490 |
< |
sw, electroMult, pot, |
| 491 |
< |
vpair, f1, eFrame1, |
| 492 |
< |
eFrame2, t1, t2); |
| 487 |
> |
return OpenMD::InteractionManager::Instance()->doSkipCorrection(atid1, |
| 488 |
> |
atid2, d, |
| 489 |
> |
r, |
| 490 |
> |
skippedCharge1, |
| 491 |
> |
skippedCharge2, |
| 492 |
> |
sw, electroMult, pot, |
| 493 |
> |
vpair, f1, eFrame1, |
| 494 |
> |
eFrame2, t1, t2); |
| 495 |
|
} |
| 496 |
< |
|
| 496 |
> |
|
| 497 |
|
void fortranDoSelfCorrection(int *atid, RealType *eFrame, RealType *skippedCharge, |
| 498 |
|
RealType *pot, RealType *t) { |
| 499 |
|
|
| 500 |
< |
return OpenMD::InteractionManager::Instance()->do_self_correction(atid, eFrame, |
| 501 |
< |
skippedCharge, |
| 502 |
< |
pot, t); |
| 500 |
> |
return OpenMD::InteractionManager::Instance()->doSelfCorrection(atid, |
| 501 |
> |
eFrame, |
| 502 |
> |
skippedCharge, |
| 503 |
> |
pot, t); |
| 504 |
|
} |
| 505 |
< |
RealType fortranGetCutoff() { |
| 506 |
< |
return OpenMD::InteractionManager::Instance()->getCutoff(); |
| 505 |
> |
RealType fortranGetCutoff(int *atid) { |
| 506 |
> |
return OpenMD::InteractionManager::Instance()->getSuggestedCutoffRadius(atid); |
| 507 |
|
} |
| 508 |
|
} |