1 |
+ |
#define _LARGEFILE_SOURCE64 |
2 |
|
#define _FILE_OFFSET_BITS 64 |
3 |
|
|
4 |
|
#include <string.h> |
18 |
|
#endif // is_mpi |
19 |
|
|
20 |
|
strcpy( outName, entry_plug->statusName ); |
21 |
< |
|
21 |
> |
strcpy( rawName, entry_plug->rawPotName ); |
22 |
> |
|
23 |
|
//std::cerr << "Opening " << outName << " for stat\n"; |
24 |
|
|
25 |
|
outFile.open(outName, ios::out | ios::trunc ); |
32 |
|
painCave.isFatal = 1; |
33 |
|
simError(); |
34 |
|
} |
35 |
< |
|
35 |
> |
|
36 |
|
//outFile.setf( ios::scientific ); |
37 |
|
outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\tpressure\tvolume\tconserved quantity\n"; |
38 |
|
|
39 |
< |
|
39 |
> |
if (entry_plug->useThermInt) { |
40 |
> |
rawFile.open(rawName, ios::out | ios::trunc ); |
41 |
> |
|
42 |
> |
if( !rawFile ){ |
43 |
> |
|
44 |
> |
sprintf( painCave.errMsg, |
45 |
> |
"Could not open \"%s\" for stat output.\n", |
46 |
> |
rawName); |
47 |
> |
painCave.isFatal = 1; |
48 |
> |
simError(); |
49 |
> |
} |
50 |
> |
|
51 |
> |
rawFile << "#time(fs)\tRaw Pot\t Raw Harm\n"; |
52 |
> |
} |
53 |
|
|
54 |
|
#ifdef IS_MPI |
55 |
|
} |
69 |
|
#endif // is_mpi |
70 |
|
|
71 |
|
outFile.close(); |
72 |
+ |
rawFile.close(); |
73 |
|
delete tStats; |
74 |
|
|
75 |
|
#ifdef IS_MPI |
110 |
|
} |
111 |
|
#endif // is_mpi |
112 |
|
} |
113 |
+ |
|
114 |
+ |
void StatWriter::writeRaw( double currentTime ){ |
115 |
+ |
|
116 |
+ |
double rawPot, rawHarm; |
117 |
+ |
|
118 |
+ |
rawPot = entry_plug->vRaw; |
119 |
+ |
rawHarm = entry_plug->vHarm; |
120 |
+ |
|
121 |
+ |
#ifdef IS_MPI |
122 |
+ |
if(worldRank == 0 ){ |
123 |
+ |
#endif // is_mpi |
124 |
+ |
|
125 |
+ |
rawFile.precision(8); |
126 |
+ |
rawFile |
127 |
+ |
<< currentTime << "\t" |
128 |
+ |
<< rawPot << "\t" |
129 |
+ |
<< rawHarm << "\n"; |
130 |
+ |
|
131 |
+ |
rawFile.flush(); |
132 |
+ |
|
133 |
+ |
#ifdef IS_MPI |
134 |
+ |
} |
135 |
+ |
#endif // is_mpi |
136 |
+ |
} |