ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/StatWriter.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/StatWriter.cpp (file contents):
Revision 723 by mmeineke, Tue Aug 26 20:12:51 2003 UTC vs.
Revision 1213 by chrisfen, Tue Jun 1 18:07:34 2004 UTC

# Line 1 | Line 1
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  
# Line 17 | Line 18 | StatWriter::StatWriter( SimInfo* the_entry_plug ){
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 );
# Line 30 | 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\tvolume\tenthalpy\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 +      rawFile.open(rawName, ios::out | ios::trunc );
56 +      
57 +      if( !rawFile ){
58 +        
59 +        sprintf( painCave.errMsg,
60 +                 "Could not open \"%s\" for stat output.\n",
61 +                 rawName);
62 +        painCave.isFatal = 1;
63 +        simError();
64 +      }
65 +      
66 +      rawFile << "#time(fs)\tRaw Pot\n";
67 +    }
68 +
69   #ifdef IS_MPI
70    }
71  
# Line 54 | Line 84 | StatWriter::~StatWriter( ){
84   #endif // is_mpi
85  
86      outFile.close();
87 +    rawFile.close();
88      delete tStats;
89  
90   #ifdef IS_MPI
# Line 63 | Line 94 | void StatWriter::writeStat( double currentTime ){
94  
95   void StatWriter::writeStat( double currentTime ){
96  
97 <  double totE, potE, kinE, temp, press, vol, enthalpy;
97 >  double totE, potE, kinE, temp, press, vol;
98 >  double conservedQuantity;
99  
100    totE = tStats->getTotalE();
101    potE = tStats->getPotential();
# Line 71 | Line 103 | void StatWriter::writeStat( double currentTime ){
103    temp = tStats->getTemperature();
104    press = tStats->getPressure();
105    vol = tStats->getVolume();
106 <  enthalpy = tStats->getEnthalpy();
75 <
106 >  conservedQuantity = entry_plug->the_integrator->getConservedQuantity();
107   #ifdef IS_MPI
108    if(worldRank == 0 ){
109   #endif // is_mpi
# Line 86 | Line 117 | void StatWriter::writeStat( double currentTime ){
117        << temp << "\t"
118        << press << "\t"
119        << vol << "\t"
120 <      << enthalpy << "\n";
120 >      << conservedQuantity << "\n";
121  
122      outFile.flush();
123  
# Line 94 | Line 125 | void StatWriter::writeStat( double currentTime ){
125    }
126   #endif // is_mpi
127   }
128 +
129 + void StatWriter::writeRaw( double currentTime ){
130 +
131 +  double rawPot, rawHarm;
132 +
133 +  rawPot = entry_plug->vRaw;
134 +  rawHarm = entry_plug->vHarm;
135 +
136 + #ifdef IS_MPI
137 +  if(worldRank == 0 ){
138 + #endif // is_mpi
139 +
140 +    rawFile.precision(8);
141 +    rawFile
142 +      << currentTime << "\t"
143 +      << rawPot << "\t"
144 +      << rawHarm << "\n";
145 +
146 +    rawFile.flush();
147 +
148 + #ifdef IS_MPI
149 +  }
150 + #endif // is_mpi
151 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines