| 221 | 
  | 
    int n = dat->accumulator[bin]->count(); | 
| 222 | 
  | 
    if (n == 0) return; | 
| 223 | 
  | 
 | 
| 224 | 
– | 
    RealType r; | 
| 225 | 
– | 
    Vector3d v; | 
| 226 | 
– | 
 | 
| 224 | 
  | 
    if( dat->dataType == odtReal ) { | 
| 225 | 
+ | 
      RealType r; | 
| 226 | 
  | 
      dynamic_cast<Accumulator*>(dat->accumulator[bin])->getAverage(r);       | 
| 227 | 
  | 
      if (isinf(r) || isnan(r) ) {       | 
| 228 | 
  | 
        sprintf( painCave.errMsg, | 
| 229 | 
  | 
                 "SpatialStatistics detected a numerical error writing:\n" | 
| 230 | 
< | 
                 "\t%s for bin %d", | 
| 230 | 
> | 
                 "\t%s for bin %u", | 
| 231 | 
  | 
                 dat->title.c_str(), bin); | 
| 232 | 
  | 
        painCave.isFatal = 1; | 
| 233 | 
  | 
        simError(); | 
| 236 | 
  | 
      os << "\t" << r;       | 
| 237 | 
  | 
 | 
| 238 | 
  | 
    } else if ( dat->dataType == odtVector3 ) { | 
| 239 | 
+ | 
      Vector3d v; | 
| 240 | 
  | 
      dynamic_cast<VectorAccumulator*>(dat->accumulator[bin])->getAverage(v); | 
| 241 | 
  | 
      if (isinf(v[0]) || isnan(v[0]) ||  | 
| 242 | 
  | 
          isinf(v[1]) || isnan(v[1]) ||  | 
| 243 | 
  | 
          isinf(v[2]) || isnan(v[2]) ) {       | 
| 244 | 
  | 
        sprintf( painCave.errMsg, | 
| 245 | 
  | 
                 "SpatialStatistics detected a numerical error writing:\n" | 
| 246 | 
< | 
                 "\t%s for bin %d", | 
| 246 | 
> | 
                 "\t%s for bin %u", | 
| 247 | 
  | 
                 dat->title.c_str(), bin); | 
| 248 | 
  | 
        painCave.isFatal = 1; | 
| 249 | 
  | 
        simError(); | 
| 259 | 
  | 
    int n = dat->accumulator[bin]->count(); | 
| 260 | 
  | 
    if (n == 0) return; | 
| 261 | 
  | 
 | 
| 263 | 
– | 
    RealType r; | 
| 264 | 
– | 
    Vector3d v; | 
| 265 | 
– | 
 | 
| 262 | 
  | 
    if( dat->dataType == odtReal ) { | 
| 263 | 
+ | 
      RealType r; | 
| 264 | 
  | 
      dynamic_cast<Accumulator*>(dat->accumulator[bin])->getStdDev(r);       | 
| 265 | 
  | 
      if (isinf(r) || isnan(r) ) {       | 
| 266 | 
  | 
        sprintf( painCave.errMsg, | 
| 267 | 
  | 
                 "SpatialStatistics detected a numerical error writing:\n" | 
| 268 | 
< | 
                 "\tstandard deviation of %s for bin %d", | 
| 268 | 
> | 
                 "\tstandard deviation of %s for bin %u", | 
| 269 | 
  | 
                 dat->title.c_str(), bin); | 
| 270 | 
  | 
        painCave.isFatal = 1; | 
| 271 | 
  | 
        simError(); | 
| 274 | 
  | 
      os << "\t" << r;       | 
| 275 | 
  | 
 | 
| 276 | 
  | 
    } else if ( dat->dataType == odtVector3 ) { | 
| 277 | 
+ | 
      Vector3d v; | 
| 278 | 
  | 
      dynamic_cast<VectorAccumulator*>(dat->accumulator[bin])->getStdDev(v); | 
| 279 | 
  | 
      if (isinf(v[0]) || isnan(v[0]) ||  | 
| 280 | 
  | 
          isinf(v[1]) || isnan(v[1]) ||  | 
| 281 | 
  | 
          isinf(v[2]) || isnan(v[2]) ) {       | 
| 282 | 
  | 
        sprintf( painCave.errMsg, | 
| 283 | 
  | 
                 "SpatialStatistics detected a numerical error writing:\n" | 
| 284 | 
< | 
                 "\tstandard deviation of %s for bin %d", | 
| 284 | 
> | 
                 "\tstandard deviation of %s for bin %u", | 
| 285 | 
  | 
                 dat->title.c_str(), bin); | 
| 286 | 
  | 
        painCave.isFatal = 1; | 
| 287 | 
  | 
        simError(); | 
| 318 | 
  | 
    data_.push_back(z_); | 
| 319 | 
  | 
  } | 
| 320 | 
  | 
 | 
| 321 | 
+ | 
  SlabStatistics::~SlabStatistics() { | 
| 322 | 
+ | 
    delete z_; | 
| 323 | 
+ | 
  } | 
| 324 | 
+ | 
 | 
| 325 | 
+ | 
 | 
| 326 | 
  | 
  void SlabStatistics::processFrame(int istep) { | 
| 327 | 
  | 
    RealType z; | 
| 328 | 
  | 
    hmat_ = currentSnapshot_->getHmat(); | 
| 345 | 
  | 
    return int(nBins_ * (pos.z() / hmat_(2,2) + 0.5)) % nBins_;   | 
| 346 | 
  | 
  } | 
| 347 | 
  | 
 | 
| 345 | 
– | 
 | 
| 348 | 
  | 
  ShellStatistics::ShellStatistics(SimInfo* info, const string& filename,  | 
| 349 | 
  | 
                                   const string& sele, int nbins) :  | 
| 350 | 
< | 
    SpatialStatistics(info, filename, sele, nbins){ | 
| 350 | 
> | 
    SpatialStatistics(info, filename, sele, nbins), coordinateOrigin_(V3Zero) { | 
| 351 | 
  | 
     | 
| 350 | 
– | 
    coordinateOrigin_ = V3Zero; | 
| 352 | 
  | 
    binWidth_ = 1.0; | 
| 353 | 
< | 
 | 
| 353 | 
> | 
     | 
| 354 | 
  | 
    r_ = new OutputData; | 
| 355 | 
  | 
    r_->units =  "Angstroms"; | 
| 356 | 
  | 
    r_->title =  "R"; | 
| 367 | 
  | 
    } | 
| 368 | 
  | 
  } | 
| 369 | 
  | 
 | 
| 370 | 
+ | 
  ShellStatistics::~ShellStatistics() { | 
| 371 | 
+ | 
    delete r_; | 
| 372 | 
+ | 
  } | 
| 373 | 
+ | 
 | 
| 374 | 
  | 
  int ShellStatistics::getBin(Vector3d pos) {     | 
| 375 | 
  | 
    Vector3d rPos = pos - coordinateOrigin_; | 
| 376 | 
  | 
    return int(rPos.length() / binWidth_); |