8 |
|
|
9 |
|
StatWriter::StatWriter( SimInfo* the_entry_plug ){ |
10 |
|
|
11 |
+ |
entry_plug = the_entry_plug; |
12 |
+ |
|
13 |
|
#ifdef IS_MPI |
14 |
|
if(worldRank == 0 ){ |
15 |
|
#endif // is_mpi |
16 |
|
|
15 |
– |
entry_plug = the_entry_plug; |
16 |
– |
|
17 |
|
strcpy( outName, entry_plug->statusName ); |
18 |
|
|
19 |
|
std::cerr << "Opening " << outName << " for stat\n"; |
32 |
|
//outFile.setf( ios::scientific ); |
33 |
|
outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\n"; |
34 |
|
|
35 |
< |
tStats = new Thermo( entry_plug ); |
35 |
> |
|
36 |
|
|
37 |
|
#ifdef IS_MPI |
38 |
|
} |
41 |
|
"Sucessfully opened output file for stating.\n"); |
42 |
|
MPIcheckPoint(); |
43 |
|
#endif // is_mpi |
44 |
+ |
|
45 |
+ |
tStats = new Thermo( entry_plug ); |
46 |
|
} |
47 |
|
|
48 |
|
StatWriter::~StatWriter( ){ |
61 |
|
|
62 |
|
void StatWriter::writeStat( double currentTime ){ |
63 |
|
|
64 |
+ |
double totE, potE, kinE, temp; |
65 |
+ |
|
66 |
+ |
totE = tStats->getTotalE(); |
67 |
+ |
potE = tStats->getPotential(); |
68 |
+ |
kinE = tStats->getKinetic(); |
69 |
+ |
temp = tStats->getTemperature(); |
70 |
+ |
|
71 |
|
#ifdef IS_MPI |
72 |
|
if(worldRank == 0 ){ |
73 |
|
#endif // is_mpi |
75 |
|
outFile.precision(8); |
76 |
|
outFile |
77 |
|
<< currentTime << "\t" |
78 |
< |
<< tStats->getTotalE() << "\t" |
79 |
< |
<< tStats->getPotential() << "\t" |
80 |
< |
<< tStats->getKinetic() << "\t" |
81 |
< |
<< tStats->getTemperature() << "\n"; |
78 |
> |
<< totE << "\t" |
79 |
> |
<< potE << "\t" |
80 |
> |
<< kinE << "\t" |
81 |
> |
<< temp << "\n"; |
82 |
|
outFile.flush(); |
83 |
|
|
84 |
|
#ifdef IS_MPI |