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 1927 by gezelter, Wed Aug 14 20:19:19 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 261 | 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 289 | 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 312 | Line 296 | namespace OpenMD {
296        if ( *(idat.rij) > eamRcut_) return;
297      
298      if ( *(idat.rij) < data1.rcut) {
299 <      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 <      }
299 >      *(idat.rho2) += data1.rho->getValueAt( *(idat.rij));
300      }
301        
302      if ( *(idat.rij) < data2.rcut) {
303 <      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 <      }
303 >      *(idat.rho1) += data2.rho->getValueAt( *(idat.rij));
304      }
305      
306      return;  
# Line 377 | 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);
380      if (data1.isFluctuating) {
381        *(idat.dVdFQ1) -= *(idat.dfrho2) * rha * data1.qToRhoScaling;
382      }
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);
389      if (data2.isFluctuating) {
390        *(idat.dVdFQ2) -= *(idat.dfrho1) * rhb * data2.qToRhoScaling;
391      }
360      }
361  
362      switch(mixMeth_) {
# Line 411 | Line 379 | namespace OpenMD {
379        break;
380        
381      case eamDaw:
414      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:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines