--- trunk/src/io/StatWriter.cpp 2009/11/25 20:02:06 1390 +++ branches/development/src/io/StatWriter.cpp 2011/11/22 20:38:56 1665 @@ -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 @@ -36,7 +36,8 @@ * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #define _LARGEFILE_SOURCE64 @@ -45,6 +46,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 +142,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 +160,7 @@ namespace OpenMD { #ifdef IS_MPI } + errorCheckPoint(); #endif // is_mpi }