# | Line 1 | Line 1 | |
---|---|---|
1 | < | #include <cstring> |
1 | > | #define _LARGEFILE_SOURCE64 |
2 | > | #define _FILE_OFFSET_BITS 64 |
3 | > | |
4 | > | #include <string.h> |
5 | #include <iostream> | |
6 | #include <fstream> | |
7 | ||
# | Line 15 | Line 18 | StatWriter::StatWriter( SimInfo* the_entry_plug ){ | |
18 | #endif // is_mpi | |
19 | ||
20 | strcpy( outName, entry_plug->statusName ); | |
21 | < | |
19 | < | std::cerr << "Opening " << outName << " for stat\n"; |
21 | > | strcpy( rawName, entry_plug->rawPotName ); |
22 | ||
23 | + | //std::cerr << "Opening " << outName << " for stat\n"; |
24 | + | |
25 | outFile.open(outName, ios::out | ios::trunc ); | |
26 | ||
27 | if( !outFile ){ | |
# | Line 28 | Line 32 | StatWriter::StatWriter( SimInfo* the_entry_plug ){ | |
32 | painCave.isFatal = 1; | |
33 | simError(); | |
34 | } | |
35 | < | |
35 | > | |
36 | //outFile.setf( ios::scientific ); | |
37 | < | outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\tpressure\n"; |
37 | > | outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\tpressure\tvolume\tconserved quantity\n"; |
38 | ||
39 | < | |
39 | > | if (entry_plug->useSolidThermInt && !entry_plug->useLiquidThermInt) { |
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 | + | if (entry_plug->useLiquidThermInt) { |
55 | + | if (entry_plug->useSolidThermInt) { |
56 | + | sprintf( painCave.errMsg, |
57 | + | "It appears that you have both solid and liquid thermodynamic\n" |
58 | + | "integration activated in your .bass file. To avoid confusion,\n" |
59 | + | "specify only one technique in your .bass file. Liquid-state\n" |
60 | + | "thermodynamic integration will be assumed for the current\n" |
61 | + | "simulation. If this is not what you desire, set useSolidThermInt\n" |
62 | + | "to 'true' and useLiquidThermInt to 'false' in your .bass file.", |
63 | + | rawName); |
64 | + | painCave.isFatal = 0; |
65 | + | simError(); |
66 | + | } |
67 | + | |
68 | + | rawFile.open(rawName, ios::out | ios::trunc ); |
69 | + | |
70 | + | if( !rawFile ){ |
71 | + | |
72 | + | sprintf( painCave.errMsg, |
73 | + | "Could not open \"%s\" for stat output.\n", |
74 | + | rawName); |
75 | + | painCave.isFatal = 1; |
76 | + | simError(); |
77 | + | } |
78 | + | |
79 | + | rawFile << "#time(fs)\tRaw Pot\n"; |
80 | + | } |
81 | + | |
82 | #ifdef IS_MPI | |
83 | } | |
84 | ||
# | Line 52 | Line 97 | StatWriter::~StatWriter( ){ | |
97 | #endif // is_mpi | |
98 | ||
99 | outFile.close(); | |
100 | + | rawFile.close(); |
101 | delete tStats; | |
102 | ||
103 | #ifdef IS_MPI | |
# | Line 61 | Line 107 | void StatWriter::writeStat( double currentTime ){ | |
107 | ||
108 | void StatWriter::writeStat( double currentTime ){ | |
109 | ||
110 | < | double totE, potE, kinE, temp, press; |
110 | > | double totE, potE, kinE, temp, press, vol; |
111 | > | double conservedQuantity; |
112 | ||
113 | totE = tStats->getTotalE(); | |
114 | potE = tStats->getPotential(); | |
115 | kinE = tStats->getKinetic(); | |
116 | temp = tStats->getTemperature(); | |
117 | press = tStats->getPressure(); | |
118 | < | |
118 | > | vol = tStats->getVolume(); |
119 | > | conservedQuantity = entry_plug->the_integrator->getConservedQuantity(); |
120 | #ifdef IS_MPI | |
121 | if(worldRank == 0 ){ | |
122 | #endif // is_mpi | |
# | Line 80 | Line 128 | void StatWriter::writeStat( double currentTime ){ | |
128 | << potE << "\t" | |
129 | << kinE << "\t" | |
130 | << temp << "\t" | |
131 | < | << press << "\n"; |
131 | > | << press << "\t" |
132 | > | << vol << "\t" |
133 | > | << conservedQuantity << "\n"; |
134 | > | |
135 | outFile.flush(); | |
136 | ||
137 | #ifdef IS_MPI | |
138 | } | |
139 | #endif // is_mpi | |
140 | } | |
141 | + | |
142 | + | void StatWriter::writeRaw( double currentTime ){ |
143 | + | |
144 | + | double rawPot, rawHarm; |
145 | + | |
146 | + | rawPot = entry_plug->vRaw; |
147 | + | rawHarm = entry_plug->vHarm; |
148 | + | |
149 | + | #ifdef IS_MPI |
150 | + | if(worldRank == 0 ){ |
151 | + | #endif // is_mpi |
152 | + | |
153 | + | rawFile.precision(8); |
154 | + | rawFile |
155 | + | << currentTime << "\t" |
156 | + | << rawPot << "\t" |
157 | + | << rawHarm << "\n"; |
158 | + | |
159 | + | rawFile.flush(); |
160 | + | |
161 | + | #ifdef IS_MPI |
162 | + | } |
163 | + | #endif // is_mpi |
164 | + | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |