--- trunk/src/rnemd/RNEMD.cpp 2014/02/26 14:14:50 1969 +++ trunk/src/rnemd/RNEMD.cpp 2014/10/22 12:23:59 2026 @@ -291,7 +291,18 @@ namespace OpenMD { kineticFlux_ = 0.0; } if (hasMomentumFluxVector) { - momentumFluxVector_ = rnemdParams->getMomentumFluxVector(); + std::vector mf = rnemdParams->getMomentumFluxVector(); + if (mf.size() != 3) { + sprintf(painCave.errMsg, + "RNEMD: Incorrect number of parameters specified for momentumFluxVector.\n" + "\tthere should be 3 parameters, but %lu were specified.\n", + mf.size()); + painCave.isFatal = 1; + simError(); + } + momentumFluxVector_.x() = mf[0]; + momentumFluxVector_.y() = mf[1]; + momentumFluxVector_.z() = mf[2]; } else { momentumFluxVector_ = V3Zero; if (hasMomentumFlux) { @@ -317,7 +328,18 @@ namespace OpenMD { } } if (hasAngularMomentumFluxVector) { - angularMomentumFluxVector_ = rnemdParams->getAngularMomentumFluxVector(); + std::vector amf = rnemdParams->getAngularMomentumFluxVector(); + if (amf.size() != 3) { + sprintf(painCave.errMsg, + "RNEMD: Incorrect number of parameters specified for angularMomentumFluxVector.\n" + "\tthere should be 3 parameters, but %lu were specified.\n", + amf.size()); + painCave.isFatal = 1; + simError(); + } + angularMomentumFluxVector_.x() = amf[0]; + angularMomentumFluxVector_.y() = amf[1]; + angularMomentumFluxVector_.z() = amf[2]; } else { angularMomentumFluxVector_ = V3Zero; if (hasAngularMomentumFlux) { @@ -348,7 +370,18 @@ namespace OpenMD { } if (hasCoordinateOrigin) { - coordinateOrigin_ = rnemdParams->getCoordinateOrigin(); + std::vector co = rnemdParams->getCoordinateOrigin(); + if (co.size() != 3) { + sprintf(painCave.errMsg, + "RNEMD: Incorrect number of parameters specified for coordinateOrigin.\n" + "\tthere should be 3 parameters, but %lu were specified.\n", + co.size()); + painCave.isFatal = 1; + simError(); + } + coordinateOrigin_.x() = co[0]; + coordinateOrigin_.y() = co[1]; + coordinateOrigin_.z() = co[2]; } else { coordinateOrigin_ = V3Zero; } @@ -623,11 +656,11 @@ namespace OpenMD { StuntDouble* sd; RealType min_val; - bool min_found = false; + int min_found = 0; StuntDouble* min_sd; RealType max_val; - bool max_found = false; + int max_found = 0; StuntDouble* max_sd; for (sd = seleManA_.beginSelected(selei); sd != NULL; @@ -682,7 +715,7 @@ namespace OpenMD { if (!max_found) { max_val = value; max_sd = sd; - max_found = true; + max_found = 1; } else { if (max_val < value) { max_val = value; @@ -744,7 +777,7 @@ namespace OpenMD { if (!min_found) { min_val = value; min_sd = sd; - min_found = true; + min_found = 1; } else { if (min_val > value) { min_val = value; @@ -857,13 +890,13 @@ namespace OpenMD { Vector3d min_vel; Vector3d max_vel = max_sd->getVel(); - MPI_Status* status; + MPI_Status status; // point-to-point swap of the velocity vector MPI_Sendrecv(max_vel.getArrayPointer(), 3, MPI_REALTYPE, min_vals.rank, 0, min_vel.getArrayPointer(), 3, MPI_REALTYPE, - min_vals.rank, 0, MPI_COMM_WORLD, status); + min_vals.rank, 0, MPI_COMM_WORLD, &status); switch(rnemdFluxType_) { case rnemdKE : @@ -878,7 +911,7 @@ namespace OpenMD { MPI_REALTYPE, min_vals.rank, 1, min_angMom.getArrayPointer(), 3, MPI_REALTYPE, min_vals.rank, 1, - MPI_COMM_WORLD, status); + MPI_COMM_WORLD, &status); max_sd->setJ(min_angMom); } @@ -903,13 +936,13 @@ namespace OpenMD { Vector3d max_vel; Vector3d min_vel = min_sd->getVel(); - MPI_Status* status; + MPI_Status status; // point-to-point swap of the velocity vector MPI_Sendrecv(min_vel.getArrayPointer(), 3, MPI_REALTYPE, max_vals.rank, 0, max_vel.getArrayPointer(), 3, MPI_REALTYPE, - max_vals.rank, 0, MPI_COMM_WORLD, status); + max_vals.rank, 0, MPI_COMM_WORLD, &status); switch(rnemdFluxType_) { case rnemdKE : @@ -924,7 +957,7 @@ namespace OpenMD { MPI_REALTYPE, max_vals.rank, 1, max_angMom.getArrayPointer(), 3, MPI_REALTYPE, max_vals.rank, 1, - MPI_COMM_WORLD, status); + MPI_COMM_WORLD, &status); min_sd->setJ(max_angMom); } @@ -1755,7 +1788,9 @@ namespace OpenMD { #if defined(HAVE_QHULL) ConvexHull* surfaceMeshA = new ConvexHull(); surfaceMeshA->computeHull(aSites); + cerr << "flag1\n"; areaA = surfaceMeshA->getArea(); + cerr << "Flag2 " << areaA << "\n"; delete surfaceMeshA; #else sprintf( painCave.errMsg, @@ -1999,11 +2034,11 @@ namespace OpenMD { 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); MPI_Allreduce(MPI_IN_PLACE, &binMass[i], 1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(MPI_IN_PLACE, &binP[i], + MPI_Allreduce(MPI_IN_PLACE, binP[i].getArrayPointer(), 3, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(MPI_IN_PLACE, &binL[i], + MPI_Allreduce(MPI_IN_PLACE, binL[i].getArrayPointer(), 3, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); - MPI_Allreduce(MPI_IN_PLACE, &binI[i], + MPI_Allreduce(MPI_IN_PLACE, binI[i].getArrayPointer(), 9, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); MPI_Allreduce(MPI_IN_PLACE, &binKE[i], 1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD); @@ -2239,7 +2274,7 @@ namespace OpenMD { } rnemdFile_ << "#######################################################\n"; - rnemdFile_ << "# Standard Deviations in those quantities follow:\n"; + rnemdFile_ << "# 95% confidence intervals in those quantities follow:\n"; rnemdFile_ << "#######################################################\n"; @@ -2248,9 +2283,9 @@ namespace OpenMD { for (unsigned int i = 0; i < outputMask_.size(); ++i) { if (outputMask_[i]) { if (data_[i].dataType == "RealType") - writeRealStdDev(i,j); + writeRealErrorBars(i,j); else if (data_[i].dataType == "Vector3d") - writeVectorStdDev(i,j); + writeVectorErrorBars(i,j); else { sprintf( painCave.errMsg, "RNEMD found an unknown data type for: %s ", @@ -2321,7 +2356,7 @@ namespace OpenMD { } } - void RNEMD::writeRealStdDev(int index, unsigned int bin) { + void RNEMD::writeRealErrorBars(int index, unsigned int bin) { if (!doRNEMD_) return; assert(index >=0 && index < ENDINDEX); assert(int(bin) < nBins_); @@ -2331,7 +2366,7 @@ namespace OpenMD { count = data_[index].accumulator[bin]->count(); if (count == 0) return; - dynamic_cast(data_[index].accumulator[bin])->getStdDev(s); + dynamic_cast(data_[index].accumulator[bin])->get95percentConfidenceInterval(s); if (! isinf(s) && ! isnan(s)) { rnemdFile_ << "\t" << s; @@ -2344,7 +2379,7 @@ namespace OpenMD { } } - void RNEMD::writeVectorStdDev(int index, unsigned int bin) { + void RNEMD::writeVectorErrorBars(int index, unsigned int bin) { if (!doRNEMD_) return; assert(index >=0 && index < ENDINDEX); assert(int(bin) < nBins_); @@ -2354,7 +2389,7 @@ namespace OpenMD { count = data_[index].accumulator[bin]->count(); if (count == 0) return; - dynamic_cast(data_[index].accumulator[bin])->getStdDev(s); + dynamic_cast(data_[index].accumulator[bin])->get95percentConfidenceInterval(s); if (isinf(s[0]) || isnan(s[0]) || isinf(s[1]) || isnan(s[1]) || isinf(s[2]) || isnan(s[2]) ) {