| 1 |
+ |
#define _LARGEFILE_SOURCE64 |
| 2 |
|
#define _FILE_OFFSET_BITS 64 |
| 3 |
|
|
| 4 |
< |
#include <cstring> |
| 4 |
> |
#include <string.h> |
| 5 |
|
#include <iostream> |
| 6 |
|
#include <fstream> |
| 7 |
|
|
| 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 ); |
| 33 |
|
simError(); |
| 34 |
|
} |
| 35 |
|
|
| 36 |
+ |
rawFile.open(rawName, ios::out | ios::trunc ); |
| 37 |
+ |
|
| 38 |
+ |
if( !rawFile ){ |
| 39 |
+ |
|
| 40 |
+ |
sprintf( painCave.errMsg, |
| 41 |
+ |
"Could not open \"%s\" for stat output.\n", |
| 42 |
+ |
rawName); |
| 43 |
+ |
painCave.isFatal = 1; |
| 44 |
+ |
simError(); |
| 45 |
+ |
} |
| 46 |
+ |
|
| 47 |
|
//outFile.setf( ios::scientific ); |
| 48 |
< |
outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\tpressure\tvolume\tenthalpy\n"; |
| 48 |
> |
outFile << "#time(fs)\ttot_E\tpotential\tkinetic\ttemperature\tpressure\tvolume\tconserved quantity\n"; |
| 49 |
|
|
| 50 |
< |
|
| 50 |
> |
rawFile << "#time(fs)\tRaw Pot\t Raw Harm\n"; |
| 51 |
|
|
| 52 |
|
#ifdef IS_MPI |
| 53 |
|
} |
| 67 |
|
#endif // is_mpi |
| 68 |
|
|
| 69 |
|
outFile.close(); |
| 70 |
+ |
rawFile.close(); |
| 71 |
|
delete tStats; |
| 72 |
|
|
| 73 |
|
#ifdef IS_MPI |
| 77 |
|
|
| 78 |
|
void StatWriter::writeStat( double currentTime ){ |
| 79 |
|
|
| 80 |
< |
double totE, potE, kinE, temp, press, vol, enthalpy; |
| 80 |
> |
double totE, potE, kinE, temp, press, vol; |
| 81 |
> |
double conservedQuantity; |
| 82 |
|
|
| 83 |
|
totE = tStats->getTotalE(); |
| 84 |
|
potE = tStats->getPotential(); |
| 86 |
|
temp = tStats->getTemperature(); |
| 87 |
|
press = tStats->getPressure(); |
| 88 |
|
vol = tStats->getVolume(); |
| 89 |
< |
enthalpy = tStats->getEnthalpy(); |
| 75 |
< |
|
| 89 |
> |
conservedQuantity = entry_plug->the_integrator->getConservedQuantity(); |
| 90 |
|
#ifdef IS_MPI |
| 91 |
|
if(worldRank == 0 ){ |
| 92 |
|
#endif // is_mpi |
| 100 |
|
<< temp << "\t" |
| 101 |
|
<< press << "\t" |
| 102 |
|
<< vol << "\t" |
| 103 |
< |
<< enthalpy << "\n"; |
| 103 |
> |
<< conservedQuantity << "\n"; |
| 104 |
|
|
| 105 |
|
outFile.flush(); |
| 106 |
|
|
| 108 |
|
} |
| 109 |
|
#endif // is_mpi |
| 110 |
|
} |
| 111 |
+ |
|
| 112 |
+ |
void StatWriter::writeRaw( double currentTime ){ |
| 113 |
+ |
|
| 114 |
+ |
double rawPot, rawHarm; |
| 115 |
+ |
|
| 116 |
+ |
rawPot = entry_plug->vRaw; |
| 117 |
+ |
rawHarm = entry_plug->vHarm; |
| 118 |
+ |
|
| 119 |
+ |
#ifdef IS_MPI |
| 120 |
+ |
if(worldRank == 0 ){ |
| 121 |
+ |
#endif // is_mpi |
| 122 |
+ |
|
| 123 |
+ |
rawFile.precision(8); |
| 124 |
+ |
rawFile |
| 125 |
+ |
<< currentTime << "\t" |
| 126 |
+ |
<< rawPot << "\t" |
| 127 |
+ |
<< rawHarm << "\n"; |
| 128 |
+ |
|
| 129 |
+ |
rawFile.flush(); |
| 130 |
+ |
|
| 131 |
+ |
#ifdef IS_MPI |
| 132 |
+ |
} |
| 133 |
+ |
#endif // is_mpi |
| 134 |
+ |
} |