--- trunk/src/brains/Thermo.cpp 2005/04/15 22:04:00 507 +++ trunk/src/brains/Thermo.cpp 2005/12/30 21:25:56 833 @@ -110,19 +110,19 @@ namespace oopse { double Thermo::getPotential() { double potential = 0.0; Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); - double potential_local = curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] + - curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] ; + double shortRangePot_local = curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] ; // Get total potential for entire system from MPI. #ifdef IS_MPI - MPI_Allreduce(&potential_local, &potential, 1, MPI_DOUBLE, MPI_SUM, + MPI_Allreduce(&shortRangePot_local, &potential, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + potential += curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL]; #else - potential = potential_local; + potential = shortRangePot_local + curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL]; #endif // is_mpi @@ -162,6 +162,23 @@ namespace oopse { return pressure; } + double Thermo::getPressure(int direction) { + + // Relies on the calculation of the full molecular pressure tensor + + + Mat3x3d tensor; + double pressure; + + tensor = getPressureTensor(); + + pressure = OOPSEConstant::pressureConvert * tensor(direction, direction); + + return pressure; + } + + + Mat3x3d Thermo::getPressureTensor() { // returns pressure tensor in units amu*fs^-2*Ang^-1 // routine derived via viral theorem description in: @@ -210,6 +227,12 @@ namespace oopse { stat[Stats::PRESSURE] = getPressure(); stat[Stats::VOLUME] = getVolume(); + Mat3x3d tensor =getPressureTensor(); + stat[Stats::PRESSURE_TENSOR_X] = tensor(0, 0); + stat[Stats::PRESSURE_TENSOR_Y] = tensor(1, 1); + stat[Stats::PRESSURE_TENSOR_Z] = tensor(2, 2); + + /**@todo need refactorying*/ //Conserved Quantity is set by integrator and time is set by setTime