ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/nonbonded/EAM.cpp
(Generate patch)

Comparing trunk/src/nonbonded/EAM.cpp (file contents):
Revision 1928 by gezelter, Sat Aug 17 13:03:17 2013 UTC vs.
Revision 1929 by gezelter, Mon Aug 19 13:12:00 2013 UTC

# Line 212 | Line 212 | namespace OpenMD {
212      eamAtomData.F = ea.getF();
213      eamAtomData.Z = ea.getZ();
214      eamAtomData.rcut = ea.getRcut();
215    eamAtomData.isFluctuating = atomType->isFluctuatingCharge();
215        
216      // add it to the map:
217      int atid = atomType->getIdent();
# Line 229 | Line 228 | namespace OpenMD {
228        simError();        
229      }
230  
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);
231  
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
232      EAMtids[atid] = eamtid;
233      EAMdata[eamtid] = eamAtomData;
234      MixingMap[eamtid].resize(nEAM_);
# Line 314 | Line 296 | namespace OpenMD {
296        if ( *(idat.rij) > eamRcut_) return;
297      
298      if ( *(idat.rij) < data1.rcut) {
299 <      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 <      }
299 >      *(idat.rho2) += data1.rho->getValueAt( *(idat.rij));
300      }
301        
302      if ( *(idat.rij) < data2.rcut) {
303 <      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 <      }
303 >      *(idat.rho1) += data2.rho->getValueAt( *(idat.rij));
304      }
305      
306      return;  
# Line 379 | Line 351 | namespace OpenMD {
351        data1.rho->getValueAndDerivativeAt( *(idat.rij), rha, drha);
352        CubicSpline* phi = MixingMap[eamtid1][eamtid1].phi;
353        phi->getValueAndDerivativeAt( *(idat.rij), pha, dpha);
382      if (data1.isFluctuating) {
383        *(idat.dVdFQ1) -= *(idat.dfrho2) * rha * data1.qToRhoScaling;
384      }
354      }
355      
356      if ( *(idat.rij) < rcj) {
357        data2.rho->getValueAndDerivativeAt( *(idat.rij), rhb, drhb );
358        CubicSpline* phi = MixingMap[eamtid2][eamtid2].phi;
359        phi->getValueAndDerivativeAt( *(idat.rij), phb, dphb);
391      if (data2.isFluctuating) {
392        *(idat.dVdFQ2) -= *(idat.dfrho1) * rhb * data2.qToRhoScaling;
393      }
360      }
361  
362      switch(mixMeth_) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines