--- trunk/OOPSE/libmdtools/SimInfo.cpp 2003/04/04 19:16:11 457 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2003/04/04 19:47:19 458 @@ -16,6 +16,8 @@ SimInfo::SimInfo(){ n_constraints = 0; n_oriented = 0; n_dipoles = 0; + ndf = 0; + ndfRaw = 0; the_integrator = NULL; setTemp = 0; thermalTime = 0.0; @@ -44,7 +46,38 @@ void SimInfo::getBox(double theBox[3]) { theBox[1] = box_y; theBox[2] = box_z; } + +int SimInfo::getNDF(){ + int ndf_local, ndf; + ndf_local = 3 * n_atoms + 3 * n_oriented - n_constraints; + +#ifdef IS_MPI + MPI_Allreduce(&ndf_local,&ndf,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); +#else + ndf = ndf_local; +#endif + + ndf = ndf - 3; + + return ndf; +} + +int SimInfo::getNDFraw() { + int ndfRaw_local, ndfRaw; + + // Raw degrees of freedom that we have to set + ndfRaw_local = 3 * n_atoms + 3 * n_oriented; + +#ifdef IS_MPI + MPI_Allreduce(&ndfRaw_local,&ndfRaw,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD); +#else + ndfRaw = ndfRaw_local; +#endif + + return ndfRaw; +} + void SimInfo::refreshSim(){ simtype fInfo; @@ -102,5 +135,9 @@ void SimInfo::refreshSim(){ "succesfully sent the simulation information to fortran.\n"); MPIcheckPoint(); #endif // is_mpi + + ndf = this->getNDF(); + ndfRaw = this->getNDFraw(); + }