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 1895 by gezelter, Mon Jul 1 21:09:37 2013 UTC vs.
Revision 1929 by gezelter, Mon Aug 19 13:12:00 2013 UTC

# Line 60 | Line 60 | namespace OpenMD {
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;
# Line 101 | Line 106 | namespace OpenMD {
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      }
# Line 207 | Line 212 | namespace OpenMD {
212      eamAtomData.F = ea.getF();
213      eamAtomData.Z = ea.getZ();
214      eamAtomData.rcut = ea.getRcut();
215 <
215 >      
216      // add it to the map:
217      int atid = atomType->getIdent();
218      int eamtid = EAMtypes.size();
# Line 223 | Line 228 | namespace OpenMD {
228        simError();        
229      }
230  
231 +
232      EAMtids[atid] = eamtid;
233      EAMdata[eamtid] = eamAtomData;
234      MixingMap[eamtid].resize(nEAM_);
# Line 237 | Line 243 | namespace OpenMD {
243  
244        EAMInteractionData mixer;
245        mixer.phi = getPhi(atomType, atype2);
246 +      mixer.rcut = mixer.phi->getLimits().second;
247        mixer.explicitlySet = false;
248  
249        MixingMap[eamtid2].resize( nEAM_ );
# Line 265 | Line 272 | namespace OpenMD {
272  
273      cs->addPoints(rVals, phiVals);
274      mixer.phi = cs;
275 +    mixer.rcut = mixer.phi->getLimits().second;
276      mixer.explicitlySet = true;
277  
278      int eamtid1 = EAMtids[ atype1->getIdent() ];
# Line 286 | Line 294 | namespace OpenMD {
294  
295      if (haveCutoffRadius_)
296        if ( *(idat.rij) > eamRcut_) return;
289    
290    if ( *(idat.rij) < data1.rcut)
291      *(idat.rho1) += data1.rho->getValueAt( *(idat.rij));
297      
298 +    if ( *(idat.rij) < data1.rcut) {
299 +      *(idat.rho2) += data1.rho->getValueAt( *(idat.rij));
300 +    }
301        
302 <    if ( *(idat.rij) < data2.rcut)
303 <      *(idat.rho2) += data2.rho->getValueAt( *(idat.rij));
302 >    if ( *(idat.rij) < data2.rcut) {
303 >      *(idat.rho1) += data2.rho->getValueAt( *(idat.rij));
304 >    }
305      
306      return;  
307    }
# Line 302 | Line 311 | namespace OpenMD {
311      if (!initialized_) initialize();
312  
313      EAMAtomData &data1 = EAMdata[ EAMtids[sdat.atid] ];
314 <        
314 >            
315      data1.F->getValueAndDerivativeAt( *(sdat.rho), *(sdat.frho), *(sdat.dfrhodrho) );
316  
317      (*(sdat.pot))[METALLIC_FAMILY] += *(sdat.frho);
# Line 370 | Line 379 | namespace OpenMD {
379        break;
380        
381      case eamDaw:
373      MixingMap[eamtid1][eamtid2].phi->getValueAndDerivativeAt( *(idat.rij), phab, dvpdr);
382        
383 +      if ( *(idat.rij) <  MixingMap[eamtid1][eamtid2].rcut) {
384 +        MixingMap[eamtid1][eamtid2].phi->getValueAndDerivativeAt( *(idat.rij),
385 +                                                                  phab, dvpdr);
386 +      }
387 +      
388        break;
389      case eamUnknown:
390      default:
# Line 391 | Line 404 | namespace OpenMD {
404      dudr = drhojdr* *(idat.dfrho1) + drhoidr* *(idat.dfrho2) + dvpdr;
405      
406      *(idat.f1) += *(idat.d) * dudr / *(idat.rij);
407 +
408          
409      if (idat.doParticlePot) {
410        // particlePot is the difference between the full potential and

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines