--- trunk/OOPSE/libmdtools/StatWriter.cpp 2003/04/09 13:59:35 484 +++ trunk/OOPSE/libmdtools/StatWriter.cpp 2004/05/20 20:24:07 1180 @@ -1,4 +1,7 @@ -#include +#define _LARGEFILE_SOURCE64 +#define _FILE_OFFSET_BITS 64 + +#include #include #include @@ -15,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 ); @@ -29,10 +33,21 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ simError(); } + 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(); + } + //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"; - + rawFile << "#time(fs)\tRaw Pot\t Raw Harm\n"; #ifdef IS_MPI } @@ -52,6 +67,7 @@ StatWriter::~StatWriter( ){ #endif // is_mpi outFile.close(); + rawFile.close(); delete tStats; #ifdef IS_MPI @@ -61,7 +77,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(); @@ -69,8 +86,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 @@ -84,7 +100,7 @@ void StatWriter::writeStat( double currentTime ){ << temp << "\t" << press << "\t" << vol << "\t" - << enthalpy << "\n"; + << conservedQuantity << "\n"; outFile.flush(); @@ -92,3 +108,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 +}