ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/Thermo.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/brains/Thermo.cpp (file contents):
Revision 1820 by tim, Thu Dec 2 00:09:35 2004 UTC vs.
Revision 1854 by tim, Sun Dec 5 22:02:42 2004 UTC

# Line 1 | Line 1
1   #include <math.h>
2   #include <iostream>
3  
4 using namespace std;
4  
5 +
6   #ifdef IS_MPI
7   #include <mpi.h>
8   #endif //is_mpi
# Line 36 | Line 36 | double Thermo::getKinetic() {
36              double mass = integrableObject->getMass();
37              Vector3d vel = integrableObject->getVel();
38  
39 <            kinetic = mass * (vel[0]*vel[0] + vel[1]*vel[1] + vel[2]*vel[2]);
39 >            kinetic += mass * (vel[0]*vel[0] + vel[1]*vel[1] + vel[2]*vel[2]);
40  
41              if (integrableObject->isDirectional()) {
42                  angMom = integrableObject->getJ();
# Line 122 | Line 122 | double Thermo::getPressure() {
122      Mat3x3d tensor;
123      double pressure;
124  
125 <    this->getPressureTensor(tensor);
125 >    tensor = getPressureTensor();
126  
127      pressure = OOPSEConstant::pressureConvert * (tensor(0, 0) + tensor(1, 1) + tensor(2, 2)) / 3.0;
128  
129      return pressure;
130   }
131  
132 < void Thermo::getPressureTensor(Mat3x3d pressureTensor) {
132 > Mat3x3d Thermo::getPressureTensor() {
133      // returns pressure tensor in units amu*fs^-2*Ang^-1
134      // routine derived via viral theorem description in:
135      // Paci, E. and Marchi, M. J.Phys.Chem. 1996, 100, 4314-4322
136 <
136 >    Mat3x3d pressureTensor;
137      Mat3x3d p_local(0.0);
138      Mat3x3d p_global(0.0);
139  
# Line 161 | Line 161 | void Thermo::getPressureTensor(Mat3x3d pressureTensor)
161      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
162      Mat3x3d tau = curSnapshot->statData.getTau();
163  
164 <    pressureTensor =  p_global + OOPSEConstant::energyConvert/volume * tau;
164 >    pressureTensor =  (p_global + OOPSEConstant::energyConvert* tau)/volume;
165 >
166 >    return pressureTensor;
167   }
168  
169   void Thermo::saveStat(){
# Line 173 | Line 175 | void Thermo::saveStat(){
175      stat[Stats::TOTAL_ENERGY] = stat[Stats::KINETIC_ENERGY]  + stat[Stats::POTENTIAL_ENERGY] ;
176      stat[Stats::TEMPERATURE] = getTemperature();
177      stat[Stats::PRESSURE] = getPressure();
178 <    stat[Stats::VOLUME] = currSnapshot->getVolume();      
178 >    stat[Stats::VOLUME] = getVolume();      
179  
180      /**@todo need refactorying*/
181      //Conserved Quantity is set by integrator and time is set by setTime

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines