| 47 |
|
#include "nonbonded/Electrostatic.hpp" |
| 48 |
|
#include "utils/simError.h" |
| 49 |
|
#include "types/NonBondedInteractionType.hpp" |
| 50 |
< |
#include "types/DirectionalAtomType.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" |
| 55 |
+ |
#include "utils/PhysicalConstants.hpp" |
| 56 |
|
|
| 57 |
+ |
|
| 58 |
|
namespace OpenMD { |
| 59 |
|
|
| 60 |
|
Electrostatic::Electrostatic(): name_("Electrostatic"), initialized_(false), |
| 217 |
|
addType(at); |
| 218 |
|
} |
| 219 |
|
|
| 215 |
– |
|
| 220 |
|
cutoffRadius2_ = cutoffRadius_ * cutoffRadius_; |
| 221 |
|
rcuti_ = 1.0 / cutoffRadius_; |
| 222 |
|
rcuti2_ = rcuti_ * rcuti_; |
| 283 |
|
electrostaticAtomData.is_Dipole = false; |
| 284 |
|
electrostaticAtomData.is_SplitDipole = false; |
| 285 |
|
electrostaticAtomData.is_Quadrupole = false; |
| 286 |
+ |
electrostaticAtomData.is_Fluctuating = false; |
| 287 |
|
|
| 288 |
< |
if (atomType->isCharge()) { |
| 284 |
< |
GenericData* data = atomType->getPropertyByName("Charge"); |
| 288 |
> |
FixedChargeAdapter fca = FixedChargeAdapter(atomType); |
| 289 |
|
|
| 290 |
< |
if (data == NULL) { |
| 287 |
< |
sprintf( painCave.errMsg, "Electrostatic::addType could not find " |
| 288 |
< |
"Charge\n" |
| 289 |
< |
"\tparameters for atomType %s.\n", |
| 290 |
< |
atomType->getName().c_str()); |
| 291 |
< |
painCave.severity = OPENMD_ERROR; |
| 292 |
< |
painCave.isFatal = 1; |
| 293 |
< |
simError(); |
| 294 |
< |
} |
| 295 |
< |
|
| 296 |
< |
DoubleGenericData* doubleData = dynamic_cast<DoubleGenericData*>(data); |
| 297 |
< |
if (doubleData == NULL) { |
| 298 |
< |
sprintf( painCave.errMsg, |
| 299 |
< |
"Electrostatic::addType could not convert GenericData to " |
| 300 |
< |
"Charge for\n" |
| 301 |
< |
"\tatom type %s\n", atomType->getName().c_str()); |
| 302 |
< |
painCave.severity = OPENMD_ERROR; |
| 303 |
< |
painCave.isFatal = 1; |
| 304 |
< |
simError(); |
| 305 |
< |
} |
| 290 |
> |
if (fca.isFixedCharge()) { |
| 291 |
|
electrostaticAtomData.is_Charge = true; |
| 292 |
< |
electrostaticAtomData.charge = doubleData->getData(); |
| 292 |
> |
electrostaticAtomData.fixedCharge = fca.getCharge(); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
< |
if (atomType->isDirectional()) { |
| 296 |
< |
DirectionalAtomType* daType = dynamic_cast<DirectionalAtomType*>(atomType); |
| 297 |
< |
|
| 313 |
< |
if (daType->isDipole()) { |
| 314 |
< |
GenericData* data = daType->getPropertyByName("Dipole"); |
| 315 |
< |
|
| 316 |
< |
if (data == NULL) { |
| 317 |
< |
sprintf( painCave.errMsg, |
| 318 |
< |
"Electrostatic::addType could not find Dipole\n" |
| 319 |
< |
"\tparameters for atomType %s.\n", |
| 320 |
< |
daType->getName().c_str()); |
| 321 |
< |
painCave.severity = OPENMD_ERROR; |
| 322 |
< |
painCave.isFatal = 1; |
| 323 |
< |
simError(); |
| 324 |
< |
} |
| 325 |
< |
|
| 326 |
< |
DoubleGenericData* doubleData = dynamic_cast<DoubleGenericData*>(data); |
| 327 |
< |
if (doubleData == NULL) { |
| 328 |
< |
sprintf( painCave.errMsg, |
| 329 |
< |
"Electrostatic::addType could not convert GenericData to " |
| 330 |
< |
"Dipole Moment\n" |
| 331 |
< |
"\tfor atom type %s\n", daType->getName().c_str()); |
| 332 |
< |
painCave.severity = OPENMD_ERROR; |
| 333 |
< |
painCave.isFatal = 1; |
| 334 |
< |
simError(); |
| 335 |
< |
} |
| 295 |
> |
MultipoleAdapter ma = MultipoleAdapter(atomType); |
| 296 |
> |
if (ma.isMultipole()) { |
| 297 |
> |
if (ma.isDipole()) { |
| 298 |
|
electrostaticAtomData.is_Dipole = true; |
| 299 |
< |
electrostaticAtomData.dipole_moment = doubleData->getData(); |
| 299 |
> |
electrostaticAtomData.dipole_moment = ma.getDipoleMoment(); |
| 300 |
|
} |
| 301 |
< |
|
| 340 |
< |
if (daType->isSplitDipole()) { |
| 341 |
< |
GenericData* data = daType->getPropertyByName("SplitDipoleDistance"); |
| 342 |
< |
|
| 343 |
< |
if (data == NULL) { |
| 344 |
< |
sprintf(painCave.errMsg, |
| 345 |
< |
"Electrostatic::addType could not find SplitDipoleDistance\n" |
| 346 |
< |
"\tparameter for atomType %s.\n", |
| 347 |
< |
daType->getName().c_str()); |
| 348 |
< |
painCave.severity = OPENMD_ERROR; |
| 349 |
< |
painCave.isFatal = 1; |
| 350 |
< |
simError(); |
| 351 |
< |
} |
| 352 |
< |
|
| 353 |
< |
DoubleGenericData* doubleData = dynamic_cast<DoubleGenericData*>(data); |
| 354 |
< |
if (doubleData == NULL) { |
| 355 |
< |
sprintf( painCave.errMsg, |
| 356 |
< |
"Electrostatic::addType could not convert GenericData to " |
| 357 |
< |
"SplitDipoleDistance for\n" |
| 358 |
< |
"\tatom type %s\n", daType->getName().c_str()); |
| 359 |
< |
painCave.severity = OPENMD_ERROR; |
| 360 |
< |
painCave.isFatal = 1; |
| 361 |
< |
simError(); |
| 362 |
< |
} |
| 301 |
> |
if (ma.isSplitDipole()) { |
| 302 |
|
electrostaticAtomData.is_SplitDipole = true; |
| 303 |
< |
electrostaticAtomData.split_dipole_distance = doubleData->getData(); |
| 303 |
> |
electrostaticAtomData.split_dipole_distance = ma.getSplitDipoleDistance(); |
| 304 |
|
} |
| 305 |
< |
|
| 367 |
< |
if (daType->isQuadrupole()) { |
| 368 |
< |
GenericData* data = daType->getPropertyByName("QuadrupoleMoments"); |
| 369 |
< |
|
| 370 |
< |
if (data == NULL) { |
| 371 |
< |
sprintf( painCave.errMsg, |
| 372 |
< |
"Electrostatic::addType could not find QuadrupoleMoments\n" |
| 373 |
< |
"\tparameter for atomType %s.\n", |
| 374 |
< |
daType->getName().c_str()); |
| 375 |
< |
painCave.severity = OPENMD_ERROR; |
| 376 |
< |
painCave.isFatal = 1; |
| 377 |
< |
simError(); |
| 378 |
< |
} |
| 379 |
< |
|
| 305 |
> |
if (ma.isQuadrupole()) { |
| 306 |
|
// Quadrupoles in OpenMD are set as the diagonal elements |
| 307 |
|
// of the diagonalized traceless quadrupole moment tensor. |
| 308 |
|
// The column vectors of the unitary matrix that diagonalizes |
| 309 |
|
// the quadrupole moment tensor become the eFrame (or the |
| 310 |
|
// electrostatic version of the body-fixed frame. |
| 385 |
– |
|
| 386 |
– |
Vector3dGenericData* v3dData = dynamic_cast<Vector3dGenericData*>(data); |
| 387 |
– |
if (v3dData == NULL) { |
| 388 |
– |
sprintf( painCave.errMsg, |
| 389 |
– |
"Electrostatic::addType could not convert GenericData to " |
| 390 |
– |
"Quadrupole Moments for\n" |
| 391 |
– |
"\tatom type %s\n", daType->getName().c_str()); |
| 392 |
– |
painCave.severity = OPENMD_ERROR; |
| 393 |
– |
painCave.isFatal = 1; |
| 394 |
– |
simError(); |
| 395 |
– |
} |
| 311 |
|
electrostaticAtomData.is_Quadrupole = true; |
| 312 |
< |
electrostaticAtomData.quadrupole_moments = v3dData->getData(); |
| 312 |
> |
electrostaticAtomData.quadrupole_moments = ma.getQuadrupoleMoments(); |
| 313 |
|
} |
| 314 |
|
} |
| 315 |
|
|
| 316 |
< |
AtomTypeProperties atp = atomType->getATP(); |
| 316 |
> |
FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atomType); |
| 317 |
|
|
| 318 |
+ |
if (fqa.isFluctuatingCharge()) { |
| 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 |
+ |
} |
| 325 |
+ |
|
| 326 |
|
pair<map<int,AtomType*>::iterator,bool> ret; |
| 327 |
< |
ret = ElectrostaticList.insert( pair<int,AtomType*>(atp.ident, atomType) ); |
| 327 |
> |
ret = ElectrostaticList.insert( pair<int,AtomType*>(atomType->getIdent(), |
| 328 |
> |
atomType) ); |
| 329 |
|
if (ret.second == false) { |
| 330 |
|
sprintf( painCave.errMsg, |
| 331 |
|
"Electrostatic already had a previous entry with ident %d\n", |
| 332 |
< |
atp.ident); |
| 332 |
> |
atomType->getIdent() ); |
| 333 |
|
painCave.severity = OPENMD_INFO; |
| 334 |
|
painCave.isFatal = 0; |
| 335 |
|
simError(); |
| 336 |
|
} |
| 337 |
|
|
| 338 |
< |
ElectrostaticMap[atomType] = electrostaticAtomData; |
| 338 |
> |
ElectrostaticMap[atomType] = electrostaticAtomData; |
| 339 |
> |
|
| 340 |
> |
// Now, iterate over all known types and add to the mixing map: |
| 341 |
> |
|
| 342 |
> |
map<AtomType*, ElectrostaticAtomData>::iterator it; |
| 343 |
> |
for( it = ElectrostaticMap.begin(); it != ElectrostaticMap.end(); ++it) { |
| 344 |
> |
AtomType* atype2 = (*it).first; |
| 345 |
> |
ElectrostaticAtomData eaData2 = (*it).second; |
| 346 |
> |
if (eaData2.is_Fluctuating && electrostaticAtomData.is_Fluctuating) { |
| 347 |
> |
|
| 348 |
> |
RealType a = electrostaticAtomData.slaterZeta; |
| 349 |
> |
RealType b = eaData2.slaterZeta; |
| 350 |
> |
int m = electrostaticAtomData.slaterN; |
| 351 |
> |
int n = eaData2.slaterN; |
| 352 |
> |
|
| 353 |
> |
// Create the spline of the coulombic integral for s-type |
| 354 |
> |
// Slater orbitals. Add a 2 angstrom safety window to deal |
| 355 |
> |
// with cutoffGroups that have charged atoms longer than the |
| 356 |
> |
// cutoffRadius away from each other. |
| 357 |
> |
|
| 358 |
> |
RealType rval; |
| 359 |
> |
RealType dr = (cutoffRadius_ + 2.0) / RealType(np_ - 1); |
| 360 |
> |
vector<RealType> rvals; |
| 361 |
> |
vector<RealType> J1vals; |
| 362 |
> |
vector<RealType> J2vals; |
| 363 |
> |
for (int i = 0; i < np_; i++) { |
| 364 |
> |
rval = RealType(i) * dr; |
| 365 |
> |
rvals.push_back(rval); |
| 366 |
> |
J1vals.push_back( sSTOCoulInt( a, b, m, n, rval * PhysicalConstants::angstromsToBohr ) ); |
| 367 |
> |
// may not be necessary if Slater coulomb integral is symmetric |
| 368 |
> |
J2vals.push_back( sSTOCoulInt( b, a, n, m, rval * PhysicalConstants::angstromsToBohr ) ); |
| 369 |
> |
} |
| 370 |
> |
|
| 371 |
> |
CubicSpline* J1 = new CubicSpline(); |
| 372 |
> |
J1->addPoints(rvals, J1vals); |
| 373 |
> |
CubicSpline* J2 = new CubicSpline(); |
| 374 |
> |
J2->addPoints(rvals, J2vals); |
| 375 |
> |
|
| 376 |
> |
pair<AtomType*, AtomType*> key1, key2; |
| 377 |
> |
key1 = make_pair(atomType, atype2); |
| 378 |
> |
key2 = make_pair(atype2, atomType); |
| 379 |
> |
|
| 380 |
> |
Jij[key1] = J1; |
| 381 |
> |
Jij[key2] = J2; |
| 382 |
> |
} |
| 383 |
> |
} |
| 384 |
> |
|
| 385 |
|
return; |
| 386 |
|
} |
| 387 |
|
|
| 431 |
|
RealType c1, c2, c3, c4; |
| 432 |
|
RealType erfcVal(1.0), derfcVal(0.0); |
| 433 |
|
RealType BigR; |
| 434 |
+ |
RealType two(2.0), three(3.0); |
| 435 |
|
|
| 436 |
|
Vector3d Q_i, Q_j; |
| 437 |
|
Vector3d ux_i, uy_i, uz_i; |
| 447 |
|
Vector3d indirect_dVdr(V3Zero); |
| 448 |
|
Vector3d indirect_duduz_i(V3Zero), indirect_duduz_j(V3Zero); |
| 449 |
|
|
| 450 |
+ |
RealType coulInt, vFluc1(0.0), vFluc2(0.0); |
| 451 |
|
pair<RealType, RealType> res; |
| 452 |
|
|
| 453 |
+ |
// splines for coulomb integrals |
| 454 |
+ |
CubicSpline* J1; |
| 455 |
+ |
CubicSpline* J2; |
| 456 |
+ |
|
| 457 |
|
if (!initialized_) initialize(); |
| 458 |
|
|
| 459 |
|
ElectrostaticAtomData data1 = ElectrostaticMap[idat.atypes.first]; |
| 470 |
|
bool i_is_Dipole = data1.is_Dipole; |
| 471 |
|
bool i_is_SplitDipole = data1.is_SplitDipole; |
| 472 |
|
bool i_is_Quadrupole = data1.is_Quadrupole; |
| 473 |
+ |
bool i_is_Fluctuating = data1.is_Fluctuating; |
| 474 |
|
|
| 475 |
|
bool j_is_Charge = data2.is_Charge; |
| 476 |
|
bool j_is_Dipole = data2.is_Dipole; |
| 477 |
|
bool j_is_SplitDipole = data2.is_SplitDipole; |
| 478 |
|
bool j_is_Quadrupole = data2.is_Quadrupole; |
| 479 |
+ |
bool j_is_Fluctuating = data2.is_Fluctuating; |
| 480 |
|
|
| 481 |
|
if (i_is_Charge) { |
| 482 |
< |
q_i = data1.charge; |
| 482 |
> |
q_i = data1.fixedCharge; |
| 483 |
> |
|
| 484 |
> |
if (i_is_Fluctuating) { |
| 485 |
> |
q_i += *(idat.flucQ1); |
| 486 |
> |
} |
| 487 |
> |
|
| 488 |
|
if (idat.excluded) { |
| 489 |
|
*(idat.skippedCharge2) += q_i; |
| 490 |
|
} |
| 522 |
|
} |
| 523 |
|
|
| 524 |
|
if (j_is_Charge) { |
| 525 |
< |
q_j = data2.charge; |
| 525 |
> |
q_j = data2.fixedCharge; |
| 526 |
> |
|
| 527 |
> |
if (i_is_Fluctuating) |
| 528 |
> |
q_j += *(idat.flucQ2); |
| 529 |
> |
|
| 530 |
|
if (idat.excluded) { |
| 531 |
|
*(idat.skippedCharge1) += q_j; |
| 532 |
|
} |
| 564 |
|
duduz_j = V3Zero; |
| 565 |
|
} |
| 566 |
|
|
| 567 |
+ |
if (i_is_Fluctuating && j_is_Fluctuating) { |
| 568 |
+ |
J1 = Jij[idat.atypes]; |
| 569 |
+ |
J2 = Jij[make_pair(idat.atypes.second, idat.atypes.first)]; |
| 570 |
+ |
} |
| 571 |
+ |
|
| 572 |
|
epot = 0.0; |
| 573 |
|
dVdr = V3Zero; |
| 574 |
|
|
| 613 |
|
if (idat.excluded) { |
| 614 |
|
indirect_vpair += preVal * rfVal; |
| 615 |
|
indirect_Pot += *(idat.sw) * preVal * rfVal; |
| 616 |
< |
indirect_dVdr += *(idat.sw) * preVal * 2.0 * rfVal * riji * rhat; |
| 616 |
> |
indirect_dVdr += *(idat.sw) * preVal * two * rfVal * riji * rhat; |
| 617 |
|
} |
| 618 |
|
|
| 619 |
|
} else { |
| 620 |
|
|
| 621 |
|
vterm = preVal * riji * erfcVal; |
| 622 |
|
dudr = - *(idat.sw) * preVal * c2; |
| 623 |
< |
|
| 623 |
> |
|
| 624 |
|
} |
| 625 |
< |
|
| 625 |
> |
|
| 626 |
|
vpair += vterm; |
| 627 |
|
epot += *(idat.sw) * vterm; |
| 628 |
< |
dVdr += dudr * rhat; |
| 628 |
> |
dVdr += dudr * rhat; |
| 629 |
> |
|
| 630 |
> |
if (i_is_Fluctuating) { |
| 631 |
> |
if (idat.excluded) { |
| 632 |
> |
// vFluc1 is the difference between the direct coulomb integral |
| 633 |
> |
// and the normal 1/r-like interaction between point charges. |
| 634 |
> |
coulInt = J1->getValueAt( *(idat.rij) ); |
| 635 |
> |
vFluc1 = pre11_ * coulInt * q_i * q_j - (*(idat.sw) * vterm); |
| 636 |
> |
} else { |
| 637 |
> |
vFluc1 = 0.0; |
| 638 |
> |
} |
| 639 |
> |
*(idat.dVdFQ1) += ( *(idat.sw) * vterm + vFluc1 ) / q_i; |
| 640 |
> |
} |
| 641 |
> |
|
| 642 |
> |
if (j_is_Fluctuating) { |
| 643 |
> |
if (idat.excluded) { |
| 644 |
> |
// vFluc2 is the difference between the direct coulomb integral |
| 645 |
> |
// and the normal 1/r-like interaction between point charges. |
| 646 |
> |
coulInt = J2->getValueAt( *(idat.rij) ); |
| 647 |
> |
vFluc2 = pre11_ * coulInt * q_i * q_j - (*(idat.sw) * vterm); |
| 648 |
> |
} else { |
| 649 |
> |
vFluc2 = 0.0; |
| 650 |
> |
} |
| 651 |
> |
*(idat.dVdFQ2) += ( *(idat.sw) * vterm + vFluc2 ) / q_j; |
| 652 |
> |
} |
| 653 |
> |
|
| 654 |
> |
|
| 655 |
|
} |
| 656 |
|
|
| 657 |
|
if (j_is_Dipole) { |
| 667 |
|
vpair += vterm; |
| 668 |
|
epot += *(idat.sw) * vterm; |
| 669 |
|
|
| 670 |
< |
dVdr += -preSw * (ri3 * (uz_j - 3.0 * ct_j * rhat) - preRF2_*uz_j); |
| 670 |
> |
dVdr += -preSw * (ri3 * (uz_j - three * ct_j * rhat) - preRF2_*uz_j); |
| 671 |
|
duduz_j += -preSw * rhat * (ri2 - preRF2_ * *(idat.rij) ); |
| 672 |
|
|
| 673 |
|
// Even if we excluded this pair from direct interactions, |
| 724 |
|
duduz_j += -preSw * pot_term * rhat; |
| 725 |
|
|
| 726 |
|
} |
| 727 |
+ |
if (i_is_Fluctuating) { |
| 728 |
+ |
*(idat.dVdFQ1) += ( *(idat.sw) * vterm ) / q_i; |
| 729 |
+ |
} |
| 730 |
|
} |
| 731 |
|
|
| 732 |
|
if (j_is_Quadrupole) { |
| 759 |
|
c2ri = c2 * riji; |
| 760 |
|
c3ri = c3 * riji; |
| 761 |
|
c4rij = c4 * *(idat.rij) ; |
| 762 |
< |
rhatdot2 = 2.0 * rhat * c3; |
| 762 |
> |
rhatdot2 = two * rhat * c3; |
| 763 |
|
rhatc4 = rhat * c4rij; |
| 764 |
|
|
| 765 |
|
// calculate the potential |
| 772 |
|
|
| 773 |
|
// calculate derivatives for the forces and torques |
| 774 |
|
|
| 775 |
< |
dVdr += -preSw * ( qxx_j* (cx2*rhatc4 - (2.0*cx_j*ux_j + rhat)*c3ri) + |
| 776 |
< |
qyy_j* (cy2*rhatc4 - (2.0*cy_j*uy_j + rhat)*c3ri) + |
| 777 |
< |
qzz_j* (cz2*rhatc4 - (2.0*cz_j*uz_j + rhat)*c3ri)); |
| 775 |
> |
dVdr += -preSw * ( qxx_j* (cx2*rhatc4 - (two*cx_j*ux_j + rhat)*c3ri) + |
| 776 |
> |
qyy_j* (cy2*rhatc4 - (two*cy_j*uy_j + rhat)*c3ri) + |
| 777 |
> |
qzz_j* (cz2*rhatc4 - (two*cz_j*uz_j + rhat)*c3ri)); |
| 778 |
|
|
| 779 |
|
dudux_j += preSw * qxx_j * cx_j * rhatdot2; |
| 780 |
|
duduy_j += preSw * qyy_j * cy_j * rhatdot2; |
| 781 |
|
duduz_j += preSw * qzz_j * cz_j * rhatdot2; |
| 782 |
+ |
if (i_is_Fluctuating) { |
| 783 |
+ |
*(idat.dVdFQ1) += ( *(idat.sw) * vterm ) / q_i; |
| 784 |
+ |
} |
| 785 |
+ |
|
| 786 |
|
} |
| 787 |
|
} |
| 788 |
|
|
| 802 |
|
vpair += vterm; |
| 803 |
|
epot += *(idat.sw) * vterm; |
| 804 |
|
|
| 805 |
< |
dVdr += preSw * (ri3 * (uz_i - 3.0 * ct_i * rhat) - preRF2_ * uz_i); |
| 805 |
> |
dVdr += preSw * (ri3 * (uz_i - three * ct_i * rhat) - preRF2_ * uz_i); |
| 806 |
|
|
| 807 |
|
duduz_i += preSw * rhat * (ri2 - preRF2_ * *(idat.rij) ); |
| 808 |
|
|
| 859 |
|
dVdr += preSw * (uz_i * c2ri - ct_i * rhat * sc2 * c3); |
| 860 |
|
duduz_i += preSw * pot_term * rhat; |
| 861 |
|
} |
| 862 |
+ |
|
| 863 |
+ |
if (j_is_Fluctuating) { |
| 864 |
+ |
*(idat.dVdFQ2) += ( *(idat.sw) * vterm ) / q_j; |
| 865 |
+ |
} |
| 866 |
+ |
|
| 867 |
|
} |
| 868 |
|
|
| 869 |
|
if (j_is_Dipole) { |
| 885 |
|
|
| 886 |
|
a1 = 5.0 * ct_i * ct_j - ct_ij; |
| 887 |
|
|
| 888 |
< |
dVdr += preSw * 3.0 * ri4 * (a1 * rhat - ct_i * uz_j - ct_j * uz_i); |
| 888 |
> |
dVdr += preSw * three * ri4 * (a1 * rhat - ct_i * uz_j - ct_j * uz_i); |
| 889 |
|
|
| 890 |
< |
duduz_i += preSw * (ri3 * (uz_j - 3.0 * ct_j * rhat) - preRF2_*uz_j); |
| 891 |
< |
duduz_j += preSw * (ri3 * (uz_i - 3.0 * ct_i * rhat) - preRF2_*uz_i); |
| 890 |
> |
duduz_i += preSw * (ri3 * (uz_j - three * ct_j * rhat) - preRF2_*uz_j); |
| 891 |
> |
duduz_j += preSw * (ri3 * (uz_i - three * ct_i * rhat) - preRF2_*uz_i); |
| 892 |
|
|
| 893 |
|
if (idat.excluded) { |
| 894 |
|
indirect_vpair += - pref * preRF2_ * ct_ij; |
| 993 |
|
c2ri = c2 * riji; |
| 994 |
|
c3ri = c3 * riji; |
| 995 |
|
c4rij = c4 * *(idat.rij) ; |
| 996 |
< |
rhatdot2 = 2.0 * rhat * c3; |
| 996 |
> |
rhatdot2 = two * rhat * c3; |
| 997 |
|
rhatc4 = rhat * c4rij; |
| 998 |
|
|
| 999 |
|
// calculate the potential |
| 1007 |
|
|
| 1008 |
|
// calculate the derivatives for the forces and torques |
| 1009 |
|
|
| 1010 |
< |
dVdr += -preSw * (qxx_i* (cx2*rhatc4 - (2.0*cx_i*ux_i + rhat)*c3ri) + |
| 1011 |
< |
qyy_i* (cy2*rhatc4 - (2.0*cy_i*uy_i + rhat)*c3ri) + |
| 1012 |
< |
qzz_i* (cz2*rhatc4 - (2.0*cz_i*uz_i + rhat)*c3ri)); |
| 1010 |
> |
dVdr += -preSw * (qxx_i* (cx2*rhatc4 - (two*cx_i*ux_i + rhat)*c3ri) + |
| 1011 |
> |
qyy_i* (cy2*rhatc4 - (two*cy_i*uy_i + rhat)*c3ri) + |
| 1012 |
> |
qzz_i* (cz2*rhatc4 - (two*cz_i*uz_i + rhat)*c3ri)); |
| 1013 |
|
|
| 1014 |
|
dudux_i += preSw * qxx_i * cx_i * rhatdot2; |
| 1015 |
|
duduy_i += preSw * qyy_i * cy_i * rhatdot2; |
| 1016 |
|
duduz_i += preSw * qzz_i * cz_i * rhatdot2; |
| 1017 |
+ |
|
| 1018 |
+ |
if (j_is_Fluctuating) { |
| 1019 |
+ |
*(idat.dVdFQ2) += ( *(idat.sw) * vterm ) / q_j; |
| 1020 |
+ |
} |
| 1021 |
+ |
|
| 1022 |
|
} |
| 1023 |
|
} |
| 1024 |
|
|
| 1057 |
|
*(idat.t2) -= cross(uz_j, indirect_duduz_j); |
| 1058 |
|
} |
| 1059 |
|
|
| 1025 |
– |
|
| 1060 |
|
return; |
| 1061 |
|
} |
| 1062 |
|
|
| 1086 |
|
} |
| 1087 |
|
} else if (summationMethod_ == esm_SHIFTED_FORCE || summationMethod_ == esm_SHIFTED_POTENTIAL) { |
| 1088 |
|
if (i_is_Charge) { |
| 1089 |
< |
chg1 = data.charge; |
| 1089 |
> |
chg1 = data.fixedCharge; |
| 1090 |
|
if (screeningMethod_ == DAMPED) { |
| 1091 |
|
self = - 0.5 * (c1c_ + alphaPi_) * chg1 * (chg1 + *(sdat.skippedCharge)) * pre11_; |
| 1092 |
|
} else { |