--- trunk/mdtools/md_code/StatWriter.cpp 2002/11/21 20:33:06 184 +++ trunk/mdtools/md_code/StatWriter.cpp 2003/02/03 21:15:59 261 @@ -8,12 +8,12 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ StatWriter::StatWriter( SimInfo* the_entry_plug ){ + entry_plug = the_entry_plug; + #ifdef IS_MPI - if(worldRank == TESTWRITE ){ + if(worldRank == 0 ){ #endif // is_mpi - entry_plug = the_entry_plug; - strcpy( outName, entry_plug->statusName ); std::cerr << "Opening " << outName << " for stat\n"; @@ -32,17 +32,23 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ //outFile.setf( ios::scientific ); outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\n"; - tStats = new Thermo( entry_plug ); + #ifdef IS_MPI } + + sprintf( checkPointMsg, + "Sucessfully opened output file for stating.\n"); + MPIcheckPoint(); #endif // is_mpi + + tStats = new Thermo( entry_plug ); } StatWriter::~StatWriter( ){ #ifdef IS_MPI - if(worldRank == TESTWRITE ){ + if(worldRank == 0 ){ #endif // is_mpi outFile.close(); @@ -55,17 +61,24 @@ void StatWriter::writeStat( double currentTime ){ void StatWriter::writeStat( double currentTime ){ + double totE, potE, kinE, temp; + + totE = tStats->getTotalE(); + potE = tStats->getPotential(); + kinE = tStats->getKinetic(); + temp = tStats->getTemperature(); + #ifdef IS_MPI - if(worldRank == TESTWRITE ){ + if(worldRank == 0 ){ #endif // is_mpi outFile.precision(8); outFile << currentTime << "\t" - << tStats->getTotalE() << "\t" - << tStats->getPotential() << "\t" - << tStats->getKinetic() << "\t" - << tStats->getTemperature() << "\n"; + << totE << "\t" + << potE << "\t" + << kinE << "\t" + << temp << "\n"; outFile.flush(); #ifdef IS_MPI