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

Comparing:
branches/development/src/applications/staticProps/SpatialStatistics.cpp (file contents), Revision 1876 by gezelter, Fri May 17 17:10:11 2013 UTC vs.
trunk/src/applications/staticProps/SpatialStatistics.cpp (file contents), Revision 1979 by gezelter, Sat Apr 5 20:56:01 2014 UTC

# Line 141 | Line 141 | namespace OpenMD {
141        processStuntDouble( sd, bin );
142  
143        dynamic_cast<Accumulator *>(counts_->accumulator[bin])->add(1);
144 <    }      
144 >    }
145    }
146    
147  
# Line 187 | Line 187 | namespace OpenMD {
187        }
188          
189        outStream << "#######################################################\n";
190 <      outStream << "# Standard Deviations in those quantities follow:\n";
190 >      outStream << "# 95% confidence intervals in those quantities follow:\n";
191        outStream << "#######################################################\n";
192        
193        for (int j = 0; j < nBins_; j++) {
# Line 200 | Line 200 | namespace OpenMD {
200              
201              int n = outputData->accumulator[j]->count();
202              if (n != 0) {
203 <              writeStdDev( outStream, outputData, j );
203 >              writeErrorBars( outStream, outputData, j );
204              }
205            }
206            outStream << std::endl;
# Line 257 | Line 257 | namespace OpenMD {
257      }
258    }
259  
260 <  void SpatialStatistics::writeStdDev(ostream& os, OutputData* dat,
260 >  void SpatialStatistics::writeErrorBars(ostream& os, OutputData* dat,
261                                      unsigned int bin) {
262      assert(int(bin) < nBins_);
263      int n = dat->accumulator[bin]->count();
# Line 265 | Line 265 | namespace OpenMD {
265  
266      if( dat->dataType == odtReal ) {
267        RealType r;
268 <      dynamic_cast<Accumulator*>(dat->accumulator[bin])->getStdDev(r);      
268 >      dynamic_cast<Accumulator*>(dat->accumulator[bin])->get95percentConfidenceInterval(r);      
269        if (isinf(r) || isnan(r) ) {      
270          sprintf( painCave.errMsg,
271                   "SpatialStatistics detected a numerical error writing:\n"
# Line 279 | Line 279 | namespace OpenMD {
279  
280      } else if ( dat->dataType == odtVector3 ) {
281        Vector3d v;
282 <      dynamic_cast<VectorAccumulator*>(dat->accumulator[bin])->getStdDev(v);
282 >      dynamic_cast<VectorAccumulator*>(dat->accumulator[bin])->get95percentConfidenceInterval(v);
283        if (isinf(v[0]) || isnan(v[0]) ||
284            isinf(v[1]) || isnan(v[1]) ||
285            isinf(v[2]) || isnan(v[2]) ) {      
# Line 323 | Line 323 | namespace OpenMD {
323    }
324  
325    SlabStatistics::~SlabStatistics() {
326    delete z_;
326    }
327  
328  
329    void SlabStatistics::processFrame(int istep) {
330      RealType z;
331 +
332      hmat_ = currentSnapshot_->getHmat();
333      for (int i = 0; i < nBins_; i++) {
334        z = (((RealType)i + 0.5) / (RealType)nBins_) * hmat_(2,2);
# Line 354 | Line 354 | namespace OpenMD {
354      SpatialStatistics(info, filename, sele, nbins), coordinateOrigin_(V3Zero) {
355      
356      binWidth_ = 1.0;
357 +
358 +    Globals* simParams = info->getSimParams();
359 +    RNEMDParameters* rnemdParams = simParams->getRNEMDParameters();
360 +    bool hasCoordinateOrigin = rnemdParams->haveCoordinateOrigin();
361      
362 +    if (hasCoordinateOrigin) {
363 +      coordinateOrigin_ = rnemdParams->getCoordinateOrigin();
364 +    } else {
365 +      coordinateOrigin_ = V3Zero;
366 +    }
367 +    
368      r_ = new OutputData;
369      r_->units =  "Angstroms";
370      r_->title =  "R";
# Line 372 | Line 382 | namespace OpenMD {
382    }
383  
384    ShellStatistics::~ShellStatistics() {
375    delete r_;
385    }
386  
387 <  int ShellStatistics::getBin(Vector3d pos) {    
387 >  int ShellStatistics::getBin(Vector3d pos) {
388      Vector3d rPos = pos - coordinateOrigin_;
389      return int(rPos.length() / binWidth_);
390    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines