--- trunk/OOPSE/libmdtools/Thermo.cpp 2003/04/10 16:22:00 486 +++ trunk/OOPSE/libmdtools/Thermo.cpp 2003/07/08 20:56:10 574 @@ -151,14 +151,23 @@ double Thermo::getVolume() { } double Thermo::getVolume() { - double theBox[3]; - entry_plug->getBox(theBox); - return (theBox[0] * theBox[1] * theBox[2]); + double volume; + double Hmat[9]; + + entry_plug->getBoxM(Hmat); + + // volume = h1 (dot) h2 (cross) h3 + + volume = Hmat[0] * ( (Hmat[4]*Hmat[8]) - (Hmat[7]*Hmat[5]) ) + + Hmat[1] * ( (Hmat[5]*Hmat[6]) - (Hmat[8]*Hmat[3]) ) + + Hmat[2] * ( (Hmat[3]*Hmat[7]) - (Hmat[6]*Hmat[4]) ); + + return volume; } double Thermo::getPressure() { - // returns the pressure in units of atm + // Relies on the calculation of the full molecular pressure tensor const double p_convert = 1.63882576e8; @@ -222,10 +231,8 @@ void Thermo::getPressureTensor(double press[9]){ } #endif // is_mpi - entry_plug->getBox(theBox); + volume = entry_plug->boxVol; - volume = theBox[0] * theBox[1] * theBox[2]; - for(i=0; i<9; i++) { press[i] = (p_global[i] - entry_plug->tau[i]*e_convert) / volume; }