| 107 |
|
zj = r <= ea2.getRcut() ? z2->getValueAt(r) : 0.0; |
| 108 |
|
|
| 109 |
|
phi = pre11_ * (zi * zj) / r; |
| 110 |
< |
|
| 110 |
> |
|
| 111 |
|
phivals.push_back(phi); |
| 112 |
|
} |
| 113 |
– |
|
| 113 |
|
CubicSpline* cs = new CubicSpline(); |
| 114 |
|
cs->addPoints(rvals, phivals); |
| 115 |
|
return cs; |
| 211 |
|
eamAtomData.F = ea.getF(); |
| 212 |
|
eamAtomData.Z = ea.getZ(); |
| 213 |
|
eamAtomData.rcut = ea.getRcut(); |
| 215 |
– |
eamAtomData.isFluctuating = atomType->isFluctuatingCharge(); |
| 214 |
|
|
| 215 |
|
// add it to the map: |
| 216 |
|
int atid = atomType->getIdent(); |
| 227 |
|
simError(); |
| 228 |
|
} |
| 229 |
|
|
| 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); |
| 230 |
|
|
| 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 |
– |
|
| 231 |
|
EAMtids[atid] = eamtid; |
| 232 |
|
EAMdata[eamtid] = eamAtomData; |
| 233 |
|
MixingMap[eamtid].resize(nEAM_); |
| 295 |
|
if ( *(idat.rij) > eamRcut_) return; |
| 296 |
|
|
| 297 |
|
if ( *(idat.rij) < data1.rcut) { |
| 298 |
< |
if (data1.isFluctuating) { |
| 318 |
< |
*(idat.rho2) += (1.0 - *(idat.flucQ1) * data1.qToRhoScaling ) * |
| 319 |
< |
data1.rho->getValueAt( *(idat.rij) ); |
| 320 |
< |
} else { |
| 321 |
< |
*(idat.rho2) += data1.rho->getValueAt( *(idat.rij)); |
| 322 |
< |
} |
| 298 |
> |
*(idat.rho2) += data1.rho->getValueAt( *(idat.rij)); |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
if ( *(idat.rij) < data2.rcut) { |
| 302 |
< |
if (data2.isFluctuating) { |
| 327 |
< |
*(idat.rho1) += (1.0 - *(idat.flucQ2) * data2.qToRhoScaling ) * |
| 328 |
< |
data2.rho->getValueAt( *(idat.rij) ); |
| 329 |
< |
} else { |
| 330 |
< |
*(idat.rho1) += data2.rho->getValueAt( *(idat.rij)); |
| 331 |
< |
} |
| 302 |
> |
*(idat.rho1) += data2.rho->getValueAt( *(idat.rij)); |
| 303 |
|
} |
| 304 |
|
|
| 305 |
|
return; |
| 308 |
|
void EAM::calcFunctional(SelfData &sdat) { |
| 309 |
|
|
| 310 |
|
if (!initialized_) initialize(); |
| 340 |
– |
|
| 311 |
|
EAMAtomData &data1 = EAMdata[ EAMtids[sdat.atid] ]; |
| 312 |
|
|
| 313 |
< |
data1.F->getValueAndDerivativeAt( *(sdat.rho), *(sdat.frho), *(sdat.dfrhodrho) ); |
| 313 |
> |
data1.F->getValueAndDerivativeAt( *(sdat.rho), *(sdat.frho), |
| 314 |
> |
*(sdat.dfrhodrho) ); |
| 315 |
|
|
| 316 |
|
(*(sdat.pot))[METALLIC_FAMILY] += *(sdat.frho); |
| 317 |
|
if (sdat.doParticlePot) { |
| 332 |
|
|
| 333 |
|
int eamtid1 = EAMtids[idat.atid1]; |
| 334 |
|
int eamtid2 = EAMtids[idat.atid2]; |
| 364 |
– |
|
| 335 |
|
EAMAtomData &data1 = EAMdata[eamtid1]; |
| 336 |
|
EAMAtomData &data2 = EAMdata[eamtid2]; |
| 337 |
|
|
| 339 |
|
|
| 340 |
|
RealType rci = data1.rcut; |
| 341 |
|
RealType rcj = data2.rcut; |
| 342 |
+ |
|
| 343 |
|
|
| 344 |
|
RealType rha(0.0), drha(0.0), rhb(0.0), drhb(0.0); |
| 345 |
|
RealType pha(0.0), dpha(0.0), phb(0.0), dphb(0.0); |
| 350 |
|
data1.rho->getValueAndDerivativeAt( *(idat.rij), rha, drha); |
| 351 |
|
CubicSpline* phi = MixingMap[eamtid1][eamtid1].phi; |
| 352 |
|
phi->getValueAndDerivativeAt( *(idat.rij), pha, dpha); |
| 382 |
– |
if (data1.isFluctuating) { |
| 383 |
– |
*(idat.dVdFQ1) -= *(idat.dfrho2) * rha * data1.qToRhoScaling; |
| 384 |
– |
} |
| 353 |
|
} |
| 354 |
|
|
| 355 |
|
if ( *(idat.rij) < rcj) { |
| 356 |
|
data2.rho->getValueAndDerivativeAt( *(idat.rij), rhb, drhb ); |
| 357 |
|
CubicSpline* phi = MixingMap[eamtid2][eamtid2].phi; |
| 358 |
|
phi->getValueAndDerivativeAt( *(idat.rij), phb, dphb); |
| 391 |
– |
if (data2.isFluctuating) { |
| 392 |
– |
*(idat.dVdFQ2) -= *(idat.dfrho1) * rhb * data2.qToRhoScaling; |
| 393 |
– |
} |
| 359 |
|
} |
| 395 |
– |
|
| 360 |
|
switch(mixMeth_) { |
| 361 |
|
case eamJohnson: |
| 398 |
– |
|
| 362 |
|
if ( *(idat.rij) < rci) { |
| 363 |
|
phab = phab + 0.5 * (rhb / rha) * pha; |
| 364 |
|
dvpdr = dvpdr + 0.5*((rhb/rha)*dpha + |
| 365 |
|
pha*((drhb/rha) - (rhb*drha/rha/rha))); |
| 366 |
|
} |
| 367 |
< |
|
| 405 |
< |
|
| 406 |
< |
|
| 367 |
> |
|
| 368 |
|
if ( *(idat.rij) < rcj) { |
| 369 |
|
phab = phab + 0.5 * (rha / rhb) * phb; |
| 370 |
|
dvpdr = dvpdr + 0.5 * ((rha/rhb)*dphb + |
| 371 |
|
phb*((drha/rhb) - (rha*drhb/rhb/rhb))); |
| 372 |
|
} |
| 412 |
– |
|
| 373 |
|
break; |
| 414 |
– |
|
| 374 |
|
case eamDaw: |
| 416 |
– |
|
| 375 |
|
if ( *(idat.rij) < MixingMap[eamtid1][eamtid2].rcut) { |
| 376 |
|
MixingMap[eamtid1][eamtid2].phi->getValueAndDerivativeAt( *(idat.rij), |
| 377 |
|
phab, dvpdr); |
| 378 |
|
} |
| 421 |
– |
|
| 379 |
|
break; |
| 380 |
|
case eamUnknown: |
| 381 |
|
default: |
| 396 |
|
|
| 397 |
|
*(idat.f1) += *(idat.d) * dudr / *(idat.rij); |
| 398 |
|
|
| 442 |
– |
|
| 399 |
|
if (idat.doParticlePot) { |
| 400 |
|
// particlePot is the difference between the full potential and |
| 401 |
|
// the full potential without the presence of a particular |
| 413 |
|
- *(idat.frho1); |
| 414 |
|
} |
| 415 |
|
|
| 416 |
< |
(*(idat.pot))[METALLIC_FAMILY] += phab; |
| 417 |
< |
|
| 418 |
< |
*(idat.vpair) += phab; |
| 463 |
< |
|
| 464 |
< |
return; |
| 465 |
< |
|
| 416 |
> |
(*(idat.pot))[METALLIC_FAMILY] += phab; |
| 417 |
> |
*(idat.vpair) += phab; |
| 418 |
> |
return; |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
RealType EAM::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) { |