--- trunk/OOPSE/libmdtools/StatWriter.cpp 2003/08/26 20:12:51 723 +++ trunk/OOPSE/libmdtools/StatWriter.cpp 2004/05/27 20:06:38 1207 @@ -1,6 +1,7 @@ +#define _LARGEFILE_SOURCE64 #define _FILE_OFFSET_BITS 64 -#include +#include #include #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\tenthalpy\n"; + 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 @@ -63,7 +79,8 @@ void StatWriter::writeStat( double currentTime ){ void StatWriter::writeStat( double currentTime ){ - double totE, potE, kinE, temp, press, vol, enthalpy; + double totE, potE, kinE, temp, press, vol; + double conservedQuantity; totE = tStats->getTotalE(); potE = tStats->getPotential(); @@ -71,8 +88,7 @@ void StatWriter::writeStat( double currentTime ){ temp = tStats->getTemperature(); press = tStats->getPressure(); vol = tStats->getVolume(); - enthalpy = tStats->getEnthalpy(); - + conservedQuantity = entry_plug->the_integrator->getConservedQuantity(); #ifdef IS_MPI if(worldRank == 0 ){ #endif // is_mpi @@ -86,7 +102,7 @@ void StatWriter::writeStat( double currentTime ){ << temp << "\t" << press << "\t" << vol << "\t" - << enthalpy << "\n"; + << conservedQuantity << "\n"; outFile.flush(); @@ -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 +}