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

Comparing trunk/src/rnemd/RNEMD.cpp (file contents):
Revision 1803 by gezelter, Mon Oct 1 18:21:15 2012 UTC vs.
Revision 1804 by gezelter, Wed Oct 17 19:04:44 2012 UTC

# Line 1510 | Line 1510 | namespace OpenMD {
1510        den = binMass[i] * nBins_ * PhysicalConstants::densityConvert
1511          / currentSnap_->getVolume() ;
1512  
1513 <      temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb *
1514 <                               PhysicalConstants::energyConvert);
1515 <  
1516 <      for (unsigned int j = 0; j < outputMask_.size(); ++j) {
1517 <        if(outputMask_[j]) {
1518 <          switch(j) {
1519 <          case Z:
1520 <            dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(z);
1521 <            break;
1522 <          case TEMPERATURE:
1523 <            dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(temp);
1524 <            break;
1525 <          case VELOCITY:
1526 <            dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel);
1527 <            break;
1528 <          case DENSITY:
1529 <            dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(den);
1530 <            break;
1513 >      if (binCount[i] > 0) {
1514 >        // only add values if there are things to add
1515 >        temp = 2.0 * binKE[i] / (binDOF[i] * PhysicalConstants::kb *
1516 >                                 PhysicalConstants::energyConvert);
1517 >        
1518 >        for (unsigned int j = 0; j < outputMask_.size(); ++j) {
1519 >          if(outputMask_[j]) {
1520 >            switch(j) {
1521 >            case Z:
1522 >              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(z);
1523 >              break;
1524 >            case TEMPERATURE:
1525 >              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(temp);
1526 >              break;
1527 >            case VELOCITY:
1528 >              dynamic_cast<VectorAccumulator *>(data_[j].accumulator[i])->add(vel);
1529 >              break;
1530 >            case DENSITY:
1531 >              dynamic_cast<Accumulator *>(data_[j].accumulator[i])->add(den);
1532 >              break;
1533 >            }
1534            }
1535          }
1536        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines