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

Comparing branches/development/src/nonbonded/EAM.cpp (file contents):
Revision 1479 by gezelter, Mon Jul 26 19:00:48 2010 UTC vs.
Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 36 | Line 36
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38   * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <stdio.h>
# Line 50 | Line 51 | namespace OpenMD {
51  
52   namespace OpenMD {
53  
54 <  bool EAM::initialized_ = false;
55 <  RealType EAM::eamRcut_ = 0.0;
55 <  EAMMixingMethod EAM::mixMeth_ = eamJohnson;
56 <  ForceField* EAM::forceField_ = NULL;
57 <  std::map<int, AtomType*> EAM::EAMlist;
58 <  std::map<AtomType*, EAMAtomData> EAM::EAMMap;
59 <  std::map<std::pair<AtomType*, AtomType*>, EAMInteractionData> EAM::MixingMap;
60 <
54 >  EAM::EAM() : name_("EAM"), initialized_(false), forceField_(NULL),
55 >               mixMeth_(eamJohnson), eamRcut_(0.0), haveCutoffRadius_(false) {}
56    
62  EAM* EAM::_instance = NULL;
63
64  EAM* EAM::Instance() {
65    if (!_instance) {
66      _instance = new EAM();
67    }
68    return _instance;
69  }
70  
57    EAMParam EAM::getEAMParam(AtomType* atomType) {
58      
59      // Do sanity checking on the AtomType we were passed before
# Line 111 | Line 97 | namespace OpenMD {
97      RealType dr = eamParam.dr;
98      vector<RealType> rvals;
99      
100 <    for (int i = 0; i < nr; i++) rvals.push_back(i * dr);
100 >    for (int i = 0; i < nr; i++) rvals.push_back(RealType(i) * dr);
101        
102      CubicSpline* cs = new CubicSpline();
103      cs->addPoints(rvals, eamParam.Z);
# Line 129 | Line 115 | namespace OpenMD {
115      RealType dr = eamParam.dr;
116      vector<RealType> rvals;
117      
118 <    for (int i = 0; i < nr; i++) rvals.push_back(i * dr);
118 >    for (int i = 0; i < nr; i++) rvals.push_back(RealType(i) * dr);
119        
120      CubicSpline* cs = new CubicSpline();
121      cs->addPoints(rvals, eamParam.rho);
# Line 144 | Line 130 | namespace OpenMD {
130      vector<RealType> scaledF;
131      
132      for (int i = 0; i < nrho; i++) {
133 <      rhovals.push_back(i * drho);
133 >      rhovals.push_back(RealType(i) * drho);
134        scaledF.push_back( eamParam.F[i] * 23.06054 );
135      }
136        
137      CubicSpline* cs = new CubicSpline();
138 <    cs->addPoints(rhovals, eamParam.F);
138 >    cs->addPoints(rhovals, scaledF);
139      return cs;
140    }
141    
# Line 161 | Line 147 | namespace OpenMD {
147  
148      // make the r grid:
149  
164    // set rcut to be the smaller of the two atomic rcuts
150  
151 <    RealType rcut = eamParam1.rcut < eamParam2.rcut ?
152 <      eamParam1.rcut : eamParam2.rcut;
151 >    // we need phi out to the largest value we'll encounter in the radial space;
152 >    
153 >    RealType rmax = 0.0;
154 >    rmax = max(rmax, eamParam1.rcut);
155 >    rmax = max(rmax, eamParam1.nr * eamParam1.dr);
156  
157 +    rmax = max(rmax, eamParam2.rcut);
158 +    rmax = max(rmax, eamParam2.nr * eamParam2.dr);
159 +
160      // use the smallest dr (finest grid) to build our grid:
161  
162 <    RealType dr = eamParam1.dr < eamParam2.dr ? eamParam1.dr : eamParam2.dr;
163 <    int nr = int(rcut/dr);
162 >    RealType dr = min(eamParam1.dr, eamParam2.dr);
163 >
164 >    int nr = int(rmax/dr + 0.5);
165 >
166      vector<RealType> rvals;
167 <    for (int i = 0; i < nr; i++) rvals.push_back(i*dr);
167 >    for (int i = 0; i < nr; i++) rvals.push_back(RealType(i*dr));
168  
169      // construct the pair potential:
170  
# Line 184 | Line 177 | namespace OpenMD {
177  
178      for (int i = 1; i < rvals.size(); i++ ) {
179        r = rvals[i];
180 <      zi = z1->getValueAt(r);
181 <      zj = z2->getValueAt(r);
180 >
181 >      // only use z(r) if we're inside this atom's cutoff radius,
182 >      // otherwise, we'll use zero for the charge.  This effectively
183 >      // means that our phi grid goes out beyond the cutoff of the
184 >      // pair potential
185 >
186 >      zi = r <= eamParam1.rcut ? z1->getValueAt(r) : 0.0;
187 >      zj = r <= eamParam2.rcut ? z2->getValueAt(r) : 0.0;
188  
189        phi = 331.999296 * (zi * zj) / r;
190 +
191        phivals.push_back(phi);
192      }
193        
# Line 196 | Line 196 | namespace OpenMD {
196      return cs;
197    }
198  
199 +  void EAM::setCutoffRadius( RealType rCut ) {
200 +    eamRcut_ = rCut;
201 +    haveCutoffRadius_ = true;
202 +  }
203 +
204    void EAM::initialize() {
205  
206      // set up the mixing method:
207      ForceFieldOptions& fopts = forceField_->getForceFieldOptions();
208 <    string EAMMixMeth = toUpperCopy(fopts.getEAMMixingMethod());
209 <
208 >    string EAMMixMeth = fopts.getEAMMixingMethod();
209 >    toUpper(EAMMixMeth);
210 >  
211      if (EAMMixMeth == "JOHNSON")
212        mixMeth_ = eamJohnson;    
213      else if (EAMMixMeth == "DAW")
# Line 231 | Line 237 | namespace OpenMD {
237        
238        if (nbt->isEAM()) {
239          
240 <        std::pair<AtomType*, AtomType*> atypes = nbt->getAtomTypes();
240 >        pair<AtomType*, AtomType*> atypes = nbt->getAtomTypes();
241          
242          GenericData* data = nbt->getPropertyByName("EAM");
243          if (data == NULL) {
# Line 282 | Line 288 | namespace OpenMD {
288      // add it to the map:
289      AtomTypeProperties atp = atomType->getATP();    
290  
291 <    std::pair<std::map<int,AtomType*>::iterator,bool> ret;    
292 <    ret = EAMlist.insert( std::pair<int, AtomType*>(atp.ident, atomType) );
291 >    pair<map<int,AtomType*>::iterator,bool> ret;    
292 >    ret = EAMlist.insert( pair<int, AtomType*>(atp.ident, atomType) );
293      if (ret.second == false) {
294        sprintf( painCave.errMsg,
295                 "EAM already had a previous entry with ident %d\n",
# Line 297 | Line 303 | namespace OpenMD {
303      
304      // Now, iterate over all known types and add to the mixing map:
305      
306 <    std::map<AtomType*, EAMAtomData>::iterator it;
306 >    map<AtomType*, EAMAtomData>::iterator it;
307      for( it = EAMMap.begin(); it != EAMMap.end(); ++it) {
308        
309        AtomType* atype2 = (*it).first;
# Line 306 | Line 312 | namespace OpenMD {
312        mixer.phi = getPhi(atomType, atype2);
313        mixer.explicitlySet = false;
314  
315 <      std::pair<AtomType*, AtomType*> key1, key2;
316 <      key1 = std::make_pair(atomType, atype2);
317 <      key2 = std::make_pair(atype2, atomType);
315 >      pair<AtomType*, AtomType*> key1, key2;
316 >      key1 = make_pair(atomType, atype2);
317 >      key2 = make_pair(atype2, atomType);
318        
319        MixingMap[key1] = mixer;
320        if (key2 != key1) {
# Line 336 | Line 342 | namespace OpenMD {
342      mixer.phi = cs;
343      mixer.explicitlySet = true;
344  
345 <    std::pair<AtomType*, AtomType*> key1, key2;
346 <    key1 = std::make_pair(atype1, atype2);
347 <    key2 = std::make_pair(atype2, atype1);
345 >    pair<AtomType*, AtomType*> key1, key2;
346 >    key1 = make_pair(atype1, atype2);
347 >    key2 = make_pair(atype2, atype1);
348      
349      MixingMap[key1] = mixer;
350      if (key2 != key1) {
# Line 347 | Line 353 | namespace OpenMD {
353      return;
354    }
355  
356 <  void EAM::calcDensity(AtomType* at1, AtomType* at2, const RealType rij,
351 <                        RealType &rho_i_at_j, RealType &rho_j_at_i) {
356 >  void EAM::calcDensity(InteractionData &idat) {
357      
358      if (!initialized_) initialize();
359      
360 <    EAMAtomData data1 = EAMMap[at1];
361 <    EAMAtomData data2 = EAMMap[at2];
362 <
363 <    if (rij < data1.rcut) rho_i_at_j = data1.rho->getValueAt(rij);
364 <    if (rij < data2.rcut) rho_j_at_i = data2.rho->getValueAt(rij);
365 <    return;
360 >    EAMAtomData data1 = EAMMap[idat.atypes.first];
361 >    EAMAtomData data2 = EAMMap[idat.atypes.second];
362 >    
363 >    if (haveCutoffRadius_)
364 >      if ( *(idat.rij) > eamRcut_) return;
365 >    
366 >    if ( *(idat.rij) < data1.rcut)
367 >      *(idat.rho1) += data1.rho->getValueAt( *(idat.rij));
368 >    
369 >      
370 >    if ( *(idat.rij) < data2.rcut)
371 >      *(idat.rho2) += data2.rho->getValueAt( *(idat.rij));
372 >    
373 >    return;  
374    }
375 <
376 <  void EAM::calcFunctional(AtomType* at1, RealType rho, RealType &frho,
377 <                           RealType &dfrhodrho) {
365 <
375 >  
376 >  void EAM::calcFunctional(SelfData &sdat) {
377 >    
378      if (!initialized_) initialize();
379  
380 <    EAMAtomData data1 = EAMMap[at1];
380 >    EAMAtomData data1 = EAMMap[ sdat.atype ];
381          
382 <    pair<RealType, RealType> result = data1.F->getValueAndDerivativeAt(rho);
382 >    pair<RealType, RealType> result = data1.F->getValueAndDerivativeAt( *(sdat.rho) );
383  
384 <    frho = result.first;
385 <    dfrhodrho = result.second;
384 >    *(sdat.frho) = result.first;
385 >    *(sdat.dfrhodrho) = result.second;
386 >
387 >    (*(sdat.pot))[METALLIC_FAMILY] += result.first;
388 >    *(sdat.particlePot) += result.first;
389 >
390      return;
391    }
392  
393  
394 <  void EAM::calcForce(AtomType* at1, AtomType* at2, Vector3d d,
379 <                      RealType rij, RealType r2, RealType sw,
380 <                      RealType &vpair, RealType &pot, Vector3d &f1,
381 <                      RealType rho_i, RealType rho_j,
382 <                      RealType dfrhodrho_i, RealType dfrhodrho_j,
383 <                      RealType &fshift_i, RealType &fshift_j) {
394 >  void EAM::calcForce(InteractionData &idat) {
395  
396      if (!initialized_) initialize();
397 <    
397 >
398 >    if (haveCutoffRadius_)
399 >      if ( *(idat.rij) > eamRcut_) return;
400 >  
401      pair<RealType, RealType> res;
402      
403 <    if (rij < eamRcut_) {
404 <
405 <      EAMAtomData data1 = EAMMap[at1];
406 <      EAMAtomData data2 = EAMMap[at2];
407 <
408 <      // get type-specific cutoff radii
409 <
410 <      RealType rci = data1.rcut;
411 <      RealType rcj = data2.rcut;
403 >    EAMAtomData data1 = EAMMap[idat.atypes.first];
404 >    EAMAtomData data2 = EAMMap[idat.atypes.second];
405 >    
406 >    // get type-specific cutoff radii
407 >    
408 >    RealType rci = data1.rcut;
409 >    RealType rcj = data2.rcut;
410 >    
411 >    RealType rha(0.0), drha(0.0), rhb(0.0), drhb(0.0);
412 >    RealType pha(0.0), dpha(0.0), phb(0.0), dphb(0.0);
413 >    RealType phab(0.0), dvpdr(0.0);
414 >    RealType drhoidr, drhojdr, dudr;
415 >    
416 >    if ( *(idat.rij) < rci) {
417 >      res = data1.rho->getValueAndDerivativeAt( *(idat.rij));
418 >      rha = res.first;
419 >      drha = res.second;
420        
421 <      RealType rha, drha, rhb, drhb;
422 <      RealType pha, dpha, phb, dphb;
423 <      RealType phab, dvpdr;
424 <      RealType drhoidr, drhojdr, dudr;
421 >      res = MixingMap[make_pair(idat.atypes.first, idat.atypes.first)].phi->getValueAndDerivativeAt( *(idat.rij) );
422 >      pha = res.first;
423 >      dpha = res.second;
424 >    }
425 >    
426 >    if ( *(idat.rij) < rcj) {
427 >      res = data2.rho->getValueAndDerivativeAt( *(idat.rij) );
428 >      rhb = res.first;
429 >      drhb = res.second;
430        
431 <      if (rij < rci) {
432 <        res = data1.rho->getValueAndDerivativeAt(rij);
433 <        rha = res.first;
434 <        drha = res.second;
431 >      res = MixingMap[make_pair(idat.atypes.second, idat.atypes.second)].phi->getValueAndDerivativeAt( *(idat.rij) );
432 >      phb = res.first;
433 >      dphb = res.second;
434 >    }
435  
436 <        res = MixingMap[make_pair(at1, at1)].phi->getValueAndDerivativeAt(rij);
437 <        pha = res.first;
438 <        dpha = res.second;
436 >    switch(mixMeth_) {
437 >    case eamJohnson:
438 >      
439 >      if ( *(idat.rij) < rci) {
440 >        phab = phab + 0.5 * (rhb / rha) * pha;
441 >        dvpdr = dvpdr + 0.5*((rhb/rha)*dpha +
442 >                             pha*((drhb/rha) - (rhb*drha/rha/rha)));
443        }
444 <
445 <      if (rij < rcj) {
446 <        res = data2.rho->getValueAndDerivativeAt(rij);
447 <        rhb = res.first;
448 <        drhb = res.second;
449 <
450 <        res = MixingMap[make_pair(at2, at2)].phi->getValueAndDerivativeAt(rij);
420 <        phb = res.first;
421 <        dphb = res.second;
422 <      }
423 <
424 <      phab = 0.0;
425 <      dvpdr = 0.0;
426 <
427 <      switch(mixMeth_) {
428 <      case eamJohnson:
429 <      
430 <        if (rij < rci) {
431 <          phab = phab + 0.5 * (rhb / rha) * pha;
432 <          dvpdr = dvpdr + 0.5*((rhb/rha)*dpha +
433 <                               pha*((drhb/rha) - (rhb*drha/rha/rha)));
434 <        }
435 <
436 <        if (rij < rcj) {
437 <          phab = phab + 0.5 * (rha / rhb) * phb;
438 <          dvpdr = dvpdr + 0.5 * ((rha/rhb)*dphb +
439 <                                 phb*((drha/rhb) - (rha*drhb/rhb/rhb)));
440 <        }
441 <
442 <        break;
443 <
444 <      case eamDaw:
445 <                
446 <        res = MixingMap[make_pair(at1,at2)].phi->getValueAndDerivativeAt(rij);
447 <        phab = res.first;
448 <        dvpdr = res.second;
449 <
450 <        break;
451 <      case eamUnknown:
452 <      default:
453 <
454 <        sprintf(painCave.errMsg,
455 <                "EAM::calcForce hit a mixing method it doesn't know about!\n"
456 <                );
457 <        painCave.severity = OPENMD_ERROR;
458 <        painCave.isFatal = 1;
459 <        simError();        
460 <          
444 >      
445 >      
446 >      
447 >      if ( *(idat.rij) < rcj) {
448 >        phab = phab + 0.5 * (rha / rhb) * phb;
449 >        dvpdr = dvpdr + 0.5 * ((rha/rhb)*dphb +
450 >                               phb*((drha/rhb) - (rha*drhb/rhb/rhb)));
451        }
452        
453 <      drhoidr = drha;
454 <      drhojdr = drhb;
455 <
456 <      dudr = drhojdr*dfrhodrho_i + drhoidr*dfrhodrho_j + dvpdr;
457 <
458 <      f1 = d * dudr / rij;
459 <        
460 <      // particle_pot is the difference between the full potential
461 <      // and the full potential without the presence of a particular
462 <      // particle (atom1).
463 <      //
464 <      // This reduces the density at other particle locations, so
465 <      // we need to recompute the density at atom2 assuming atom1
466 <      // didn't contribute.  This then requires recomputing the
467 <      // density functional for atom2 as well.
468 <      //
469 <      // Most of the particle_pot heavy lifting comes from the
470 <      // pair interaction, and will be handled by vpair.
481 <    
482 <      fshift_i = data1.F->getValueAt( rho_i - rhb );
483 <      fshift_j = data1.F->getValueAt( rho_j - rha );
484 <
485 <      pot += phab;
486 <
487 <      vpair += phab;
453 >      break;
454 >      
455 >    case eamDaw:
456 >      res = MixingMap[idat.atypes].phi->getValueAndDerivativeAt( *(idat.rij));
457 >      phab = res.first;
458 >      dvpdr = res.second;
459 >      
460 >      break;
461 >    case eamUnknown:
462 >    default:
463 >      
464 >      sprintf(painCave.errMsg,
465 >              "EAM::calcForce hit a mixing method it doesn't know about!\n"
466 >              );
467 >      painCave.severity = OPENMD_ERROR;
468 >      painCave.isFatal = 1;
469 >      simError();        
470 >      
471      }
489
490    return;
472      
473 <  }
474 <
494 <
495 <  void EAM::calc_eam_prepair_rho(int *atid1, int *atid2, RealType *rij,
496 <                                 RealType* rho_i_at_j, RealType* rho_j_at_i){
497 <
498 <    if (!initialized_) initialize();
473 >    drhoidr = drha;
474 >    drhojdr = drhb;
475      
476 <    AtomType* atype1 = EAMlist[*atid1];
501 <    AtomType* atype2 = EAMlist[*atid2];
476 >    dudr = drhojdr* *(idat.dfrho1) + drhoidr* *(idat.dfrho2) + dvpdr;
477      
478 <    calcDensity(atype1, atype2, *rij, *rho_i_at_j, *rho_j_at_i);
479 <
480 <    return;    
481 <  }
482 <
483 <  void EAM::calc_eam_preforce_Frho(int *atid1, RealType *rho, RealType *frho,
484 <                                   RealType *dfrhodrho) {
485 <
486 <    if (!initialized_) initialize();
487 <
513 <    AtomType* atype1 = EAMlist[*atid1];  
514 <
515 <    calcFunctional(atype1, *rho, *frho, *dfrhodrho);
478 >    *(idat.f1) += *(idat.d) * dudr / *(idat.rij);
479 >        
480 >    // particlePot is the difference between the full potential and
481 >    // the full potential without the presence of a particular
482 >    // particle (atom1).
483 >    //
484 >    // This reduces the density at other particle locations, so we
485 >    // need to recompute the density at atom2 assuming atom1 didn't
486 >    // contribute.  This then requires recomputing the density
487 >    // functional for atom2 as well.
488      
489 <    return;    
490 <  }
519 <  RealType EAM::getEAMcut(int *atid1) {
520 <
521 <    if (!initialized_) initialize();
489 >    *(idat.particlePot1) += data2.F->getValueAt( *(idat.rho2) - rha )
490 >      - *(idat.frho2);
491      
492 <    AtomType* atype1 = EAMlist[*atid1];  
493 <      
525 <    return getRcut(atype1);
526 <  }
527 <
528 <  void EAM::do_eam_pair(int *atid1, int *atid2, RealType *d, RealType *rij,
529 <                        RealType *r2, RealType *sw, RealType *vpair,
530 <                        RealType *pot, RealType *f1, RealType *rho1,
531 <                        RealType *rho2, RealType *dfrho1, RealType *dfrho2,
532 <                        RealType *fshift1, RealType *fshift2) {
533 <
534 <    if (!initialized_) initialize();
492 >    *(idat.particlePot2) += data1.F->getValueAt( *(idat.rho1) - rhb)
493 >      - *(idat.frho1);
494      
495 <    AtomType* atype1 = EAMlist[*atid1];
537 <    AtomType* atype2 = EAMlist[*atid2];
495 >    (*(idat.pot))[METALLIC_FAMILY] += phab;
496      
497 <    Vector3d disp(d[0], d[1], d[2]);
498 <    Vector3d frc(f1[0], f1[1], f1[2]);
497 >    *(idat.vpair) += phab;
498 >  
499 >    return;
500      
542    calcForce(atype1, atype2, disp, *rij, *r2, *sw, *vpair,  *pot, frc,
543              *rho1, *rho2, *dfrho1, *dfrho2, *fshift1, *fshift2);
544      
545    f1[0] = frc.x();
546    f1[1] = frc.y();
547    f1[2] = frc.z();
548
549    return;    
501    }
551  
552  void EAM::setCutoffEAM(RealType *thisRcut) {
553    eamRcut_ = *thisRcut;
554  }
555 }
502  
503 < extern "C" {
504 <  
559 < #define fortranCalcDensity FC_FUNC(calc_eam_prepair_rho, CALC_EAM_PREPAIR_RHO)
560 < #define fortranCalcFunctional FC_FUNC(calc_eam_preforce_frho, CALC_EAM_PREFORCE_FRHO)
561 < #define fortranCalcForce FC_FUNC(do_eam_pair, DO_EAM_PAIR)
562 < #define fortranSetCutoffEAM FC_FUNC(setcutoffeam, SETCUTOFFEAM)
563 < #define fortranGetEAMcut FC_FUNC(geteamcut, GETEAMCUT)
503 >  RealType EAM::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) {
504 >    if (!initialized_) initialize();  
505  
506 <  
566 <  void fortranCalcDensity(int *atid1, int *atid2, RealType *rij,
567 <                          RealType *rho_i_at_j, RealType *rho_j_at_i) {
568 <    
569 <    return OpenMD::EAM::Instance()->calc_eam_prepair_rho(atid1, atid2, rij,
570 <                                                         rho_i_at_j,  
571 <                                                         rho_j_at_i);
572 <  }
573 <  void fortranCalcFunctional(int *atid1, RealType *rho, RealType *frho,
574 <                             RealType *dfrhodrho) {  
575 <    
576 <    return OpenMD::EAM::Instance()->calc_eam_preforce_Frho(atid1, rho, frho,
577 <                                                           dfrhodrho);
578 <    
579 <  }
580 <  void fortranSetCutoffEAM(RealType *rcut) {
581 <    return OpenMD::EAM::Instance()->setCutoffEAM(rcut);
582 <  }
583 <  void fortranCalcForce(int *atid1, int *atid2, RealType *d, RealType *rij,
584 <                        RealType *r2, RealType *sw, RealType *vpair,
585 <                        RealType *pot, RealType *f1, RealType *rho1,
586 <                        RealType *rho2, RealType *dfrho1, RealType *dfrho2,
587 <                        RealType *fshift1, RealType *fshift2){
588 <    
589 <    return OpenMD::EAM::Instance()->do_eam_pair(atid1, atid2, d, rij,
590 <                                                r2, sw, vpair,
591 <                                                pot, f1, rho1,
592 <                                                rho2, dfrho1, dfrho2,
593 <                                                fshift1,  fshift2);
594 <  }
595 <  RealType fortranGetEAMcut(int* atid) {
596 <    return OpenMD::EAM::Instance()->getEAMcut(atid);
597 <  }
506 >    RealType cut = 0.0;
507  
508 +    map<AtomType*, EAMAtomData>::iterator it;
509 +
510 +    it = EAMMap.find(atypes.first);
511 +    if (it != EAMMap.end()) {
512 +      EAMAtomData data1 = (*it).second;
513 +      cut = data1.rcut;
514 +    }
515 +
516 +    it = EAMMap.find(atypes.second);
517 +    if (it != EAMMap.end()) {
518 +      EAMAtomData data2 = (*it).second;
519 +      if (data2.rcut > cut)
520 +        cut = data2.rcut;
521 +    }
522 +
523 +    return cut;
524 +  }
525   }
526 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines