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 1545 by gezelter, Fri Apr 8 21:25:19 2011 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 241 | Line 240 | namespace OpenMD {
240    }
241  
242    void LJ::calcForce(InteractionData &idat) {
243 <    
244 <    if (!initialized_) initialize();
245 <    
243 >                #pragma omp critical
244 >        {
245 >                if (!initialized_) initialize();
246 >        }
247 >
248      map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it;
249 <    it = MixingMap.find(idat.atypes);
249 >    it = MixingMap.find( idat.atypes );
250      
251      if (it != MixingMap.end())  {
252        
# Line 261 | 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[0] += 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[0] += idat.sw * pot_temp;
289 <      idat.f1 = idat.d * dudr / idat.rij;      
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    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines