| 60 |
|
CubicSpline* z1 = ea1.getZ(); |
| 61 |
|
CubicSpline* z2 = ea2.getZ(); |
| 62 |
|
|
| 63 |
+ |
// Thise prefactors convert the charge-charge interactions into |
| 64 |
+ |
// kcal / mol all were computed assuming distances are measured in |
| 65 |
+ |
// angstroms Charge-Charge, assuming charges are measured in |
| 66 |
+ |
// electrons. Matches value in Electrostatics.cpp |
| 67 |
+ |
pre11_ = 332.0637778; |
| 68 |
+ |
|
| 69 |
|
// make the r grid: |
| 70 |
|
|
| 65 |
– |
|
| 71 |
|
// we need phi out to the largest value we'll encounter in the radial space; |
| 72 |
|
|
| 73 |
|
RealType rmax = 0.0; |
| 106 |
|
zi = r <= ea1.getRcut() ? z1->getValueAt(r) : 0.0; |
| 107 |
|
zj = r <= ea2.getRcut() ? z2->getValueAt(r) : 0.0; |
| 108 |
|
|
| 109 |
< |
phi = 331.999296 * (zi * zj) / r; |
| 109 |
> |
phi = pre11_ * (zi * zj) / r; |
| 110 |
|
|
| 111 |
|
phivals.push_back(phi); |
| 112 |
|
} |
| 212 |
|
eamAtomData.F = ea.getF(); |
| 213 |
|
eamAtomData.Z = ea.getZ(); |
| 214 |
|
eamAtomData.rcut = ea.getRcut(); |
| 215 |
< |
|
| 215 |
> |
eamAtomData.isFluctuating = atomType->isFluctuatingCharge(); |
| 216 |
> |
|
| 217 |
|
// add it to the map: |
| 218 |
|
int atid = atomType->getIdent(); |
| 219 |
|
int eamtid = EAMtypes.size(); |
| 228 |
|
painCave.isFatal = 0; |
| 229 |
|
simError(); |
| 230 |
|
} |
| 231 |
+ |
|
| 232 |
+ |
if (eamAtomData.isFluctuating) { |
| 233 |
+ |
// compute charge to rho scaling: |
| 234 |
+ |
RealType z0 = eamAtomData.Z->getValueAt(0.0); |
| 235 |
+ |
RealType dr = ea.getDr(); |
| 236 |
+ |
RealType rmax = max(eamAtomData.rcut, ea.getNr() * dr); |
| 237 |
+ |
int nr = int(rmax/dr + 0.5); |
| 238 |
+ |
RealType r; |
| 239 |
+ |
RealType sum(0.0); |
| 240 |
+ |
|
| 241 |
+ |
for (int i = 0; i < nr; i++) { |
| 242 |
+ |
r = RealType(i*dr); |
| 243 |
+ |
sum += r * r * eamAtomData.rho->getValueAt(r) * dr; |
| 244 |
+ |
} |
| 245 |
+ |
sum *= 4.0 * M_PI; |
| 246 |
+ |
eamAtomData.qToRhoScaling = sum / z0; |
| 247 |
+ |
} |
| 248 |
+ |
|
| 249 |
|
|
| 250 |
|
EAMtids[atid] = eamtid; |
| 251 |
|
EAMdata[eamtid] = eamAtomData; |
| 311 |
|
if (haveCutoffRadius_) |
| 312 |
|
if ( *(idat.rij) > eamRcut_) return; |
| 313 |
|
|
| 314 |
< |
if ( *(idat.rij) < data1.rcut) |
| 315 |
< |
*(idat.rho1) += data1.rho->getValueAt( *(idat.rij)); |
| 316 |
< |
|
| 314 |
> |
if ( *(idat.rij) < data1.rcut) { |
| 315 |
> |
if (data1.isFluctuating) { |
| 316 |
> |
*(idat.rho2) += (1.0 - *(idat.flucQ1) * data1.qToRhoScaling ) * |
| 317 |
> |
data1.rho->getValueAt( *(idat.rij) ); |
| 318 |
> |
} else { |
| 319 |
> |
*(idat.rho2) += data1.rho->getValueAt( *(idat.rij)); |
| 320 |
> |
} |
| 321 |
> |
} |
| 322 |
|
|
| 323 |
< |
if ( *(idat.rij) < data2.rcut) |
| 324 |
< |
*(idat.rho2) += data2.rho->getValueAt( *(idat.rij)); |
| 323 |
> |
if ( *(idat.rij) < data2.rcut) { |
| 324 |
> |
if (data2.isFluctuating) { |
| 325 |
> |
*(idat.rho1) += (1.0 - *(idat.flucQ2) * data2.qToRhoScaling ) * |
| 326 |
> |
data2.rho->getValueAt( *(idat.rij) ); |
| 327 |
> |
} else { |
| 328 |
> |
*(idat.rho1) += data2.rho->getValueAt( *(idat.rij)); |
| 329 |
> |
} |
| 330 |
> |
} |
| 331 |
|
|
| 332 |
|
return; |
| 333 |
|
} |
| 337 |
|
if (!initialized_) initialize(); |
| 338 |
|
|
| 339 |
|
EAMAtomData &data1 = EAMdata[ EAMtids[sdat.atid] ]; |
| 340 |
< |
|
| 340 |
> |
|
| 341 |
|
data1.F->getValueAndDerivativeAt( *(sdat.rho), *(sdat.frho), *(sdat.dfrhodrho) ); |
| 342 |
|
|
| 343 |
|
(*(sdat.pot))[METALLIC_FAMILY] += *(sdat.frho); |
| 377 |
|
data1.rho->getValueAndDerivativeAt( *(idat.rij), rha, drha); |
| 378 |
|
CubicSpline* phi = MixingMap[eamtid1][eamtid1].phi; |
| 379 |
|
phi->getValueAndDerivativeAt( *(idat.rij), pha, dpha); |
| 380 |
+ |
if (data1.isFluctuating) { |
| 381 |
+ |
*(idat.dVdFQ1) -= *(idat.dfrho2) * rha * data1.qToRhoScaling; |
| 382 |
+ |
} |
| 383 |
|
} |
| 384 |
|
|
| 385 |
|
if ( *(idat.rij) < rcj) { |
| 386 |
|
data2.rho->getValueAndDerivativeAt( *(idat.rij), rhb, drhb ); |
| 387 |
|
CubicSpline* phi = MixingMap[eamtid2][eamtid2].phi; |
| 388 |
|
phi->getValueAndDerivativeAt( *(idat.rij), phb, dphb); |
| 389 |
+ |
if (data2.isFluctuating) { |
| 390 |
+ |
*(idat.dVdFQ2) -= *(idat.dfrho1) * rhb * data2.qToRhoScaling; |
| 391 |
+ |
} |
| 392 |
|
} |
| 393 |
|
|
| 394 |
|
switch(mixMeth_) { |
| 432 |
|
dudr = drhojdr* *(idat.dfrho1) + drhoidr* *(idat.dfrho2) + dvpdr; |
| 433 |
|
|
| 434 |
|
*(idat.f1) += *(idat.d) * dudr / *(idat.rij); |
| 435 |
+ |
|
| 436 |
|
|
| 437 |
|
if (idat.doParticlePot) { |
| 438 |
|
// particlePot is the difference between the full potential and |