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 1929 by gezelter, Mon Aug 19 13:12:00 2013 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 51 | Line 51 | namespace OpenMD {
51  
52   namespace OpenMD {
53  
54 <  EAM::EAM() : name_("EAM"), initialized_(false), forceField_(NULL),
55 <               mixMeth_(eamJohnson), eamRcut_(0.0), haveCutoffRadius_(false) {}
54 >  EAM::EAM() : initialized_(false), haveCutoffRadius_(false),
55 >               forceField_(NULL), eamRcut_(0.0), mixMeth_(eamJohnson),
56 >               name_("EAM") {}
57    
58    CubicSpline* EAM::getPhi(AtomType* atomType1, AtomType* atomType2) {  
59      EAMAdapter ea1 = EAMAdapter(atomType1);
# Line 107 | Line 108 | namespace OpenMD {
108        zj = r <= ea2.getRcut() ? z2->getValueAt(r) : 0.0;
109  
110        phi = pre11_ * (zi * zj) / r;
111 <
111 >      
112        phivals.push_back(phi);
113      }
113      
114      CubicSpline* cs = new CubicSpline();
115      cs->addPoints(rvals, phivals);
116      return cs;
# Line 309 | Line 309 | namespace OpenMD {
309    void EAM::calcFunctional(SelfData &sdat) {
310      
311      if (!initialized_) initialize();
312
312      EAMAtomData &data1 = EAMdata[ EAMtids[sdat.atid] ];
313              
314 <    data1.F->getValueAndDerivativeAt( *(sdat.rho), *(sdat.frho), *(sdat.dfrhodrho) );
314 >    data1.F->getValueAndDerivativeAt( *(sdat.rho), *(sdat.frho),
315 >                                      *(sdat.dfrhodrho) );
316  
317      (*(sdat.pot))[METALLIC_FAMILY] += *(sdat.frho);
318      if (sdat.doParticlePot) {
# Line 333 | Line 333 | namespace OpenMD {
333  
334      int eamtid1 = EAMtids[idat.atid1];
335      int eamtid2 = EAMtids[idat.atid2];
336    
336      EAMAtomData &data1 = EAMdata[eamtid1];
337      EAMAtomData &data2 = EAMdata[eamtid2];
338      
# Line 341 | Line 340 | namespace OpenMD {
340      
341      RealType rci = data1.rcut;
342      RealType rcj = data2.rcut;
343 +
344      
345      RealType rha(0.0), drha(0.0), rhb(0.0), drhb(0.0);
346      RealType pha(0.0), dpha(0.0), phb(0.0), dphb(0.0);
# Line 358 | Line 358 | namespace OpenMD {
358        CubicSpline* phi = MixingMap[eamtid2][eamtid2].phi;
359        phi->getValueAndDerivativeAt( *(idat.rij), phb, dphb);
360      }
361
361      switch(mixMeth_) {
362      case eamJohnson:
364      
363        if ( *(idat.rij) < rci) {
364          phab = phab + 0.5 * (rhb / rha) * pha;
365          dvpdr = dvpdr + 0.5*((rhb/rha)*dpha +
366                               pha*((drhb/rha) - (rhb*drha/rha/rha)));
367        }
368 <      
371 <      
372 <      
368 >                
369        if ( *(idat.rij) < rcj) {
370          phab = phab + 0.5 * (rha / rhb) * phb;
371          dvpdr = dvpdr + 0.5 * ((rha/rhb)*dphb +
372                                 phb*((drha/rhb) - (rha*drhb/rhb/rhb)));
373        }
378      
374        break;
380      
375      case eamDaw:
382      
376        if ( *(idat.rij) <  MixingMap[eamtid1][eamtid2].rcut) {
377          MixingMap[eamtid1][eamtid2].phi->getValueAndDerivativeAt( *(idat.rij),
378                                                                    phab, dvpdr);
379        }
387      
380        break;
381      case eamUnknown:
382      default:
# Line 405 | Line 397 | namespace OpenMD {
397      
398      *(idat.f1) += *(idat.d) * dudr / *(idat.rij);
399  
408        
400      if (idat.doParticlePot) {
401        // particlePot is the difference between the full potential and
402        // the full potential without the presence of a particular
# Line 423 | Line 414 | namespace OpenMD {
414          - *(idat.frho1);
415      }
416      
417 <    (*(idat.pot))[METALLIC_FAMILY] += phab;
418 <    
419 <    *(idat.vpair) += phab;
429 <  
430 <    return;
431 <    
417 >    (*(idat.pot))[METALLIC_FAMILY] += phab;    
418 >    *(idat.vpair) += phab;  
419 >    return;    
420    }
421  
422    RealType EAM::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines