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 1570 by gezelter, Thu May 26 21:56:04 2011 UTC vs.
Revision 1575 by gezelter, Fri Jun 3 21:39:49 2011 UTC

# Line 63 | Line 63 | namespace OpenMD {
63    
64    ForceManager::ForceManager(SimInfo * info) : info_(info) {
65  
66 #ifdef IS_MPI
66      fDecomp_ = new ForceMatrixDecomposition(info_);
68 #else
69    // fDecomp_ = new ForceSerialDecomposition(info);
70 #endif
67    }
68    
69    void ForceManager::calcForces() {
# Line 77 | Line 73 | namespace OpenMD {
73        interactionMan_->setSimInfo(info_);
74        interactionMan_->initialize();
75        swfun_ = interactionMan_->getSwitchingFunction();
80      fDecomp_->distributeInitialData();
76        info_->prepareTopology();
77 +      fDecomp_->distributeInitialData();
78      }
79      
80      preCalculation();  
# Line 265 | Line 261 | namespace OpenMD {
261        rc = pos;
262      }
263      
268    //initialize data before passing to fortran
269    RealType longRangePotential[N_INTERACTION_FAMILIES];
270    RealType lrPot = 0.0;
271    int isError = 0;
272
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
264      // new stuff starts here:
265 <
265 >    fDecomp_->zeroWorkArrays();
266      fDecomp_->distributeData();
267  
268      int cg1, cg2, atom1, atom2;
# Line 292 | Line 278 | namespace OpenMD {
278      InteractionData idat;
279      SelfData sdat;
280      RealType mf;
281 +    potVec pot(0.0);
282 +    potVec longRangePotential(0.0);
283 +    RealType lrPot;
284  
285      int loopStart, loopEnd;
286  
# Line 344 | Line 333 | namespace OpenMD {
333                
334                if (!fDecomp_->skipAtomPair(atom1, atom2)) {
335                  
336 +                pot *= 0.0;
337 +
338                  idat = fDecomp_->fillInteractionData(atom1, atom2);
339 +                *(idat.pot) = pot;
340  
341                  if (atomListRow.size() == 1 && atomListColumn.size() == 1) {
342                    *(idat.d) = d_grp;
# Line 361 | Line 353 | namespace OpenMD {
353                    interactionMan_->doPrePair(idat);
354                  } else {
355                    interactionMan_->doPair(idat);
356 +                  fDecomp_->unpackInteractionData(idat, atom1, atom2);
357                    vij += *(idat.vpair);
358                    fij += *(idat.f1);
359                    tau -= outProduct( *(idat.d), *(idat.f1));
# Line 467 | Line 460 | namespace OpenMD {
460  
461      }
462  
463 <    // dangerous to iterate over enums, but we'll live on the edge:
464 <    for (int i = NO_FAMILY; i != N_INTERACTION_FAMILIES; ++i){
465 <      lrPot += longRangePotential[i]; //Quick hack
473 <    }
474 <        
463 >    longRangePotential = fDecomp_->getLongRangePotential();
464 >    lrPot = longRangePotential.sum();
465 >
466      //store the tau and long range potential    
467      curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot;
468      curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VANDERWAALS_FAMILY];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines