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

Comparing branches/development/src/rnemd/RNEMD.cpp (file contents):
Revision 1803 by gezelter, Wed Oct 3 14:20:07 2012 UTC vs.
Revision 1812 by gezelter, Fri Nov 16 21:18:42 2012 UTC

# Line 1521 | Line 1521 | namespace OpenMD {
1521        den = binMass[i] * nBins_ * PhysicalConstants::densityConvert
1522          / currentSnap_->getVolume() ;
1523  
1524 <      temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb *
1525 <                               PhysicalConstants::energyConvert);
1526 <  
1527 <      for (unsigned int j = 0; j < outputMask_.size(); ++j) {
1528 <        if(outputMask_[j]) {
1529 <          switch(j) {
1530 <          case Z:
1531 <            (data_[j].accumulator[i])->add(z);
1532 <            break;
1533 <          case TEMPERATURE:
1534 <            data_[j].accumulator[i]->add(temp);
1535 <            break;
1536 <          case VELOCITY:
1537 <            dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel);
1538 <            break;
1539 <          case DENSITY:
1540 <            data_[j].accumulator[i]->add(den);
1541 <            break;
1524 >      if (binCount[i] > 0) {
1525 >        // only add values if there are things to add
1526 >        temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb *
1527 >                                 PhysicalConstants::energyConvert);
1528 >        
1529 >        for (unsigned int j = 0; j < outputMask_.size(); ++j) {
1530 >          if(outputMask_[j]) {
1531 >            switch(j) {
1532 >            case Z:
1533 >              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(z);
1534 >              break;
1535 >            case TEMPERATURE:
1536 >              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(temp);
1537 >              break;
1538 >            case VELOCITY:
1539 >              dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel);
1540 >              break;
1541 >            case DENSITY:
1542 >              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(den);
1543 >              break;
1544 >            }
1545            }
1546          }
1547        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines