ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/rnemd/RNEMD.cpp
(Generate patch)

Comparing trunk/src/rnemd/RNEMD.cpp (file contents):
Revision 1969 by gezelter, Wed Feb 26 14:14:50 2014 UTC vs.
Revision 2026 by gezelter, Wed Oct 22 12:23:59 2014 UTC

# Line 291 | Line 291 | namespace OpenMD {
291        kineticFlux_ = 0.0;
292      }
293      if (hasMomentumFluxVector) {
294 <      momentumFluxVector_ = rnemdParams->getMomentumFluxVector();
294 >      std::vector<RealType> mf = rnemdParams->getMomentumFluxVector();
295 >      if (mf.size() != 3) {
296 >          sprintf(painCave.errMsg,
297 >                  "RNEMD: Incorrect number of parameters specified for momentumFluxVector.\n"
298 >                  "\tthere should be 3 parameters, but %lu were specified.\n",
299 >                  mf.size());
300 >          painCave.isFatal = 1;
301 >          simError();      
302 >      }
303 >      momentumFluxVector_.x() = mf[0];
304 >      momentumFluxVector_.y() = mf[1];
305 >      momentumFluxVector_.z() = mf[2];
306      } else {
307        momentumFluxVector_ = V3Zero;
308        if (hasMomentumFlux) {
# Line 317 | Line 328 | namespace OpenMD {
328          }
329        }
330        if (hasAngularMomentumFluxVector) {
331 <        angularMomentumFluxVector_ = rnemdParams->getAngularMomentumFluxVector();
331 >        std::vector<RealType> amf = rnemdParams->getAngularMomentumFluxVector();
332 >        if (amf.size() != 3) {
333 >          sprintf(painCave.errMsg,
334 >                  "RNEMD: Incorrect number of parameters specified for angularMomentumFluxVector.\n"
335 >                  "\tthere should be 3 parameters, but %lu were specified.\n",
336 >                  amf.size());
337 >          painCave.isFatal = 1;
338 >          simError();      
339 >        }
340 >        angularMomentumFluxVector_.x() = amf[0];
341 >        angularMomentumFluxVector_.y() = amf[1];
342 >        angularMomentumFluxVector_.z() = amf[2];
343        } else {
344          angularMomentumFluxVector_ = V3Zero;
345          if (hasAngularMomentumFlux) {
# Line 348 | Line 370 | namespace OpenMD {
370        }
371  
372        if (hasCoordinateOrigin) {
373 <        coordinateOrigin_ = rnemdParams->getCoordinateOrigin();
373 >        std::vector<RealType> co = rnemdParams->getCoordinateOrigin();
374 >        if (co.size() != 3) {
375 >          sprintf(painCave.errMsg,
376 >                  "RNEMD: Incorrect number of parameters specified for coordinateOrigin.\n"
377 >                  "\tthere should be 3 parameters, but %lu were specified.\n",
378 >                  co.size());
379 >          painCave.isFatal = 1;
380 >          simError();      
381 >        }
382 >        coordinateOrigin_.x() = co[0];
383 >        coordinateOrigin_.y() = co[1];
384 >        coordinateOrigin_.z() = co[2];
385        } else {
386          coordinateOrigin_ = V3Zero;
387        }
# Line 623 | Line 656 | namespace OpenMD {
656      StuntDouble* sd;
657  
658      RealType min_val;
659 <    bool min_found = false;  
659 >    int min_found = 0;  
660      StuntDouble* min_sd;
661  
662      RealType max_val;
663 <    bool max_found = false;
663 >    int max_found = 0;
664      StuntDouble* max_sd;
665  
666      for (sd = seleManA_.beginSelected(selei); sd != NULL;
# Line 682 | Line 715 | namespace OpenMD {
715        if (!max_found) {
716          max_val = value;
717          max_sd = sd;
718 <        max_found = true;
718 >        max_found = 1;
719        } else {
720          if (max_val < value) {
721            max_val = value;
# Line 744 | Line 777 | namespace OpenMD {
777        if (!min_found) {
778          min_val = value;
779          min_sd = sd;
780 <        min_found = true;
780 >        min_found = 1;
781        } else {
782          if (min_val > value) {
783            min_val = value;
# Line 857 | Line 890 | namespace OpenMD {
890            
891            Vector3d min_vel;
892            Vector3d max_vel = max_sd->getVel();
893 <          MPI_Status* status;
893 >          MPI_Status status;
894  
895            // point-to-point swap of the velocity vector
896            MPI_Sendrecv(max_vel.getArrayPointer(), 3, MPI_REALTYPE,
897                         min_vals.rank, 0,
898                         min_vel.getArrayPointer(), 3, MPI_REALTYPE,
899 <                       min_vals.rank, 0, MPI_COMM_WORLD, status);
899 >                       min_vals.rank, 0, MPI_COMM_WORLD, &status);
900            
901            switch(rnemdFluxType_) {
902            case rnemdKE :
# Line 878 | Line 911 | namespace OpenMD {
911                             MPI_REALTYPE, min_vals.rank, 1,
912                             min_angMom.getArrayPointer(), 3,
913                             MPI_REALTYPE, min_vals.rank, 1,
914 <                           MPI_COMM_WORLD, status);
914 >                           MPI_COMM_WORLD, &status);
915                
916                max_sd->setJ(min_angMom);
917              }
# Line 903 | Line 936 | namespace OpenMD {
936            
937            Vector3d max_vel;
938            Vector3d min_vel = min_sd->getVel();
939 <          MPI_Status* status;
939 >          MPI_Status status;
940            
941            // point-to-point swap of the velocity vector
942            MPI_Sendrecv(min_vel.getArrayPointer(), 3, MPI_REALTYPE,
943                         max_vals.rank, 0,
944                         max_vel.getArrayPointer(), 3, MPI_REALTYPE,
945 <                       max_vals.rank, 0, MPI_COMM_WORLD, status);
945 >                       max_vals.rank, 0, MPI_COMM_WORLD, &status);
946            
947            switch(rnemdFluxType_) {
948            case rnemdKE :
# Line 924 | Line 957 | namespace OpenMD {
957                             MPI_REALTYPE, max_vals.rank, 1,
958                             max_angMom.getArrayPointer(), 3,
959                             MPI_REALTYPE, max_vals.rank, 1,
960 <                           MPI_COMM_WORLD, status);
960 >                           MPI_COMM_WORLD, &status);
961                
962                min_sd->setJ(max_angMom);
963              }
# Line 1755 | Line 1788 | namespace OpenMD {
1788   #if defined(HAVE_QHULL)
1789          ConvexHull* surfaceMeshA = new ConvexHull();
1790          surfaceMeshA->computeHull(aSites);
1791 +        cerr << "flag1\n";
1792          areaA = surfaceMeshA->getArea();
1793 +        cerr << "Flag2 " << areaA << "\n";
1794          delete surfaceMeshA;
1795   #else
1796          sprintf( painCave.errMsg,
# Line 1999 | Line 2034 | namespace OpenMD {
2034                      1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
2035        MPI_Allreduce(MPI_IN_PLACE, &binMass[i],
2036                      1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
2037 <      MPI_Allreduce(MPI_IN_PLACE, &binP[i],
2037 >      MPI_Allreduce(MPI_IN_PLACE, binP[i].getArrayPointer(),
2038                      3, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
2039 <      MPI_Allreduce(MPI_IN_PLACE, &binL[i],
2039 >      MPI_Allreduce(MPI_IN_PLACE, binL[i].getArrayPointer(),
2040                      3, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
2041 <      MPI_Allreduce(MPI_IN_PLACE, &binI[i],
2041 >      MPI_Allreduce(MPI_IN_PLACE, binI[i].getArrayPointer(),
2042                      9, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
2043        MPI_Allreduce(MPI_IN_PLACE, &binKE[i],
2044                      1, MPI_REALTYPE, MPI_SUM, MPI_COMM_WORLD);
# Line 2239 | Line 2274 | namespace OpenMD {
2274        }        
2275  
2276        rnemdFile_ << "#######################################################\n";
2277 <      rnemdFile_ << "# Standard Deviations in those quantities follow:\n";
2277 >      rnemdFile_ << "# 95% confidence intervals in those quantities follow:\n";
2278        rnemdFile_ << "#######################################################\n";
2279  
2280  
# Line 2248 | Line 2283 | namespace OpenMD {
2283          for (unsigned int i = 0; i < outputMask_.size(); ++i) {
2284            if (outputMask_[i]) {
2285              if (data_[i].dataType == "RealType")
2286 <              writeRealStdDev(i,j);
2286 >              writeRealErrorBars(i,j);
2287              else if (data_[i].dataType == "Vector3d")
2288 <              writeVectorStdDev(i,j);
2288 >              writeVectorErrorBars(i,j);
2289              else {
2290                sprintf( painCave.errMsg,
2291                         "RNEMD found an unknown data type for: %s ",
# Line 2321 | Line 2356 | namespace OpenMD {
2356      }
2357    }  
2358  
2359 <  void RNEMD::writeRealStdDev(int index, unsigned int bin) {
2359 >  void RNEMD::writeRealErrorBars(int index, unsigned int bin) {
2360      if (!doRNEMD_) return;
2361      assert(index >=0 && index < ENDINDEX);
2362      assert(int(bin) < nBins_);
# Line 2331 | Line 2366 | namespace OpenMD {
2366      count = data_[index].accumulator[bin]->count();
2367      if (count == 0) return;
2368      
2369 <    dynamic_cast<Accumulator *>(data_[index].accumulator[bin])->getStdDev(s);
2369 >    dynamic_cast<Accumulator *>(data_[index].accumulator[bin])->get95percentConfidenceInterval(s);
2370      
2371      if (! isinf(s) && ! isnan(s)) {
2372        rnemdFile_ << "\t" << s;
# Line 2344 | Line 2379 | namespace OpenMD {
2379      }    
2380    }
2381    
2382 <  void RNEMD::writeVectorStdDev(int index, unsigned int bin) {
2382 >  void RNEMD::writeVectorErrorBars(int index, unsigned int bin) {
2383      if (!doRNEMD_) return;
2384      assert(index >=0 && index < ENDINDEX);
2385      assert(int(bin) < nBins_);
# Line 2354 | Line 2389 | namespace OpenMD {
2389      count = data_[index].accumulator[bin]->count();
2390      if (count == 0) return;
2391  
2392 <    dynamic_cast<VectorAccumulator*>(data_[index].accumulator[bin])->getStdDev(s);
2392 >    dynamic_cast<VectorAccumulator*>(data_[index].accumulator[bin])->get95percentConfidenceInterval(s);
2393      if (isinf(s[0]) || isnan(s[0]) ||
2394          isinf(s[1]) || isnan(s[1]) ||
2395          isinf(s[2]) || isnan(s[2]) ) {      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines