| 231 |
|
} |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
– |
|
| 235 |
– |
|
| 236 |
– |
void InteractionManager::doPrePair(AtomType* atype1, |
| 237 |
– |
AtomType* atype2, |
| 238 |
– |
RealType rij, |
| 239 |
– |
RealType &rho_i_at_j, |
| 240 |
– |
RealType &rho_j_at_i) { |
| 241 |
– |
|
| 242 |
– |
} |
| 234 |
|
|
| 244 |
– |
void InteractionManager::doPreForce(AtomType* atype, |
| 245 |
– |
RealType rho, |
| 246 |
– |
RealType &frho, |
| 247 |
– |
RealType &dfrhodrho) { |
| 248 |
– |
} |
| 249 |
– |
|
| 250 |
– |
void InteractionManager::doSkipCorrection(AtomType* atype1, |
| 251 |
– |
AtomType* atype2, |
| 252 |
– |
Vector3d d, |
| 253 |
– |
RealType rij, |
| 254 |
– |
RealType &skippedCharge1, |
| 255 |
– |
RealType &skippedCharge2, |
| 256 |
– |
RealType sw, |
| 257 |
– |
RealType electroMult, |
| 258 |
– |
RealType &pot, |
| 259 |
– |
RealType &vpair, |
| 260 |
– |
Vector3d &f1, |
| 261 |
– |
Mat3x3d eFrame1, |
| 262 |
– |
Mat3x3d eFrame2, |
| 263 |
– |
Vector3d &t1, |
| 264 |
– |
Vector3d &t2) { |
| 265 |
– |
} |
| 266 |
– |
|
| 267 |
– |
void InteractionManager::doSelfCorrection(AtomType* atype, |
| 268 |
– |
Mat3x3d eFrame, |
| 269 |
– |
RealType skippedCharge, |
| 270 |
– |
RealType &pot, |
| 271 |
– |
Vector3d &t) { |
| 272 |
– |
} |
| 273 |
– |
|
| 235 |
|
void InteractionManager::do_prepair(int *atid1, int *atid2, RealType *rij, RealType *rho_i_at_j, RealType *rho_j_at_i){ |
| 236 |
|
|
| 237 |
|
if (!initialized_) initialize(); |
| 238 |
< |
AtomType* atype1 = typeMap_[*atid1]; |
| 239 |
< |
AtomType* atype2 = typeMap_[*atid2]; |
| 240 |
< |
|
| 241 |
< |
doPrePair(atype1, atype2, *rij, *rho_i_at_j, *rho_j_at_i); |
| 238 |
> |
|
| 239 |
> |
DensityData ddat; |
| 240 |
> |
|
| 241 |
> |
ddat.atype1 = typeMap_[*atid1]; |
| 242 |
> |
ddat.atype2 = typeMap_[*atid2]; |
| 243 |
> |
ddat.rij = *rij; |
| 244 |
> |
ddat.rho_i_at_j = *rho_i_at_j; |
| 245 |
> |
ddat.rho_j_at_i = *rho_j_at_i; |
| 246 |
> |
|
| 247 |
> |
pair<AtomType*, AtomType*> key = make_pair(ddat.atype1, ddat.atype2); |
| 248 |
> |
set<NonBondedInteraction*>::iterator it; |
| 249 |
> |
|
| 250 |
> |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it){ |
| 251 |
> |
if ((*it)->getFamily() == METALLIC_FAMILY) { |
| 252 |
> |
dynamic_cast<MetallicInteraction*>(*it)->calcDensity(ddat); |
| 253 |
> |
} |
| 254 |
> |
} |
| 255 |
|
|
| 256 |
|
return; |
| 257 |
|
} |
| 258 |
< |
|
| 258 |
> |
|
| 259 |
|
void InteractionManager::do_preforce(int *atid, RealType *rho, RealType *frho, RealType *dfrhodrho){ |
| 260 |
|
|
| 261 |
< |
if (!initialized_) initialize(); |
| 262 |
< |
AtomType* atype = typeMap_[*atid]; |
| 261 |
> |
if (!initialized_) initialize(); |
| 262 |
> |
|
| 263 |
> |
FunctionalData fdat; |
| 264 |
|
|
| 265 |
< |
doPreForce(atype, *rho, *frho, *dfrhodrho); |
| 265 |
> |
fdat.atype = typeMap_[*atid]; |
| 266 |
> |
fdat.rho = *rho; |
| 267 |
> |
fdat.frho = *frho; |
| 268 |
> |
fdat.dfrhodrho = *dfrhodrho; |
| 269 |
> |
|
| 270 |
> |
pair<AtomType*, AtomType*> key = make_pair(fdat.atype, fdat.atype); |
| 271 |
> |
set<NonBondedInteraction*>::iterator it; |
| 272 |
|
|
| 273 |
+ |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it){ |
| 274 |
+ |
if ((*it)->getFamily() == METALLIC_FAMILY) { |
| 275 |
+ |
dynamic_cast<MetallicInteraction*>(*it)->calcFunctional(fdat); |
| 276 |
+ |
} |
| 277 |
+ |
} |
| 278 |
+ |
|
| 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){ |
| 283 |
< |
|
| 283 |
> |
|
| 284 |
|
if (!initialized_) initialize(); |
| 285 |
< |
|
| 285 |
> |
|
| 286 |
|
InteractionData idat; |
| 287 |
< |
|
| 287 |
> |
|
| 288 |
|
idat.atype1 = typeMap_[*atid1]; |
| 289 |
|
idat.atype2 = typeMap_[*atid2]; |
| 290 |
|
idat.d = Vector3d(d); |
| 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){ |
| 335 |
|
|
| 336 |
|
if (!initialized_) initialize(); |
| 337 |
< |
|
| 338 |
< |
AtomType* atype1 = typeMap_[*atid1]; |
| 339 |
< |
AtomType* atype2 = typeMap_[*atid2]; |
| 340 |
< |
Vector3d disp(d); |
| 341 |
< |
Vector3d frc(f1); |
| 342 |
< |
Vector3d trq1(t1); |
| 343 |
< |
Vector3d trq2(t2); |
| 344 |
< |
Mat3x3d eFi(eFrame1); |
| 345 |
< |
Mat3x3d eFj(eFrame2); |
| 346 |
< |
|
| 347 |
< |
doSkipCorrection(atype1, atype2, disp, *r, *skippedCharge1, *skippedCharge2, *sw, |
| 348 |
< |
*electroMult, *pot, *vpair, frc, eFi, eFj, trq1, trq2); |
| 337 |
> |
|
| 338 |
> |
SkipCorrectionData skdat; |
| 339 |
> |
|
| 340 |
> |
skdat.atype1 = typeMap_[*atid1]; |
| 341 |
> |
skdat.atype2 = typeMap_[*atid2]; |
| 342 |
> |
skdat.d = Vector3d(d); |
| 343 |
> |
skdat.rij = *r; |
| 344 |
> |
skdat.skippedCharge1 = *skippedCharge1; |
| 345 |
> |
skdat.skippedCharge2 = *skippedCharge2; |
| 346 |
> |
skdat.sw = *sw; |
| 347 |
> |
skdat.electroMult = *electroMult; |
| 348 |
> |
skdat.pot = *pot; |
| 349 |
> |
skdat.vpair = *vpair; |
| 350 |
> |
skdat.f1 = Vector3d(f1); |
| 351 |
> |
skdat.eFrame1 = Mat3x3d(eFrame1); |
| 352 |
> |
skdat.eFrame2 = Mat3x3d(eFrame2); |
| 353 |
> |
skdat.t1 = Vector3d(t1); |
| 354 |
> |
skdat.t2 = Vector3d(t2); |
| 355 |
|
|
| 356 |
< |
f1[0] = frc.x(); |
| 357 |
< |
f1[1] = frc.y(); |
| 358 |
< |
f1[2] = frc.z(); |
| 356 |
> |
pair<AtomType*, AtomType*> key = make_pair(skdat.atype1, skdat.atype2); |
| 357 |
> |
set<NonBondedInteraction*>::iterator it; |
| 358 |
> |
|
| 359 |
> |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it){ |
| 360 |
> |
if ((*it)->getFamily() == ELECTROSTATIC_FAMILY) { |
| 361 |
> |
dynamic_cast<ElectrostaticInteraction*>(*it)->calcSkipCorrection(skdat); |
| 362 |
> |
} |
| 363 |
> |
} |
| 364 |
|
|
| 365 |
< |
t1[0] = trq1.x(); |
| 366 |
< |
t1[1] = trq1.y(); |
| 367 |
< |
t1[2] = trq1.z(); |
| 365 |
> |
f1[0] = skdat.f1.x(); |
| 366 |
> |
f1[1] = skdat.f1.y(); |
| 367 |
> |
f1[2] = skdat.f1.z(); |
| 368 |
|
|
| 369 |
< |
t2[0] = trq2.x(); |
| 370 |
< |
t2[1] = trq2.y(); |
| 371 |
< |
t2[2] = trq2.z(); |
| 369 |
> |
t1[0] = skdat.t1.x(); |
| 370 |
> |
t1[1] = skdat.t1.y(); |
| 371 |
> |
t1[2] = skdat.t1.z(); |
| 372 |
> |
|
| 373 |
> |
t2[0] = skdat.t2.x(); |
| 374 |
> |
t2[1] = skdat.t2.y(); |
| 375 |
> |
t2[2] = skdat.t2.z(); |
| 376 |
|
|
| 377 |
< |
return; |
| 377 |
> |
return; |
| 378 |
|
} |
| 379 |
|
|
| 380 |
|
void InteractionManager::do_self_correction(int *atid, RealType *eFrame, RealType *skippedCharge, RealType *pot, RealType *t){ |
| 381 |
|
|
| 382 |
|
if (!initialized_) initialize(); |
| 383 |
< |
|
| 384 |
< |
AtomType* atype = typeMap_[*atid]; |
| 385 |
< |
Mat3x3d eFi(eFrame); |
| 386 |
< |
Vector3d trq1(t); |
| 387 |
< |
|
| 388 |
< |
doSelfCorrection(atype, eFi, *skippedCharge, *pot, trq1); |
| 383 |
> |
|
| 384 |
> |
SelfCorrectionData scdat; |
| 385 |
> |
|
| 386 |
> |
scdat.atype = typeMap_[*atid]; |
| 387 |
> |
scdat.eFrame = Mat3x3d(eFrame); |
| 388 |
> |
scdat.skippedCharge = *skippedCharge; |
| 389 |
> |
scdat.pot = *pot; |
| 390 |
> |
scdat.t = Vector3d(t); |
| 391 |
|
|
| 392 |
< |
t[0] = trq1.x(); |
| 393 |
< |
t[1] = trq1.y(); |
| 390 |
< |
t[2] = trq1.z(); |
| 392 |
> |
pair<AtomType*, AtomType*> key = make_pair(scdat.atype, scdat.atype); |
| 393 |
> |
set<NonBondedInteraction*>::iterator it; |
| 394 |
|
|
| 395 |
< |
return; |
| 395 |
> |
for (it = interactions_[key].begin(); it != interactions_[key].end(); ++it){ |
| 396 |
> |
if ((*it)->getFamily() == ELECTROSTATIC_FAMILY) { |
| 397 |
> |
dynamic_cast<ElectrostaticInteraction*>(*it)->calcSelfCorrection(scdat); |
| 398 |
> |
} |
| 399 |
> |
} |
| 400 |
> |
|
| 401 |
> |
t[0] = scdat.t.x(); |
| 402 |
> |
t[1] = scdat.t.y(); |
| 403 |
> |
t[2] = scdat.t.z(); |
| 404 |
> |
|
| 405 |
> |
return; |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
} //end namespace OpenMD |
| 431 |
|
} |
| 432 |
|
|
| 433 |
|
void fortranDoPair(int *atid1, int *atid2, RealType *d, RealType *r, |
| 434 |
< |
RealType *r2, RealType *rcut, RealType *sw, RealType *vdwMult, |
| 435 |
< |
RealType *electroMult, RealType *pot, RealType *vpair, RealType *f1, |
| 436 |
< |
RealType *eFrame1, RealType *eFrame2, RealType *A1, RealType *A2, |
| 437 |
< |
RealType *t1, RealType *t2, |
| 438 |
< |
RealType *rho1, RealType *rho2, RealType *dfrho1, RealType *dfrho2, |
| 439 |
< |
RealType *fshift1, RealType *fshift2){ |
| 434 |
> |
RealType *r2, RealType *rcut, RealType *sw, |
| 435 |
> |
RealType *vdwMult, RealType *electroMult, RealType *pot, |
| 436 |
> |
RealType *vpair, RealType *f1, RealType *eFrame1, |
| 437 |
> |
RealType *eFrame2, RealType *A1, RealType *A2, |
| 438 |
> |
RealType *t1, RealType *t2, RealType *rho1, RealType *rho2, |
| 439 |
> |
RealType *dfrho1, RealType *dfrho2, RealType *fshift1, |
| 440 |
> |
RealType *fshift2){ |
| 441 |
|
|
| 442 |
|
return OpenMD::InteractionManager::Instance()->do_pair(atid1, atid2, d, r, r2, rcut, |
| 443 |
|
sw, vdwMult, electroMult, pot, |