--- trunk/src/rnemd/RNEMD.cpp 2014/02/28 13:25:13 1971 +++ trunk/src/rnemd/RNEMD.cpp 2015/03/07 21:41:51 2071 @@ -68,12 +68,14 @@ namespace OpenMD { using namespace std; namespace OpenMD { - RNEMD::RNEMD(SimInfo* info) : info_(info), evaluator_(info), seleMan_(info), - evaluatorA_(info), seleManA_(info), - commonA_(info), evaluatorB_(info), - seleManB_(info), commonB_(info), - hasData_(false), hasDividingArea_(false), - usePeriodicBoundaryConditions_(info->getSimParams()->getUsePeriodicBoundaryConditions()) { + RNEMD::RNEMD(SimInfo* info) : info_(info), + evaluator_(info_), seleMan_(info_), + evaluatorA_(info_), seleManA_(info_), + evaluatorB_(info_), seleManB_(info_), + commonA_(info_), commonB_(info_), + usePeriodicBoundaryConditions_(info_->getSimParams()->getUsePeriodicBoundaryConditions()), + hasDividingArea_(false), + hasData_(false) { trialCount_ = 0; failTrialCount_ = 0; @@ -291,7 +293,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) { @@ -315,272 +328,293 @@ namespace OpenMD { default: break; } - } - if (hasAngularMomentumFluxVector) { - angularMomentumFluxVector_ = rnemdParams->getAngularMomentumFluxVector(); - } else { - angularMomentumFluxVector_ = V3Zero; - if (hasAngularMomentumFlux) { - RealType angularMomentumFlux = rnemdParams->getAngularMomentumFlux(); - switch (rnemdFluxType_) { - case rnemdLx: - angularMomentumFluxVector_.x() = angularMomentumFlux; - break; - case rnemdLy: - angularMomentumFluxVector_.y() = angularMomentumFlux; - break; - case rnemdLz: - angularMomentumFluxVector_.z() = angularMomentumFlux; - break; - case rnemdKeLx: - angularMomentumFluxVector_.x() = angularMomentumFlux; - break; - case rnemdKeLy: - angularMomentumFluxVector_.y() = angularMomentumFlux; - break; - case rnemdKeLz: - angularMomentumFluxVector_.z() = angularMomentumFlux; - break; - default: - break; - } - } } - - if (hasCoordinateOrigin) { - coordinateOrigin_ = rnemdParams->getCoordinateOrigin(); - } else { - coordinateOrigin_ = V3Zero; - } - - // do some sanity checking - - int selectionCount = seleMan_.getSelectionCount(); - - int nIntegrable = info->getNGlobalIntegrableObjects(); - - if (selectionCount > nIntegrable) { - sprintf(painCave.errMsg, - "RNEMD: The current objectSelection,\n" - "\t\t%s\n" - "\thas resulted in %d selected objects. However,\n" - "\tthe total number of integrable objects in the system\n" - "\tis only %d. This is almost certainly not what you want\n" - "\tto do. A likely cause of this is forgetting the _RB_0\n" - "\tselector in the selection script!\n", - rnemdObjectSelection_.c_str(), - selectionCount, nIntegrable); - painCave.isFatal = 0; - painCave.severity = OPENMD_WARNING; - simError(); + } + if (hasAngularMomentumFluxVector) { + 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(); } - - areaAccumulator_ = new Accumulator(); - - nBins_ = rnemdParams->getOutputBins(); - binWidth_ = rnemdParams->getOutputBinWidth(); - - data_.resize(RNEMD::ENDINDEX); - OutputData z; - z.units = "Angstroms"; - z.title = "Z"; - z.dataType = "RealType"; - z.accumulator.reserve(nBins_); - for (int i = 0; i < nBins_; i++) - z.accumulator.push_back( new Accumulator() ); - data_[Z] = z; - outputMap_["Z"] = Z; - - OutputData r; - r.units = "Angstroms"; - r.title = "R"; - r.dataType = "RealType"; - r.accumulator.reserve(nBins_); - for (int i = 0; i < nBins_; i++) - r.accumulator.push_back( new Accumulator() ); - data_[R] = r; - outputMap_["R"] = R; - - OutputData temperature; - temperature.units = "K"; - temperature.title = "Temperature"; - temperature.dataType = "RealType"; - temperature.accumulator.reserve(nBins_); - for (int i = 0; i < nBins_; i++) - temperature.accumulator.push_back( new Accumulator() ); - data_[TEMPERATURE] = temperature; - outputMap_["TEMPERATURE"] = TEMPERATURE; - - OutputData velocity; - velocity.units = "angstroms/fs"; - velocity.title = "Velocity"; - velocity.dataType = "Vector3d"; - velocity.accumulator.reserve(nBins_); - for (int i = 0; i < nBins_; i++) - velocity.accumulator.push_back( new VectorAccumulator() ); - data_[VELOCITY] = velocity; - outputMap_["VELOCITY"] = VELOCITY; - - OutputData angularVelocity; - angularVelocity.units = "angstroms^2/fs"; - angularVelocity.title = "AngularVelocity"; - angularVelocity.dataType = "Vector3d"; - angularVelocity.accumulator.reserve(nBins_); - for (int i = 0; i < nBins_; i++) - angularVelocity.accumulator.push_back( new VectorAccumulator() ); - data_[ANGULARVELOCITY] = angularVelocity; - outputMap_["ANGULARVELOCITY"] = ANGULARVELOCITY; - - OutputData density; - density.units = "g cm^-3"; - density.title = "Density"; - density.dataType = "RealType"; - density.accumulator.reserve(nBins_); - for (int i = 0; i < nBins_; i++) - density.accumulator.push_back( new Accumulator() ); - data_[DENSITY] = density; - outputMap_["DENSITY"] = DENSITY; - - if (hasOutputFields) { - parseOutputFileFormat(rnemdParams->getOutputFields()); - } else { - if (usePeriodicBoundaryConditions_) - outputMask_.set(Z); - else - outputMask_.set(R); + angularMomentumFluxVector_.x() = amf[0]; + angularMomentumFluxVector_.y() = amf[1]; + angularMomentumFluxVector_.z() = amf[2]; + } else { + angularMomentumFluxVector_ = V3Zero; + if (hasAngularMomentumFlux) { + RealType angularMomentumFlux = rnemdParams->getAngularMomentumFlux(); switch (rnemdFluxType_) { - case rnemdKE: - case rnemdRotKE: - case rnemdFullKE: - outputMask_.set(TEMPERATURE); - break; - case rnemdPx: - case rnemdPy: - outputMask_.set(VELOCITY); - break; - case rnemdPz: - case rnemdPvector: - outputMask_.set(VELOCITY); - outputMask_.set(DENSITY); - break; case rnemdLx: + angularMomentumFluxVector_.x() = angularMomentumFlux; + break; case rnemdLy: + angularMomentumFluxVector_.y() = angularMomentumFlux; + break; case rnemdLz: - case rnemdLvector: - outputMask_.set(ANGULARVELOCITY); + angularMomentumFluxVector_.z() = angularMomentumFlux; break; case rnemdKeLx: + angularMomentumFluxVector_.x() = angularMomentumFlux; + break; case rnemdKeLy: + angularMomentumFluxVector_.y() = angularMomentumFlux; + break; case rnemdKeLz: - case rnemdKeLvector: - outputMask_.set(TEMPERATURE); - outputMask_.set(ANGULARVELOCITY); + angularMomentumFluxVector_.z() = angularMomentumFlux; break; - case rnemdKePx: - case rnemdKePy: - outputMask_.set(TEMPERATURE); - outputMask_.set(VELOCITY); - break; - case rnemdKePvector: - outputMask_.set(TEMPERATURE); - outputMask_.set(VELOCITY); - outputMask_.set(DENSITY); - break; default: break; } - } - - if (hasOutputFileName) { - rnemdFileName_ = rnemdParams->getOutputFileName(); - } else { - rnemdFileName_ = getPrefix(info->getFinalConfigFileName()) + ".rnemd"; - } + } + } - exchangeTime_ = rnemdParams->getExchangeTime(); - - Snapshot* currentSnap_ = info->getSnapshotManager()->getCurrentSnapshot(); - // total exchange sums are zeroed out at the beginning: - - kineticExchange_ = 0.0; - momentumExchange_ = V3Zero; - angularMomentumExchange_ = V3Zero; - - std::ostringstream selectionAstream; - std::ostringstream selectionBstream; + if (hasCoordinateOrigin) { + 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; + } - if (hasSelectionA_) { - selectionA_ = rnemdParams->getSelectionA(); - } else { - if (usePeriodicBoundaryConditions_) { - Mat3x3d hmat = currentSnap_->getHmat(); - - if (hasSlabWidth) - slabWidth_ = rnemdParams->getSlabWidth(); - else - slabWidth_ = hmat(2,2) / 10.0; - - if (hasSlabACenter) - slabACenter_ = rnemdParams->getSlabACenter(); - else - slabACenter_ = 0.0; - - selectionAstream << "select wrappedz > " - << slabACenter_ - 0.5*slabWidth_ - << " && wrappedz < " - << slabACenter_ + 0.5*slabWidth_; - selectionA_ = selectionAstream.str(); - } else { - if (hasSphereARadius) - sphereARadius_ = rnemdParams->getSphereARadius(); - else { - // use an initial guess to the size of the inner slab to be 1/10 the - // radius of an approximately spherical hull: - Thermo thermo(info); - RealType hVol = thermo.getHullVolume(); - sphereARadius_ = 0.1 * pow((3.0 * hVol / (4.0 * M_PI)), 1.0/3.0); - } - selectionAstream << "select r < " << sphereARadius_; - selectionA_ = selectionAstream.str(); - } + // do some sanity checking + + int selectionCount = seleMan_.getSelectionCount(); + int nIntegrable = info->getNGlobalIntegrableObjects(); + if (selectionCount > nIntegrable) { + sprintf(painCave.errMsg, + "RNEMD: The current objectSelection,\n" + "\t\t%s\n" + "\thas resulted in %d selected objects. However,\n" + "\tthe total number of integrable objects in the system\n" + "\tis only %d. This is almost certainly not what you want\n" + "\tto do. A likely cause of this is forgetting the _RB_0\n" + "\tselector in the selection script!\n", + rnemdObjectSelection_.c_str(), + selectionCount, nIntegrable); + painCave.isFatal = 0; + painCave.severity = OPENMD_WARNING; + simError(); + } + + areaAccumulator_ = new Accumulator(); + + nBins_ = rnemdParams->getOutputBins(); + binWidth_ = rnemdParams->getOutputBinWidth(); + + data_.resize(RNEMD::ENDINDEX); + OutputData z; + z.units = "Angstroms"; + z.title = "Z"; + z.dataType = "RealType"; + z.accumulator.reserve(nBins_); + for (int i = 0; i < nBins_; i++) + z.accumulator.push_back( new Accumulator() ); + data_[Z] = z; + outputMap_["Z"] = Z; + + OutputData r; + r.units = "Angstroms"; + r.title = "R"; + r.dataType = "RealType"; + r.accumulator.reserve(nBins_); + for (int i = 0; i < nBins_; i++) + r.accumulator.push_back( new Accumulator() ); + data_[R] = r; + outputMap_["R"] = R; + + OutputData temperature; + temperature.units = "K"; + temperature.title = "Temperature"; + temperature.dataType = "RealType"; + temperature.accumulator.reserve(nBins_); + for (int i = 0; i < nBins_; i++) + temperature.accumulator.push_back( new Accumulator() ); + data_[TEMPERATURE] = temperature; + outputMap_["TEMPERATURE"] = TEMPERATURE; + + OutputData velocity; + velocity.units = "angstroms/fs"; + velocity.title = "Velocity"; + velocity.dataType = "Vector3d"; + velocity.accumulator.reserve(nBins_); + for (int i = 0; i < nBins_; i++) + velocity.accumulator.push_back( new VectorAccumulator() ); + data_[VELOCITY] = velocity; + outputMap_["VELOCITY"] = VELOCITY; + + OutputData angularVelocity; + angularVelocity.units = "angstroms^2/fs"; + angularVelocity.title = "AngularVelocity"; + angularVelocity.dataType = "Vector3d"; + angularVelocity.accumulator.reserve(nBins_); + for (int i = 0; i < nBins_; i++) + angularVelocity.accumulator.push_back( new VectorAccumulator() ); + data_[ANGULARVELOCITY] = angularVelocity; + outputMap_["ANGULARVELOCITY"] = ANGULARVELOCITY; + + OutputData density; + density.units = "g cm^-3"; + density.title = "Density"; + density.dataType = "RealType"; + density.accumulator.reserve(nBins_); + for (int i = 0; i < nBins_; i++) + density.accumulator.push_back( new Accumulator() ); + data_[DENSITY] = density; + outputMap_["DENSITY"] = DENSITY; + + if (hasOutputFields) { + parseOutputFileFormat(rnemdParams->getOutputFields()); + } else { + if (usePeriodicBoundaryConditions_) + outputMask_.set(Z); + else + outputMask_.set(R); + switch (rnemdFluxType_) { + case rnemdKE: + case rnemdRotKE: + case rnemdFullKE: + outputMask_.set(TEMPERATURE); + break; + case rnemdPx: + case rnemdPy: + outputMask_.set(VELOCITY); + break; + case rnemdPz: + case rnemdPvector: + outputMask_.set(VELOCITY); + outputMask_.set(DENSITY); + break; + case rnemdLx: + case rnemdLy: + case rnemdLz: + case rnemdLvector: + outputMask_.set(ANGULARVELOCITY); + break; + case rnemdKeLx: + case rnemdKeLy: + case rnemdKeLz: + case rnemdKeLvector: + outputMask_.set(TEMPERATURE); + outputMask_.set(ANGULARVELOCITY); + break; + case rnemdKePx: + case rnemdKePy: + outputMask_.set(TEMPERATURE); + outputMask_.set(VELOCITY); + break; + case rnemdKePvector: + outputMask_.set(TEMPERATURE); + outputMask_.set(VELOCITY); + outputMask_.set(DENSITY); + break; + default: + break; } + } - if (hasSelectionB_) { - selectionB_ = rnemdParams->getSelectionB(); - - } else { - if (usePeriodicBoundaryConditions_) { - Mat3x3d hmat = currentSnap_->getHmat(); + if (hasOutputFileName) { + rnemdFileName_ = rnemdParams->getOutputFileName(); + } else { + rnemdFileName_ = getPrefix(info->getFinalConfigFileName()) + ".rnemd"; + } + + exchangeTime_ = rnemdParams->getExchangeTime(); + + Snapshot* currentSnap_ = info->getSnapshotManager()->getCurrentSnapshot(); + // total exchange sums are zeroed out at the beginning: + + kineticExchange_ = 0.0; + momentumExchange_ = V3Zero; + angularMomentumExchange_ = V3Zero; + + std::ostringstream selectionAstream; + std::ostringstream selectionBstream; + + if (hasSelectionA_) { + selectionA_ = rnemdParams->getSelectionA(); + } else { + if (usePeriodicBoundaryConditions_) { + Mat3x3d hmat = currentSnap_->getHmat(); - if (hasSlabWidth) - slabWidth_ = rnemdParams->getSlabWidth(); - else - slabWidth_ = hmat(2,2) / 10.0; + if (hasSlabWidth) + slabWidth_ = rnemdParams->getSlabWidth(); + else + slabWidth_ = hmat(2,2) / 10.0; - if (hasSlabBCenter) - slabBCenter_ = rnemdParams->getSlabBCenter(); - else - slabBCenter_ = hmat(2,2) / 2.0; + if (hasSlabACenter) + slabACenter_ = rnemdParams->getSlabACenter(); + else + slabACenter_ = 0.0; - selectionBstream << "select wrappedz > " - << slabBCenter_ - 0.5*slabWidth_ - << " && wrappedz < " - << slabBCenter_ + 0.5*slabWidth_; + selectionAstream << "select wrappedz > " + << slabACenter_ - 0.5*slabWidth_ + << " && wrappedz < " + << slabACenter_ + 0.5*slabWidth_; + selectionA_ = selectionAstream.str(); + } else { + if (hasSphereARadius) + sphereARadius_ = rnemdParams->getSphereARadius(); + else { + // use an initial guess to the size of the inner slab to be 1/10 the + // radius of an approximately spherical hull: + Thermo thermo(info); + RealType hVol = thermo.getHullVolume(); + sphereARadius_ = 0.1 * pow((3.0 * hVol / (4.0 * M_PI)), 1.0/3.0); + } + selectionAstream << "select r < " << sphereARadius_; + selectionA_ = selectionAstream.str(); + } + } + + if (hasSelectionB_) { + selectionB_ = rnemdParams->getSelectionB(); + + } else { + if (usePeriodicBoundaryConditions_) { + Mat3x3d hmat = currentSnap_->getHmat(); + + if (hasSlabWidth) + slabWidth_ = rnemdParams->getSlabWidth(); + else + slabWidth_ = hmat(2,2) / 10.0; + + if (hasSlabBCenter) + slabBCenter_ = rnemdParams->getSlabBCenter(); + else + slabBCenter_ = hmat(2,2) / 2.0; + + selectionBstream << "select wrappedz > " + << slabBCenter_ - 0.5*slabWidth_ + << " && wrappedz < " + << slabBCenter_ + 0.5*slabWidth_; + selectionB_ = selectionBstream.str(); + } else { + if (hasSphereBRadius_) { + sphereBRadius_ = rnemdParams->getSphereBRadius(); + selectionBstream << "select r > " << sphereBRadius_; selectionB_ = selectionBstream.str(); } else { - if (hasSphereBRadius_) { - sphereBRadius_ = rnemdParams->getSphereBRadius(); - selectionBstream << "select r > " << sphereBRadius_; - selectionB_ = selectionBstream.str(); - } else { - selectionB_ = "select hull"; - BisHull_ = true; - hasSelectionB_ = true; - } + selectionB_ = "select hull"; + BisHull_ = true; + hasSelectionB_ = true; } } } - + + // object evaluator: evaluator_.loadScriptString(rnemdObjectSelection_); seleMan_.setSelectionSet(evaluator_.evaluate()); @@ -622,13 +656,13 @@ namespace OpenMD { StuntDouble* sd; - RealType min_val; + RealType min_val(0.0); int min_found = 0; - StuntDouble* min_sd; - - RealType max_val; + StuntDouble* min_sd = NULL; + + RealType max_val(0.0); int max_found = 0; - StuntDouble* max_sd; + StuntDouble* max_sd = NULL; for (sd = seleManA_.beginSelected(selei); sd != NULL; sd = seleManA_.nextSelected(selei)) { @@ -642,7 +676,7 @@ namespace OpenMD { RealType mass = sd->getMass(); Vector3d vel = sd->getVel(); - RealType value; + RealType value(0.0); switch(rnemdFluxType_) { case rnemdKE : @@ -703,7 +737,7 @@ namespace OpenMD { RealType mass = sd->getMass(); Vector3d vel = sd->getVel(); - RealType value; + RealType value(0.0); switch(rnemdFluxType_) { case rnemdKE : @@ -857,13 +891,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 +912,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 +937,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 +958,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); } @@ -988,7 +1022,6 @@ namespace OpenMD { int selej; Snapshot* currentSnap_ = info_->getSnapshotManager()->getCurrentSnapshot(); - RealType time = currentSnap_->getTime(); Mat3x3d hmat = currentSnap_->getHmat(); StuntDouble* sd; @@ -1115,7 +1148,7 @@ namespace OpenMD { RealType px = Pcx / Phx; RealType py = Pcy / Phy; RealType pz = Pcz / Phz; - RealType c, x, y, z; + RealType c(0.0), x(0.0), y(0.0), z(0.0); bool successfulScale = false; if ((rnemdFluxType_ == rnemdFullKE) || (rnemdFluxType_ == rnemdRotKE)) { @@ -1185,7 +1218,8 @@ namespace OpenMD { } } } else { - RealType a000, a110, c0, a001, a111, b01, b11, c1; + RealType a000(0.0), a110(0.0), c0(0.0); + RealType a001(0.0), a111(0.0), b01(0.0), b11(0.0), c1(0.0); switch(rnemdFluxType_) { case rnemdKE : /* used hotBin coeff's & only scale x & y dimensions @@ -1288,7 +1322,7 @@ namespace OpenMD { vector > rps; for (ri = realRoots.begin(); ri !=realRoots.end(); ++ri) { r2 = *ri; - //check if FindRealRoots() give the right answer + // Check to see if FindRealRoots() gave the right answer: if ( fabs(u0 + r2 * (u1 + r2 * (u2 + r2 * (u3 + r2 * u4)))) > 1e-6 ) { sprintf(painCave.errMsg, "RNEMD Warning: polynomial solve seems to have an error!"); @@ -1296,7 +1330,7 @@ namespace OpenMD { simError(); failRootCount_++; } - //might not be useful w/o rescaling coefficients + // Might not be useful w/o rescaling coefficients alpha0 = -c0 - a110 * r2 * r2; if (alpha0 >= 0.0) { r1 = sqrt(alpha0 / a000); @@ -1311,13 +1345,14 @@ namespace OpenMD { } } } - // Consider combining together the solving pair part w/ the searching - // best solution part so that we don't need the pairs vector + // Consider combining together the part for solving for the pair + // w/ the searching for the best solution part so that we don't + // need the pairs vector: if (!rps.empty()) { RealType smallestDiff = HONKING_LARGE_VALUE; - RealType diff; - pair bestPair = make_pair(1.0, 1.0); - vector >::iterator rpi; + RealType diff(0.0); + std::pair bestPair = std::make_pair(1.0, 1.0); + std::vector >::iterator rpi; for (rpi = rps.begin(); rpi != rps.end(); ++rpi) { r1 = (*rpi).first; r2 = (*rpi).second; @@ -1436,7 +1471,6 @@ namespace OpenMD { int selej; Snapshot* currentSnap_ = info_->getSnapshotManager()->getCurrentSnapshot(); - RealType time = currentSnap_->getTime(); Mat3x3d hmat = currentSnap_->getHmat(); StuntDouble* sd; @@ -1743,7 +1777,6 @@ namespace OpenMD { areaA = evaluatorA_.getSurfaceArea(); else { - cerr << "selection A did not have surface area, recomputing\n"; int isd; StuntDouble* sd; vector aSites; @@ -1781,10 +1814,9 @@ namespace OpenMD { } if (hasSelectionB_) { - if (evaluatorB_.hasSurfaceArea()) + if (evaluatorB_.hasSurfaceArea()) { areaB = evaluatorB_.getSurfaceArea(); - else { - cerr << "selection B did not have surface area, recomputing\n"; + } else { int isd; StuntDouble* sd; @@ -1875,7 +1907,7 @@ namespace OpenMD { void RNEMD::collectData() { if (!doRNEMD_) return; Snapshot* currentSnap_ = info_->getSnapshotManager()->getCurrentSnapshot(); - + // collectData can be called more frequently than the doRNEMD, so use the // computed area from the last exchange time: RealType area = getDividingArea(); @@ -1990,7 +2022,7 @@ namespace OpenMD { } } } - + #ifdef IS_MPI for (int i = 0; i < nBins_; i++) { @@ -2097,7 +2129,7 @@ namespace OpenMD { painCave.severity = OPENMD_ERROR; simError(); } - } + } } void RNEMD::writeOutputFile() { @@ -2239,7 +2271,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 +2280,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 +2353,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 +2363,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 +2376,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 +2386,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]) ) {