ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/md_code/StatWriter.cpp
Revision: 162
Committed: Thu Oct 31 21:20:49 2002 UTC (21 years, 8 months ago) by mmeineke
File size: 958 byte(s)
Log Message:
*** empty log message ***

File Contents

# Content
1 #include <cstring>
2 #include <iostream>
3 #include <fstream>
4
5 #include "ReadWrite.hpp"
6 #include "simError.h"
7
8
9 StatWriter::StatWriter( SimInfo* the_entry_plug ){
10
11 entry_plug = the_entry_plug;
12
13 strcpy( outName, entry_plug->statusName );
14 outFile.open(outName, ios::out | ios::trunc );
15
16 if( !outFile ){
17
18 sprintf( painCave.errMsg,
19 "Could not open \"%s\" for stat output.\n",
20 outName);
21 painCave.isFatal = 1;
22 simError();
23 }
24
25 //outFile.setf( ios::scientific );
26 outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\n";
27
28 tStats = new Thermo( entry_plug );
29 }
30
31 StatWriter::~StatWriter( ){
32
33 outFile.close();
34 delete tStats;
35 }
36
37 void StatWriter::writeStat( double currentTime ){
38
39 outFile.precision(8);
40 outFile
41 << currentTime << "\t"
42 << tStats->getTotalE() << "\t"
43 << tStats->getPotential() << "\t"
44 << tStats->getKinetic() << "\t"
45 << tStats->getTemperature() << "\n";
46 outFile.flush();
47 }