--- trunk/src/rnemd/RNEMD.cpp 2012/08/22 02:28:28 1782 +++ trunk/src/rnemd/RNEMD.cpp 2012/08/31 21:16:10 1793 @@ -53,6 +53,11 @@ #include #endif +#ifdef _MSC_VER +#define isnan(x) _isnan((x)) +#define isinf(x) (!_finite(x) && !_isnan(x)) +#endif + #define HONKING_LARGE_VALUE 1.0e10 using namespace std; @@ -65,7 +70,6 @@ namespace OpenMD { failTrialCount_ = 0; failRootCount_ = 0; - int seedValue; Globals * simParams = info->getSimParams(); RNEMDParameters* rnemdParams = simParams->getRNEMDParameters(); @@ -305,7 +309,7 @@ namespace OpenMD { z.title = "Z"; z.dataType = "RealType"; z.accumulator.reserve(nBins_); - for (unsigned int i = 0; i < nBins_; i++) + for (int i = 0; i < nBins_; i++) z.accumulator.push_back( new Accumulator() ); data_[Z] = z; outputMap_["Z"] = Z; @@ -315,7 +319,7 @@ namespace OpenMD { temperature.title = "Temperature"; temperature.dataType = "RealType"; temperature.accumulator.reserve(nBins_); - for (unsigned int i = 0; i < nBins_; i++) + for (int i = 0; i < nBins_; i++) temperature.accumulator.push_back( new Accumulator() ); data_[TEMPERATURE] = temperature; outputMap_["TEMPERATURE"] = TEMPERATURE; @@ -325,7 +329,7 @@ namespace OpenMD { velocity.title = "Velocity"; velocity.dataType = "Vector3d"; velocity.accumulator.reserve(nBins_); - for (unsigned int i = 0; i < nBins_; i++) + for (int i = 0; i < nBins_; i++) velocity.accumulator.push_back( new VectorAccumulator() ); data_[VELOCITY] = velocity; outputMap_["VELOCITY"] = VELOCITY; @@ -335,7 +339,7 @@ namespace OpenMD { density.title = "Density"; density.dataType = "RealType"; density.accumulator.reserve(nBins_); - for (unsigned int i = 0; i < nBins_; i++) + for (int i = 0; i < nBins_; i++) density.accumulator.push_back( new Accumulator() ); data_[DENSITY] = density; outputMap_["DENSITY"] = DENSITY; @@ -447,7 +451,6 @@ namespace OpenMD { int selei; StuntDouble* sd; - int idx; RealType min_val; bool min_found = false; @@ -460,8 +463,6 @@ namespace OpenMD { for (sd = seleMan_.beginSelected(selei); sd != NULL; sd = seleMan_.nextSelected(selei)) { - idx = sd->getLocalIndex(); - Vector3d pos = sd->getPos(); // wrap the stuntdouble's position back into the box: @@ -539,12 +540,9 @@ namespace OpenMD { } } -#ifdef IS_MPI - int nProc, worldRank; +#ifdef IS_MPI + int worldRank = MPI::COMM_WORLD.Get_rank(); - nProc = MPI::COMM_WORLD.Get_size(); - worldRank = MPI::COMM_WORLD.Get_rank(); - bool my_min_found = min_found; bool my_max_found = max_found; @@ -777,7 +775,6 @@ namespace OpenMD { int selei; StuntDouble* sd; - int idx; vector hotBin, coldBin; @@ -799,8 +796,6 @@ namespace OpenMD { for (sd = seleMan_.beginSelected(selei); sd != NULL; sd = seleMan_.nextSelected(selei)) { - idx = sd->getLocalIndex(); - Vector3d pos = sd->getPos(); // wrap the stuntdouble's position back into the box: @@ -1227,7 +1222,6 @@ namespace OpenMD { int selei; StuntDouble* sd; - int idx; vector hotBin, coldBin; @@ -1242,8 +1236,6 @@ namespace OpenMD { for (sd = seleMan_.beginSelected(selei); sd != NULL; sd = seleMan_.nextSelected(selei)) { - idx = sd->getLocalIndex(); - Vector3d pos = sd->getPos(); // wrap the stuntdouble's position back into the box: @@ -1425,7 +1417,6 @@ namespace OpenMD { int selei; StuntDouble* sd; - int idx; vector binMass(nBins_, 0.0); vector binPx(nBins_, 0.0); @@ -1450,10 +1441,8 @@ namespace OpenMD { sd = mol->nextIntegrableObject(iiter)) */ for (sd = seleMan_.beginSelected(selei); sd != NULL; - sd = seleMan_.nextSelected(selei)) { + sd = seleMan_.nextSelected(selei)) { - idx = sd->getLocalIndex(); - Vector3d pos = sd->getPos(); // wrap the stuntdouble's position back into the box: @@ -1537,16 +1526,16 @@ namespace OpenMD { if(outputMask_[j]) { switch(j) { case Z: - (data_[j].accumulator[i])->add(z); + dynamic_cast(data_[j].accumulator[i])->add(z); break; case TEMPERATURE: - data_[j].accumulator[i]->add(temp); + dynamic_cast(data_[j].accumulator[i])->add(temp); break; case VELOCITY: dynamic_cast(data_[j].accumulator[i])->add(vel); break; case DENSITY: - data_[j].accumulator[i]->add(den); + dynamic_cast(data_[j].accumulator[i])->add(den); break; } } @@ -1681,7 +1670,7 @@ namespace OpenMD { rnemdFile_.precision(8); - for (unsigned int j = 0; j < nBins_; j++) { + for (int j = 0; j < nBins_; j++) { for (unsigned int i = 0; i < outputMask_.size(); ++i) { if (outputMask_[i]) { @@ -1707,7 +1696,7 @@ namespace OpenMD { rnemdFile_ << "#######################################################\n"; - for (unsigned int j = 0; j < nBins_; j++) { + for (int j = 0; j < nBins_; j++) { rnemdFile_ << "#"; for (unsigned int i = 0; i < outputMask_.size(); ++i) { if (outputMask_[i]) { @@ -1743,7 +1732,7 @@ namespace OpenMD { assert(bin < nBins_); RealType s; - data_[index].accumulator[bin]->getAverage(s); + dynamic_cast(data_[index].accumulator[bin])->getAverage(s); if (! isinf(s) && ! isnan(s)) { rnemdFile_ << "\t" << s; @@ -1781,7 +1770,7 @@ namespace OpenMD { assert(bin < nBins_); RealType s; - data_[index].accumulator[bin]->getStdDev(s); + dynamic_cast(data_[index].accumulator[bin])->getStdDev(s); if (! isinf(s) && ! isnan(s)) { rnemdFile_ << "\t" << s;