| 48 |
|
#include "utils/simError.h" |
| 49 |
|
#include "types/NonBondedInteractionType.hpp" |
| 50 |
|
#include "types/FixedChargeAdapter.hpp" |
| 51 |
+ |
#include "types/FluctuatingChargeAdapter.hpp" |
| 52 |
|
#include "types/MultipoleAdapter.hpp" |
| 53 |
|
#include "io/Globals.hpp" |
| 54 |
|
#include "nonbonded/SlaterIntegrals.hpp" |
| 289 |
|
|
| 290 |
|
if (fca.isFixedCharge()) { |
| 291 |
|
electrostaticAtomData.is_Charge = true; |
| 292 |
< |
electrostaticAtomData.charge = fca.getCharge(); |
| 292 |
> |
electrostaticAtomData.fixedCharge = fca.getCharge(); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
MultipoleAdapter ma = MultipoleAdapter(atomType); |
| 316 |
|
FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atomType); |
| 317 |
|
|
| 318 |
|
if (fqa.isFluctuatingCharge()) { |
| 319 |
< |
electrostaticAtomData.is_FluctuatingCharge = true; |
| 320 |
< |
electrostaticAtomData.electronegativity = fca.getElectronegativity(); |
| 321 |
< |
electrostaticAtomData.hardness = fca.getHardness(); |
| 322 |
< |
electrostaticAtomData.slaterN = fca.getSlaterN(); |
| 323 |
< |
electrostaticAtomData.slaterZeta = fca.getSlaterZeta(); |
| 319 |
> |
electrostaticAtomData.is_Fluctuating = true; |
| 320 |
> |
electrostaticAtomData.electronegativity = fqa.getElectronegativity(); |
| 321 |
> |
electrostaticAtomData.hardness = fqa.getHardness(); |
| 322 |
> |
electrostaticAtomData.slaterN = fqa.getSlaterN(); |
| 323 |
> |
electrostaticAtomData.slaterZeta = fqa.getSlaterZeta(); |
| 324 |
> |
} else { |
| 325 |
> |
electrostaticAtomData.is_Fluctuating = false; |
| 326 |
|
} |
| 327 |
|
|
| 328 |
|
pair<map<int,AtomType*>::iterator,bool> ret; |
| 344 |
|
map<AtomType*, ElectrostaticAtomData>::iterator it; |
| 345 |
|
for( it = ElectrostaticMap.begin(); it != ElectrostaticMap.end(); ++it) { |
| 346 |
|
AtomType* atype2 = (*it).first; |
| 347 |
< |
|
| 348 |
< |
if ((*it).is_FluctuatingCharge && electrostaticAtomData.is_FluctuatingCharge) { |
| 347 |
> |
ElectrostaticAtomData eaData2 = (*it).second; |
| 348 |
> |
if (eaData2.is_Fluctuating && electrostaticAtomData.is_Fluctuating) { |
| 349 |
|
|
| 350 |
|
RealType a = electrostaticAtomData.slaterZeta; |
| 351 |
< |
RealType b = (*it).slaterZeta; |
| 351 |
> |
RealType b = eaData2.slaterZeta; |
| 352 |
|
int m = electrostaticAtomData.slaterN; |
| 353 |
< |
int n = (*it).slaterN; |
| 353 |
> |
int n = eaData2.slaterN; |
| 354 |
|
|
| 355 |
|
// Create the spline of the coulombic integral for s-type |
| 356 |
|
// Slater orbitals. Add a 2 angstrom safety window to deal |
| 357 |
|
// with cutoffGroups that have charged atoms longer than the |
| 358 |
|
// cutoffRadius away from each other. |
| 359 |
|
|
| 360 |
+ |
RealType rval; |
| 361 |
|
RealType dr = (cutoffRadius_ + 2.0) / RealType(np_ - 1); |
| 362 |
|
vector<RealType> rvals; |
| 363 |
|
vector<RealType> J1vals; |
| 366 |
|
rval = RealType(i) * dr; |
| 367 |
|
rvals.push_back(rval); |
| 368 |
|
J1vals.push_back( sSTOCoulInt( a, b, m, n, rval * PhysicalConstants::angstromsToBohr ) ); |
| 369 |
+ |
// may not be necessary if Slater coulomb integral is symmetric |
| 370 |
|
J2vals.push_back( sSTOCoulInt( b, a, n, m, rval * PhysicalConstants::angstromsToBohr ) ); |
| 371 |
|
} |
| 372 |
|
|
| 373 |
< |
CubicSpline J1 = new CubicSpline(); |
| 373 |
> |
CubicSpline* J1 = new CubicSpline(); |
| 374 |
|
J1->addPoints(rvals, J1vals); |
| 375 |
< |
CubicSpline J2 = new CubicSpline(); |
| 375 |
> |
CubicSpline* J2 = new CubicSpline(); |
| 376 |
|
J2->addPoints(rvals, J2vals); |
| 377 |
|
|
| 378 |
|
pair<AtomType*, AtomType*> key1, key2; |
| 451 |
|
|
| 452 |
|
pair<RealType, RealType> res; |
| 453 |
|
|
| 454 |
+ |
// splines for coulomb integrals |
| 455 |
+ |
CubicSpline* J1; |
| 456 |
+ |
CubicSpline* J2; |
| 457 |
+ |
|
| 458 |
|
if (!initialized_) initialize(); |
| 459 |
|
|
| 460 |
|
ElectrostaticAtomData data1 = ElectrostaticMap[idat.atypes.first]; |
| 471 |
|
bool i_is_Dipole = data1.is_Dipole; |
| 472 |
|
bool i_is_SplitDipole = data1.is_SplitDipole; |
| 473 |
|
bool i_is_Quadrupole = data1.is_Quadrupole; |
| 474 |
+ |
bool i_is_Fluctuating = data1.is_Fluctuating; |
| 475 |
|
|
| 476 |
|
bool j_is_Charge = data2.is_Charge; |
| 477 |
|
bool j_is_Dipole = data2.is_Dipole; |
| 478 |
|
bool j_is_SplitDipole = data2.is_SplitDipole; |
| 479 |
|
bool j_is_Quadrupole = data2.is_Quadrupole; |
| 480 |
+ |
bool j_is_Fluctuating = data2.is_Fluctuating; |
| 481 |
|
|
| 482 |
|
if (i_is_Charge) { |
| 483 |
< |
q_i = data1.charge; |
| 483 |
> |
q_i = data1.fixedCharge; |
| 484 |
> |
|
| 485 |
> |
if (i_is_Fluctuating) { |
| 486 |
> |
q_i += *(idat.flucQ1); |
| 487 |
> |
} |
| 488 |
> |
|
| 489 |
|
if (idat.excluded) { |
| 490 |
|
*(idat.skippedCharge2) += q_i; |
| 491 |
|
} |
| 523 |
|
} |
| 524 |
|
|
| 525 |
|
if (j_is_Charge) { |
| 526 |
< |
q_j = data2.charge; |
| 526 |
> |
q_j = data2.fixedCharge; |
| 527 |
> |
|
| 528 |
> |
if (i_is_Fluctuating) |
| 529 |
> |
q_j += *(idat.flucQ2); |
| 530 |
> |
|
| 531 |
|
if (idat.excluded) { |
| 532 |
|
*(idat.skippedCharge1) += q_j; |
| 533 |
|
} |
| 565 |
|
duduz_j = V3Zero; |
| 566 |
|
} |
| 567 |
|
|
| 568 |
+ |
if (i_is_Fluctuating && j_is_Fluctuating) { |
| 569 |
+ |
J1 = Jij[idat.atypes]; |
| 570 |
+ |
J2 = Jij[make_pair(idat.atypes.second, idat.atypes.first)]; |
| 571 |
+ |
} |
| 572 |
+ |
|
| 573 |
|
epot = 0.0; |
| 574 |
|
dVdr = V3Zero; |
| 575 |
|
|
| 621 |
|
|
| 622 |
|
vterm = preVal * riji * erfcVal; |
| 623 |
|
dudr = - *(idat.sw) * preVal * c2; |
| 624 |
+ |
|
| 625 |
+ |
} |
| 626 |
|
|
| 627 |
+ |
|
| 628 |
+ |
if (i_is_Fluctuating) { |
| 629 |
+ |
if (!idat.excluded) |
| 630 |
+ |
*(idat.dVdFQ1) += *(idat.sw) * vterm / q_i; |
| 631 |
+ |
else { |
| 632 |
+ |
res = J1->getValueAndDerivativeAt( *(idat.rij) ); |
| 633 |
+ |
*(idat.dVdFQ1) += pre11_ * res.first * q_j; |
| 634 |
+ |
} |
| 635 |
+ |
} |
| 636 |
+ |
if (j_is_Fluctuating) { |
| 637 |
+ |
if (!idat.excluded) |
| 638 |
+ |
*(idat.dVdFQ2) += *(idat.sw) * vterm / q_j; |
| 639 |
+ |
else { |
| 640 |
+ |
res = J2->getValueAndDerivativeAt( *(idat.rij) ); |
| 641 |
+ |
*(idat.dVdFQ2) += pre11_ * res.first * q_i; |
| 642 |
+ |
} |
| 643 |
|
} |
| 644 |
|
|
| 645 |
|
vpair += vterm; |
| 1063 |
|
} |
| 1064 |
|
} else if (summationMethod_ == esm_SHIFTED_FORCE || summationMethod_ == esm_SHIFTED_POTENTIAL) { |
| 1065 |
|
if (i_is_Charge) { |
| 1066 |
< |
chg1 = data.charge; |
| 1066 |
> |
chg1 = data.fixedCharge; |
| 1067 |
|
if (screeningMethod_ == DAMPED) { |
| 1068 |
|
self = - 0.5 * (c1c_ + alphaPi_) * chg1 * (chg1 + *(sdat.skippedCharge)) * pre11_; |
| 1069 |
|
} else { |