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

Comparing:
branches/development/src/nonbonded/LJ.cpp (file contents), Revision 1505 by gezelter, Sun Oct 3 22:18:59 2010 UTC vs.
branches/devel_omp/src/nonbonded/LJ.cpp (file contents), Revision 1608 by mciznick, Tue Aug 9 01:58:56 2011 UTC

# Line 48 | Line 48 | namespace OpenMD {
48  
49   namespace OpenMD {
50  
51 <  LJ::LJ() : name_("LJ"), initialized_(false), shiftedPot_(false),
52 <             shiftedFrc_(false), forceField_(NULL) {}
51 >  LJ::LJ() : name_("LJ"), initialized_(false), forceField_(NULL) {}
52  
53    LJParam LJ::getLJParam(AtomType* atomType) {
54      
# Line 240 | Line 239 | namespace OpenMD {
239      }    
240    }
241  
242 <  void LJ::calcForce(InteractionData idat) {
243 <    
244 <    if (!initialized_) initialize();
245 <    
246 <    pair<AtomType*, AtomType*> key = make_pair(idat.atype1, idat.atype2);
242 >  void LJ::calcForce(InteractionData &idat) {
243 >                #pragma omp critical
244 >        {
245 >                if (!initialized_) initialize();
246 >        }
247 >
248      map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it;
249 <    it = MixingMap.find(key);
249 >    it = MixingMap.find( idat.atypes );
250      
251      if (it != MixingMap.end())  {
252        
# Line 262 | Line 262 | namespace OpenMD {
262        RealType myDeriv = 0.0;
263        RealType myDerivC = 0.0;
264      
265 <      ros = idat.rij * sigmai;
265 >      ros = *(idat.rij) * sigmai;    
266        
267        getLJfunc(ros, myPot, myDeriv);
268        
269 <      if (shiftedPot_) {
270 <        rcos = idat.rcut * sigmai;
269 >      if (idat.shiftedPot) {
270 >        rcos = *(idat.rcut) * sigmai;
271          getLJfunc(rcos, myPotC, myDerivC);
272          myDerivC = 0.0;
273 <      } else if (LJ::shiftedFrc_) {
274 <        rcos = idat.rcut * sigmai;
273 >      } else if (idat.shiftedForce) {
274 >        rcos = *(idat.rcut) * sigmai;
275          getLJfunc(rcos, myPotC, myDerivC);
276 <        myPotC = myPotC + myDerivC * (idat.rij - idat.rcut) * sigmai;
276 >        myPotC = myPotC + myDerivC * (*(idat.rij) - *(idat.rcut)) * sigmai;
277        } else {
278          myPotC = 0.0;
279          myDerivC = 0.0;        
280        }
281  
282 <      RealType pot_temp = idat.vdwMult * epsilon * (myPot - myPotC);
283 <      idat.vpair += pot_temp;
282 >      RealType pot_temp = *(idat.vdwMult) * epsilon * (myPot - myPotC);
283 >      *(idat.vpair) += pot_temp;
284        
285 <      RealType dudr = idat.sw * idat.vdwMult * epsilon * (myDeriv -
286 <                                                          myDerivC)*sigmai;
287 <      
288 <      idat.pot += idat.sw * pot_temp;
289 <      idat.f1 = idat.d * dudr / idat.rij;
290 <      
285 >      RealType dudr = *(idat.sw) * *(idat.vdwMult) * epsilon * (myDeriv -
286 >                                                                myDerivC)*sigmai;      
287 >
288 >      (*(idat.pot))[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp;
289 >      *(idat.f1) = *(idat.d) * dudr / *(idat.rij);
290      }
291      return;
292    }
# Line 307 | Line 306 | namespace OpenMD {
306      return;
307    }
308    
309 <  RealType LJ::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) {
309 >  RealType LJ::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) {
310      if (!initialized_) initialize();  
312    pair<AtomType*, AtomType*> key = make_pair(at1, at2);
311      map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it;
312 <    it = MixingMap.find(key);
312 >    it = MixingMap.find(atypes);
313      if (it == MixingMap.end())
314        return 0.0;
315      else  {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines