--- trunk/mdtools/md_code/StatWriter.cpp 2003/01/31 21:04:27 260 +++ 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 == 0 ){ #endif // is_mpi - entry_plug = the_entry_plug; - strcpy( outName, entry_plug->statusName ); std::cerr << "Opening " << outName << " for stat\n"; @@ -32,7 +32,7 @@ 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 } @@ -41,6 +41,8 @@ StatWriter::StatWriter( SimInfo* the_entry_plug ){ "Sucessfully opened output file for stating.\n"); MPIcheckPoint(); #endif // is_mpi + + tStats = new Thermo( entry_plug ); } StatWriter::~StatWriter( ){ @@ -59,6 +61,13 @@ 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 == 0 ){ #endif // is_mpi @@ -66,10 +75,10 @@ void StatWriter::writeStat( double currentTime ){ 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