--- trunk/src/io/StatWriter.cpp 2009/11/25 20:02:06 1390 +++ branches/development/src/io/StatWriter.cpp 2010/07/09 23:08:25 1465 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. + * Copyright (c) 2005, 2010 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a * non-exclusive, royalty free, license to use, modify and @@ -45,6 +45,8 @@ #include "io/StatWriter.hpp" #include "utils/simError.h" +using namespace std; + namespace OpenMD { StatsBitSet parseStatFileFormat(const std::string& format) { StringTokenizer tokenizer(format, " ,;|\t\n\r"); @@ -139,7 +141,16 @@ namespace OpenMD { statfile_.precision(8); for (int i =0; i < mask_.size(); ++i) { if (mask_[i]) { - statfile_ << "\t" << s[i]; + if (! isinf(s[i]) && ! isnan(s[i])){ + statfile_ << "\t" << s[i]; + } + else{ + sprintf( painCave.errMsg, + "StatWriter detected a numerical error writing: %s ", + Stats::getTitle(i).c_str()); + painCave.isFatal = 1; + simError(); + } } } statfile_ << std::endl; @@ -148,6 +159,7 @@ namespace OpenMD { #ifdef IS_MPI } + errorCheckPoint(); #endif // is_mpi }