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

Comparing branches/development/src/brains/ForceManager.cpp (file contents):
Revision 1549 by gezelter, Wed Apr 27 18:38:15 2011 UTC vs.
Revision 1554 by gezelter, Sat Apr 30 02:54:02 2011 UTC

# Line 49 | Line 49
49  
50   #include "brains/ForceManager.hpp"
51   #include "primitives/Molecule.hpp"
52 #include "UseTheForce/doForces_interface.h"
52   #define __OPENMD_C
54 #include "UseTheForce/DarkSide/fInteractionMap.h"
53   #include "utils/simError.h"
54   #include "primitives/Bond.hpp"
55   #include "primitives/Bend.hpp"
56   #include "primitives/Torsion.hpp"
57   #include "primitives/Inversion.hpp"
58 + #include "nonbonded/NonBondedInteraction.hpp"
59   #include "parallel/ForceMatrixDecomposition.hpp"
61 //#include "parallel/ForceSerialDecomposition.hpp"
60  
61   using namespace std;
62   namespace OpenMD {
# Line 268 | Line 266 | namespace OpenMD {
266      }
267      
268      //initialize data before passing to fortran
269 <    RealType longRangePotential[LR_POT_TYPES];
269 >    RealType longRangePotential[N_INTERACTION_FAMILIES];
270      RealType lrPot = 0.0;
271      int isError = 0;
272  
273 <    for (int i=0; i<LR_POT_TYPES;i++){
273 >    // dangerous to iterate over enums, but we'll live on the edge:
274 >    for (int i = NO_FAMILY; i != N_INTERACTION_FAMILIES; ++i){
275        longRangePotential[i]=0.0; //Initialize array
276      }
277  
# Line 324 | Line 323 | namespace OpenMD {
323          rCutSq = groupCutoffMap[gtypes].first;
324  
325          if (rgrpsq < rCutSq) {
326 <          idat.rcut = groupCutoffMap[gtypes].second;
326 >          *(idat.rcut) = groupCutoffMap[gtypes].second;
327            if (iLoop == PAIR_LOOP) {
328              vij *= 0.0;
329              fij = V3Zero;
330            }
331            
332 <          in_switching_region = swfun_->getSwitch(rgrpsq, idat.sw, dswdr, rgrp);              
332 >          in_switching_region = swfun_->getSwitch(rgrpsq, *(idat.sw), dswdr,
333 >                                                  rgrp);              
334            atomListRow = fDecomp_->getAtomsInGroupRow(cg1);
335            atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2);
336  
# Line 347 | Line 347 | namespace OpenMD {
347                  idat = fDecomp_->fillInteractionData(atom1, atom2);
348  
349                  if (atomListRow.size() == 1 && atomListColumn.size() == 1) {
350 <                  idat.d = d_grp;
351 <                  idat.r2 = rgrpsq;
350 >                  *(idat.d) = d_grp;
351 >                  *(idat.r2) = rgrpsq;
352                  } else {
353 <                  idat.d = fDecomp_->getInteratomicVector(atom1, atom2);
354 <                  curSnapshot->wrapVector(idat.d);
355 <                  idat.r2 = idat.d.lengthSquare();
353 >                  *(idat.d) = fDecomp_->getInteratomicVector(atom1, atom2);
354 >                  curSnapshot->wrapVector( *(idat.d) );
355 >                  *(idat.r2) = idat.d->lengthSquare();
356                  }
357                  
358 <                idat.rij = sqrt(idat.r2);
358 >                *(idat.rij) = sqrt( *(idat.r2) );
359                
360                  if (iLoop == PREPAIR_LOOP) {
361                    interactionMan_->doPrePair(idat);
362                  } else {
363                    interactionMan_->doPair(idat);
364 <                  vij += idat.vpair;
365 <                  fij += idat.f1;
366 <                  tau -= outProduct(idat.d, idat.f1);
364 >                  vij += *(idat.vpair);
365 >                  fij += *(idat.f1);
366 >                  tau -= outProduct( *(idat.d), *(idat.f1));
367                  }
368                }
369              }
# Line 377 | Line 377 | namespace OpenMD {
377                fij += fg;
378  
379                if (atomListRow.size() == 1 && atomListColumn.size() == 1) {
380 <                tau -= outProduct(idat.d, fg);
380 >                tau -= outProduct( *(idat.d), fg);
381                }
382            
383                for (vector<int>::iterator ia = atomListRow.begin();
# Line 465 | Line 465 | namespace OpenMD {
465        }
466      }
467  
468 <    for (int i=0; i<LR_POT_TYPES;i++){
468 >    // dangerous to iterate over enums, but we'll live on the edge:
469 >    for (int i = NO_FAMILY; i != N_INTERACTION_FAMILIES; ++i){
470        lrPot += longRangePotential[i]; //Quick hack
471      }
472          
473      //store the tau and long range potential    
474      curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot;
475 <    curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VDW_POT];
476 <    curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_POT];
475 >    curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VANDERWAALS_FAMILY];
476 >    curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_FAMILY];
477    }
478  
479    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines