217 |
|
addType(at); |
218 |
|
} |
219 |
|
|
220 |
– |
|
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 |
|
FixedChargeAdapter fca = FixedChargeAdapter(atomType); |
289 |
|
|
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 |
|
|
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 |
|
|
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.fixedCharge; |
483 |
+ |
|
484 |
+ |
if (i_is_Fluctuating) { |
485 |
+ |
q_i += *(idat.flucQ1); |
486 |
+ |
} |
487 |
+ |
|
488 |
|
if (idat.excluded) { |
489 |
|
*(idat.skippedCharge2) += q_i; |
490 |
|
} |
523 |
|
|
524 |
|
if (j_is_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 |
|
|
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) { |
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) { |
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 |
|
|
858 |
|
// calculate derivatives for the forces and torques |
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) { |
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 |
|
|
995 |
– |
|
1060 |
|
return; |
1061 |
|
} |
1062 |
|
|