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

Comparing:
trunk/src/integrators/RNEMD.cpp (file contents), Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
branches/development/src/integrators/RNEMD.cpp (file contents), Revision 1465 by chuckv, Fri Jul 9 23:08:25 2010 UTC

# Line 154 | Line 154 | namespace OpenMD {
154      midBin_ = nBins_ / 2;
155      if (simParams->haveRNEMD_logWidth()) {
156        rnemdLogWidth_ = simParams->getRNEMD_logWidth();
157 <      if (rnemdLogWidth_ != nBins_ || rnemdLogWidth_ != midBin_ + 1) {
157 >      if (rnemdLogWidth_ != nBins_ && rnemdLogWidth_ != midBin_ + 1) {
158          std::cerr << "WARNING! RNEMD_logWidth has abnormal value!\n";
159          std::cerr << "Automaically set back to default.\n";
160          rnemdLogWidth_ = nBins_;
# Line 194 | Line 194 | namespace OpenMD {
194    
195    RNEMD::~RNEMD() {
196      delete randNumGen_;
197 <
198 <    std::cerr << "total fail trials: " << failTrialCount_ << "\n";
197 >    
198   #ifdef IS_MPI
199      if (worldRank == 0) {
200   #endif
201 +      std::cerr << "total fail trials: " << failTrialCount_ << "\n";
202        rnemdLog_.close();
203        if (rnemdType_ == rnemdKineticScale || rnemdType_ == rnemdPxScale || rnemdType_ == rnemdPyScale)
204          std::cerr<< "total root-checking warnings: " << failRootCount_ << "\n";
# Line 642 | Line 642 | namespace OpenMD {
642        a001 = Kcx * px * px;
643      */
644  
645 <      //scale all three dimensions, let x = y
645 >      //scale all three dimensions, let c_x = c_y
646        a000 = Kcx + Kcy;
647        a110 = Kcz;
648        c0 = targetFlux_ - Kcx - Kcy - Kcz;
# Line 678 | Line 678 | namespace OpenMD {
678           + Khy * (fastpow(c * py - py - 1.0, 2) - 1.0);
679        break;
680      case rnemdPzScale ://we don't really do this, do we?
681 +      c = 1 - targetFlux_ / Pcz;
682 +      a000 = Kcx;
683 +      a110 = Kcy;
684 +      c0 = Kcz * c * c - Kcx - Kcy - Kcz;
685 +      a001 = px * px * Khx;
686 +      a111 = py * py * Khy;
687 +      b01 = -2.0 * Khx * px * (1.0 + px);
688 +      b11 = -2.0 * Khy * py * (1.0 + py);
689 +      c1 = Khx * px * (2.0 + px) + Khy * py * (2.0 + py)
690 +        + Khz * (fastpow(c * pz - pz - 1.0, 2) - 1.0);
691 +      break;      
692      default :
693        break;
694      }
# Line 721 | Line 732 | namespace OpenMD {
732        r2 = *ri;
733        //check if FindRealRoots() give the right answer
734        if ( fabs(u0 + r2 * (u1 + r2 * (u2 + r2 * (u3 + r2 * u4)))) > 1e-6 ) {
735 <        std::cerr << "WARNING! eq solvers might have mistakes!\n";
735 >        sprintf(painCave.errMsg,
736 >                "RNEMD Warning: polynomial solve seems to have an error!");
737 >        painCave.isFatal = 0;
738 >        simError();
739          failRootCount_++;
740        }
741        //might not be useful w/o rescaling coefficients
# Line 797 | Line 811 | namespace OpenMD {
811            z = bestPair.second;
812            break;
813          case rnemdPzScale :
814 +          x = bestPair.first;
815 +          y = bestPair.second;
816 +          z = c;
817 +          break;          
818          default :
819            break;
820          }
# Line 823 | Line 841 | namespace OpenMD {
841        exchangeSum_ += targetFlux_;
842        //we may want to check whether the exchange has been successful
843      } else {
844 <      std::cerr << "exchange NOT performed!\n";
844 >      std::cerr << "exchange NOT performed!\n";//MPI incompatible
845        failTrialCount_++;
846      }
847  
# Line 965 | Line 983 | namespace OpenMD {
983  
984      stat[Stats::RNEMD_EXCHANGE_TOTAL] = exchangeSum_;
985      //or to be more meaningful, define another item as exchangeSum_ / time
986 +    int j;
987  
969
988   #ifdef IS_MPI
989  
990      // all processors have the same number of bins, and STL vectors pack their
# Line 976 | Line 994 | namespace OpenMD {
994                                rnemdLogWidth_, MPI::REALTYPE, MPI::SUM);
995      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &valueCount_[0],
996                                rnemdLogWidth_, MPI::INT, MPI::SUM);
997 <
997 >    if (rnemdType_ == rnemdPx || rnemdType_ == rnemdPxScale) {
998 >      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &xTempHist_[0],
999 >                                rnemdLogWidth_, MPI::REALTYPE, MPI::SUM);
1000 >      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &yTempHist_[0],
1001 >                                rnemdLogWidth_, MPI::REALTYPE, MPI::SUM);
1002 >      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &zTempHist_[0],
1003 >                                rnemdLogWidth_, MPI::REALTYPE, MPI::SUM);
1004 >    }
1005      // If we're the root node, should we print out the results
1006      int worldRank = MPI::COMM_WORLD.Get_rank();
1007      if (worldRank == 0) {
1008   #endif
984      int j;
1009        rnemdLog_ << time;
1010        for (j = 0; j < rnemdLogWidth_; j++) {
1011          rnemdLog_ << "\t" << valueHist_[j] / (RealType)valueCount_[j];
988        valueHist_[j] = 0.0;
1012        }
1013        rnemdLog_ << "\n";
1014        if (rnemdType_ == rnemdPx || rnemdType_ == rnemdPxScale ) {
1015          xTempLog_ << time;      
1016          for (j = 0; j < rnemdLogWidth_; j++) {
1017            xTempLog_ << "\t" << xTempHist_[j] / (RealType)valueCount_[j];
995          xTempHist_[j] = 0.0;
1018          }
1019          xTempLog_ << "\n";
1020          yTempLog_ << time;
1021          for (j = 0; j < rnemdLogWidth_; j++) {
1022            yTempLog_ << "\t" << yTempHist_[j] / (RealType)valueCount_[j];
1001          yTempHist_[j] = 0.0;
1023          }
1024          yTempLog_ << "\n";
1025          zTempLog_ << time;
1026          for (j = 0; j < rnemdLogWidth_; j++) {
1027            zTempLog_ << "\t" << zTempHist_[j] / (RealType)valueCount_[j];
1007          zTempHist_[j] = 0.0;
1028          }
1029          zTempLog_ << "\n";
1030        }
1011      for (j = 0; j < rnemdLogWidth_; j++) valueCount_[j] = 0;
1031   #ifdef IS_MPI
1032 <    }    
1032 >    }
1033   #endif
1034 <
1035 <      
1034 >    for (j = 0; j < rnemdLogWidth_; j++) {
1035 >      valueCount_[j] = 0;
1036 >      valueHist_[j] = 0.0;
1037 >    }
1038 >    if (rnemdType_ == rnemdPx || rnemdType_ == rnemdPxScale)
1039 >      for (j = 0; j < rnemdLogWidth_; j++) {
1040 >        xTempHist_[j] = 0.0;
1041 >        yTempHist_[j] = 0.0;
1042 >        zTempHist_[j] = 0.0;
1043 >      }
1044    }
1018
1045   }

Comparing:
trunk/src/integrators/RNEMD.cpp (property svn:keywords), Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
branches/development/src/integrators/RNEMD.cpp (property svn:keywords), Revision 1465 by chuckv, Fri Jul 9 23:08:25 2010 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines