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 1571 by gezelter, Fri May 27 16:45:44 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 );
250      
# 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_) {
269 >      if (idat.shiftedPot) {
270          rcos = *(idat.rcut) * sigmai;
271          getLJfunc(rcos, myPotC, myDerivC);
272          myDerivC = 0.0;
273 <      } else if (LJ::shiftedFrc_) {
273 >      } else if (idat.shiftedForce) {
274          rcos = *(idat.rcut) * sigmai;
275          getLJfunc(rcos, myPotC, myDerivC);
276          myPotC = myPotC + myDerivC * (*(idat.rij) - *(idat.rcut)) * sigmai;
# Line 282 | Line 283 | namespace OpenMD {
283        *(idat.vpair) += pot_temp;
284        
285        RealType dudr = *(idat.sw) * *(idat.vdwMult) * epsilon * (myDeriv -
286 <                                                             myDerivC)*sigmai;
287 <      
288 <      (idat.pot)[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp;
286 >                                                                myDerivC)*sigmai;      
287 >
288 >      (*(idat.pot))[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp;
289        *(idat.f1) = *(idat.d) * dudr / *(idat.rij);
290      }
291      return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines