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 1505 by gezelter, Sun Oct 3 22:18:59 2010 UTC vs.
Revision 1549 by gezelter, Wed Apr 27 18:38:15 2011 UTC

# Line 347 | Line 347 | namespace OpenMD {
347      return;
348    }
349  
350 <  void EAM::calcDensity(DensityData ddat) {
350 >  void EAM::calcDensity(InteractionData &idat) {
351      
352      if (!initialized_) initialize();
353      
354 <    EAMAtomData data1 = EAMMap[ddat.atype1];
355 <    EAMAtomData data2 = EAMMap[ddat.atype2];
354 >    EAMAtomData data1 = EAMMap[idat.atypes.first];
355 >    EAMAtomData data2 = EAMMap[idat.atypes.second];
356  
357 <    if (ddat.rij < data1.rcut)
358 <      ddat.rho_i_at_j = data1.rho->getValueAt(ddat.rij);
357 >    if (idat.rij < data1.rcut)
358 >      idat.rho_i_at_j = data1.rho->getValueAt(idat.rij);
359  
360 <    if (ddat.rij < data2.rcut)
361 <      ddat.rho_j_at_i = data2.rho->getValueAt(ddat.rij);
360 >    if (idat.rij < data2.rcut)
361 >      idat.rho_j_at_i = data2.rho->getValueAt(idat.rij);
362  
363      return;
364    }
365  
366 <  void EAM::calcFunctional(FunctionalData fdat) {
366 >  void EAM::calcFunctional(SelfData &sdat) {
367  
368      if (!initialized_) initialize();
369  
370 <    EAMAtomData data1 = EAMMap[fdat.atype];
370 >    EAMAtomData data1 = EAMMap[sdat.atype];
371          
372 <    pair<RealType, RealType> result = data1.F->getValueAndDerivativeAt(fdat.rho);
372 >    pair<RealType, RealType> result = data1.F->getValueAndDerivativeAt(sdat.rho);
373  
374 <    fdat.frho = result.first;
375 <    fdat.dfrhodrho = result.second;
374 >    sdat.frho = result.first;
375 >    sdat.dfrhodrho = result.second;
376      return;
377    }
378  
379  
380 <  void EAM::calcForce(InteractionData idat) {
380 >  void EAM::calcForce(InteractionData &idat) {
381  
382      if (!initialized_) initialize();
383  
# Line 385 | Line 385 | namespace OpenMD {
385      
386      if (idat.rij < eamRcut_) {
387  
388 <      EAMAtomData data1 = EAMMap[idat.atype1];
389 <      EAMAtomData data2 = EAMMap[idat.atype2];
388 >      EAMAtomData data1 = EAMMap[idat.atypes.first];
389 >      EAMAtomData data2 = EAMMap[idat.atypes.second];
390  
391        // get type-specific cutoff radii
392  
# Line 403 | Line 403 | namespace OpenMD {
403          rha = res.first;
404          drha = res.second;
405  
406 <        res = MixingMap[make_pair(idat.atype1, idat.atype1)].phi->getValueAndDerivativeAt(idat.rij);
406 >        res = MixingMap[make_pair(idat.atypes.first, idat.atypes.first)].phi->getValueAndDerivativeAt(idat.rij);
407          pha = res.first;
408          dpha = res.second;
409        }
# Line 413 | Line 413 | namespace OpenMD {
413          rhb = res.first;
414          drhb = res.second;
415  
416 <        res = MixingMap[make_pair(idat.atype2, idat.atype2)].phi->getValueAndDerivativeAt(idat.rij);
416 >        res = MixingMap[make_pair(idat.atypes.second, idat.atypes.second)].phi->getValueAndDerivativeAt(idat.rij);
417          phb = res.first;
418          dphb = res.second;
419        }
# Line 439 | Line 439 | namespace OpenMD {
439          break;
440  
441        case eamDaw:
442 <        res = MixingMap[make_pair(idat.atype1,idat.atype2)].phi->getValueAndDerivativeAt(idat.rij);
442 >        res = MixingMap[idat.atypes].phi->getValueAndDerivativeAt(idat.rij);
443          phab = res.first;
444          dvpdr = res.second;
445  
# Line 478 | Line 478 | namespace OpenMD {
478        idat.fshift1 = data1.F->getValueAt( idat.rho1 - rhb );
479        idat.fshift2 = data1.F->getValueAt( idat.rho2 - rha );
480  
481 <      idat.pot += phab;
481 >      idat.pot[3] += phab;
482  
483        idat.vpair += phab;
484      }
# Line 487 | Line 487 | namespace OpenMD {
487      
488    }
489  
490 <  RealType EAM::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) {
490 >  RealType EAM::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) {
491      if (!initialized_) initialize();  
492  
493      RealType cut = 0.0;
494  
495      map<AtomType*, EAMAtomData>::iterator it;
496  
497 <    it = EAMMap.find(at1);
497 >    it = EAMMap.find(atypes.first);
498      if (it != EAMMap.end()) {
499        EAMAtomData data1 = (*it).second;
500        cut = data1.rcut;
501      }
502  
503 <    it = EAMMap.find(at2);
503 >    it = EAMMap.find(atypes.second);
504      if (it != EAMMap.end()) {
505        EAMAtomData data2 = (*it).second;
506        if (data2.rcut > cut)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines