ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/brains/Thermo.cpp
(Generate patch)

Comparing trunk/src/brains/Thermo.cpp (file contents):
Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 833 by tim, Fri Dec 30 21:25:56 2005 UTC

# Line 110 | Line 110 | namespace oopse {
110    double Thermo::getPotential() {
111      double potential = 0.0;
112      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
113 <    double potential_local = curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] +
114 <      curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] ;
113 >    double shortRangePot_local =  curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] ;
114  
115      // Get total potential for entire system from MPI.
116  
117   #ifdef IS_MPI
118  
119 <    MPI_Allreduce(&potential_local, &potential, 1, MPI_DOUBLE, MPI_SUM,
119 >    MPI_Allreduce(&shortRangePot_local, &potential, 1, MPI_DOUBLE, MPI_SUM,
120                    MPI_COMM_WORLD);
121 +    potential += curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL];
122  
123   #else
124  
125 <    potential = potential_local;
125 >    potential = shortRangePot_local + curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL];
126  
127   #endif // is_mpi
128  
# Line 162 | Line 162 | namespace oopse {
162      return pressure;
163    }
164  
165 +  double Thermo::getPressure(int direction) {
166 +
167 +    // Relies on the calculation of the full molecular pressure tensor
168 +
169 +          
170 +    Mat3x3d tensor;
171 +    double pressure;
172 +
173 +    tensor = getPressureTensor();
174 +
175 +    pressure = OOPSEConstant::pressureConvert * tensor(direction, direction);
176 +
177 +    return pressure;
178 +  }
179 +
180 +
181 +
182    Mat3x3d Thermo::getPressureTensor() {
183      // returns pressure tensor in units amu*fs^-2*Ang^-1
184      // routine derived via viral theorem description in:
# Line 210 | Line 227 | namespace oopse {
227      stat[Stats::PRESSURE] = getPressure();
228      stat[Stats::VOLUME] = getVolume();      
229  
230 +    Mat3x3d tensor =getPressureTensor();
231 +    stat[Stats::PRESSURE_TENSOR_X] = tensor(0, 0);      
232 +    stat[Stats::PRESSURE_TENSOR_Y] = tensor(1, 1);      
233 +    stat[Stats::PRESSURE_TENSOR_Z] = tensor(2, 2);      
234 +
235 +
236      /**@todo need refactorying*/
237      //Conserved Quantity is set by integrator and time is set by setTime
238      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines