--- trunk/OOPSE/libmdtools/StatWriter.cpp 2003/03/21 17:42:12 378 +++ trunk/OOPSE/libmdtools/StatWriter.cpp 2004/05/27 20:06:38 1207 @@ -1,4 +1,7 @@ -#include +#define _LARGEFILE_SOURCE64 +#define _FILE_OFFSET_BITS 64 + +#include #include #include @@ -15,9 +18,10 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ #endif // is_mpi strcpy( outName, entry_plug->statusName ); - - std::cerr << "Opening " << outName << " for stat\n"; + strcpy( rawName, entry_plug->rawPotName ); + //std::cerr << "Opening " << outName << " for stat\n"; + outFile.open(outName, ios::out | ios::trunc ); if( !outFile ){ @@ -28,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\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 } @@ -52,6 +69,7 @@ StatWriter::~StatWriter( ){ #endif // is_mpi outFile.close(); + rawFile.close(); delete tStats; #ifdef IS_MPI @@ -61,13 +79,16 @@ void StatWriter::writeStat( double currentTime ){ void StatWriter::writeStat( double currentTime ){ - double totE, potE, kinE, temp; + double totE, potE, kinE, temp, press, vol; + double conservedQuantity; totE = tStats->getTotalE(); potE = tStats->getPotential(); kinE = tStats->getKinetic(); temp = tStats->getTemperature(); - + press = tStats->getPressure(); + vol = tStats->getVolume(); + conservedQuantity = entry_plug->the_integrator->getConservedQuantity(); #ifdef IS_MPI if(worldRank == 0 ){ #endif // is_mpi @@ -78,10 +99,38 @@ void StatWriter::writeStat( double currentTime ){ << totE << "\t" << potE << "\t" << kinE << "\t" - << temp << "\n"; + << temp << "\t" + << press << "\t" + << vol << "\t" + << conservedQuantity << "\n"; + outFile.flush(); #ifdef IS_MPI } #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 +}