--- trunk/OOPSE/libmdtools/Thermo.cpp 2003/03/31 21:50:59 438 +++ trunk/OOPSE/libmdtools/Thermo.cpp 2003/04/03 20:21:54 447 @@ -4,7 +4,6 @@ using namespace std; #ifdef IS_MPI #include -#include #endif //is_mpi #include "Thermo.hpp" @@ -73,7 +72,8 @@ double Thermo::getKinetic(){ } } #ifdef IS_MPI - MPI::COMM_WORLD.Allreduce(&kinetic,&kinetic_global,1,MPI_DOUBLE,MPI_SUM); + MPI_Allreduce(&kinetic,&kinetic_global,1,MPI_DOUBLE, + MPI_SUM, MPI_COMM_WORLD); kinetic = kinetic_global; #endif //is_mpi @@ -100,17 +100,10 @@ double Thermo::getPotential(){ potential_local += molecules[el].getPotential(); } -#ifdef IS_MPI - /* - std::cerr << "node " << worldRank << ": before LONG RANGE pot = " << entry_plug->lrPot - << "; pot_local = " << potential_local - << "; pot = " << potential << "\n"; - */ -#endif - // Get total potential for entire system from MPI. #ifdef IS_MPI - MPI::COMM_WORLD.Allreduce(&potential_local,&potential,1,MPI_DOUBLE,MPI_SUM); + MPI_Allreduce(&potential_local,&potential,1,MPI_DOUBLE, + MPI_SUM, MPI_COMM_WORLD); #else potential = potential_local; #endif // is_mpi @@ -142,7 +135,7 @@ double Thermo::getTemperature(){ - entry_plug->n_constraints; #ifdef IS_MPI - MPI::COMM_WORLD.Allreduce(&ndf_local,&ndf,1,MPI_INT,MPI_SUM); + MPI_Allreduce(&ndf_local,&ndf,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); #else ndf = ndf_local; #endif @@ -154,11 +147,10 @@ double Thermo::getPressure(){ } double Thermo::getPressure(){ + // returns pressure in units amu*fs^-2*Ang^-1 + // routine derived via viral theorem description in: + // Paci, E. and Marchi, M. J.Phys.Chem. 1996, 100, 4314-4322 -// const double conv_Pa_atm = 9.901E-6; // convert Pa -> atm -// const double conv_internal_Pa = 1.661E-7; //convert amu/(fs^2 A) -> Pa -// const double conv_A_m = 1.0E-10; //convert A -> m - return 0.0; } @@ -196,8 +188,8 @@ void Thermo::velocitize() { - entry_plug->n_constraints; #ifdef IS_MPI - MPI::COMM_WORLD.Allreduce(&ndf_local,&ndf,1,MPI_INT,MPI_SUM); - MPI::COMM_WORLD.Allreduce(&ndfRaw_local,&ndfRaw,1,MPI_INT,MPI_SUM); + MPI_Allreduce(&ndf_local,&ndf,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(&ndfRaw_local,&ndfRaw,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); #else ndfRaw = ndfRaw_local; ndf = ndf_local; @@ -212,7 +204,7 @@ void Thermo::velocitize() { av2 = 2.0 * kebar / atoms[vr]->getMass(); vbar = sqrt( av2 ); - + // vbar = sqrt( 8.31451e-7 * temperature / atoms[vr]->getMass() ); // picks random velocities from a gaussian distribution @@ -301,8 +293,8 @@ void Thermo::getCOMVel(double vdrift[3]){ } #ifdef IS_MPI - MPI::COMM_WORLD.Allreduce(&mtot_local,&mtot,1,MPI_DOUBLE,MPI_SUM); - MPI::COMM_WORLD.Allreduce(vdrift_local,vdrift,3,MPI_DOUBLE,MPI_SUM); + MPI_Allreduce(&mtot_local,&mtot,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(vdrift_local,vdrift,3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); #else mtot = mtot_local; for(vd = 0; vd < 3; vd++) {