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

Comparing:
branches/mmeineke/OOPSE/libmdtools/StatWriter.cpp (file contents), Revision 377 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
trunk/OOPSE/libmdtools/StatWriter.cpp (file contents), Revision 1180 by chrisfen, Thu May 20 20:24:07 2004 UTC

# 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 29 | Line 33 | StatWriter::StatWriter( SimInfo* the_entry_plug ){
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\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    }
# Line 52 | Line 67 | StatWriter::~StatWriter( ){
67   #endif // is_mpi
68  
69      outFile.close();
70 +    rawFile.close();
71      delete tStats;
72  
73   #ifdef IS_MPI
# Line 61 | Line 77 | void StatWriter::writeStat( double currentTime ){
77  
78   void StatWriter::writeStat( double currentTime ){
79  
80 <  double totE, potE, kinE, temp;
80 >  double totE, potE, kinE, temp, press, vol;
81 >  double conservedQuantity;
82  
83    totE = tStats->getTotalE();
84    potE = tStats->getPotential();
85    kinE = tStats->getKinetic();
86    temp = tStats->getTemperature();
87 <
87 >  press = tStats->getPressure();
88 >  vol = tStats->getVolume();
89 >  conservedQuantity = entry_plug->the_integrator->getConservedQuantity();
90   #ifdef IS_MPI
91    if(worldRank == 0 ){
92   #endif // is_mpi
# Line 78 | Line 97 | void StatWriter::writeStat( double currentTime ){
97        << totE << "\t"
98        << potE << "\t"
99        << kinE << "\t"
100 <      << temp << "\n";
100 >      << temp << "\t"
101 >      << press << "\t"
102 >      << vol << "\t"
103 >      << conservedQuantity << "\n";
104 >
105      outFile.flush();
106  
107   #ifdef IS_MPI
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 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines