--- trunk/OOPSE/libmdtools/StatWriter.cpp 2003/10/28 16:03:37 829 +++ trunk/OOPSE/libmdtools/StatWriter.cpp 2004/05/27 20:06:38 1207 @@ -1,3 +1,4 @@ +#define _LARGEFILE_SOURCE64 #define _FILE_OFFSET_BITS 64 #include @@ -17,7 +18,8 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ #endif // is_mpi strcpy( outName, entry_plug->statusName ); - + strcpy( rawName, entry_plug->rawPotName ); + //std::cerr << "Opening " << outName << " for stat\n"; outFile.open(outName, ios::out | ios::trunc ); @@ -30,11 +32,24 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ painCave.isFatal = 1; simError(); } - + //outFile.setf( ios::scientific ); outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\tpressure\tvolume\tconserved quantity\n"; - + if (entry_plug->useThermInt) { + rawFile.open(rawName, ios::out | ios::trunc ); + + if( !rawFile ){ + + sprintf( painCave.errMsg, + "Could not open \"%s\" for stat output.\n", + rawName); + painCave.isFatal = 1; + simError(); + } + + rawFile << "#time(fs)\tRaw Pot\t Raw Harm\n"; + } #ifdef IS_MPI } @@ -54,6 +69,7 @@ StatWriter::~StatWriter( ){ #endif // is_mpi outFile.close(); + rawFile.close(); delete tStats; #ifdef IS_MPI @@ -94,3 +110,27 @@ void StatWriter::writeStat( double currentTime ){ } #endif // is_mpi } + +void StatWriter::writeRaw( double currentTime ){ + + double rawPot, rawHarm; + + rawPot = entry_plug->vRaw; + rawHarm = entry_plug->vHarm; + +#ifdef IS_MPI + if(worldRank == 0 ){ +#endif // is_mpi + + rawFile.precision(8); + rawFile + << currentTime << "\t" + << rawPot << "\t" + << rawHarm << "\n"; + + rawFile.flush(); + +#ifdef IS_MPI + } +#endif // is_mpi +}