Ejemplo n.º 1
0
// =========================================================================
   Pruning_table_ms_xx::
   Pruning_table_ms_xx(Transform_table *tr, Turn_table *tn, int e1):
   e1(e1)
// -------------------------------------------------------------------------
{
  int n, d, mx = 0;
  int ms, t;
  unsigned int sm = 0;
  Pack_mse pms(e1);
  int Nms = pms.len();
  int Sms = pms.startlen();

  for (ms = 0; ms < Nms; ms++)
    a[ms] = BIG;

  for (t = 0; t < A_N_TW; t++)
    if (mx < tn->a_len(t))
      mx = tn->a_len(t);

  fprintf(stderr, "\n - middle slice edge positions (phase 1, %i goal/s):\n", Sms);

  for (ms = 0; ms < Sms; ms++)
    a[pms.start(ms)] = 0;
  d = 0;
  n = Sms;
  while (n) {
    fprintf(stderr,"   %2i %8i %10u\n", d, n, sm += n);
    n = 0;
    d++;
    for (ms = 0; ms < Nms; ms++) {
      if (d <= a[ms] || d > a[ms] + mx)
        continue;
      for (t = 0; t < A_N_TW; t++) {
        if (d == a[ms] + tn->a_len(t)) {
          int nms = tr->se->a_do_m_tw(t, ms);
          if (a[nms] > d) {
            a[nms] = d;
            n++;
          }
        }
      }
    }
  }
}
Ejemplo n.º 2
0
  bool TrialDMCCorrection::putSpecial(xmlNodePtr cur, QMCHamiltonian& h, ParticleSet& P ) 
  {
    FirstHamiltonian = h.startIndex();
    nObservables=0;
    nValues=0;
    resum=100000;
    int blockSeries(0);
    int blockFreq(0);
    
    OhmmsAttributeSet attrib;
    attrib.add(resum,"resum");
    attrib.add(blockSeries,"max");
    attrib.add(blockFreq,"frequency");
    attrib.put(cur);
    //       app_log()<<"  Forward walking block size is "<< blockT<<"*Tau"<<endl;
    //       P.phLength=0;
    bool FIRST=true;
    CountIndex = P.addPropertyHistory(1);
    P.PropertyHistory[CountIndex][0]=0;
    xmlNodePtr tcur = cur->children;
    while(tcur != NULL) {
      string cname((const char*)tcur->name);
      //         app_log()<<cname<<endl;
      if(cname == "Observable") 
      {
        string tagName("none");
        int Hindex(-100);
//         int blockSeries(0);
//         int blockFreq(0);
        OhmmsAttributeSet Tattrib;
        Tattrib.add(tagName,"name");
//         Tattrib.add(blockSeries,"max");
//         Tattrib.add(blockFreq,"frequency");
        Tattrib.put(tcur);

        int numProps = P.PropertyList.Names.size();
        // 	  Hindex = P.PropertyList.add(tagName);
        Hindex = h.getObservable(tagName)+NUMPROPERTIES;
        if(tagName=="LocalPotential") {
          Hindex=LOCALPOTENTIAL ;
          tagName="LocPot";
        } else if (Hindex==(NUMPROPERTIES-1)){
          app_log()<<"Not a valid H element("<<Hindex<<") Valid names are:";
          for (int jk=0;jk<h.sizeOfObservables();jk++) app_log()<<"  "<<h.getObservableName(jk);
          app_log()<<endl;
          exit(-1);
        }
        /*
           if ((Hindex==-100)){
           app_log()<<" Hamiltonian Element "<<tagName<<" does not exist!! "<<Hindex<<endl;
           assert(Hindex>=0);
           }*/
        Names.push_back(tagName);
        Hindices.push_back( Hindex);
        app_log()<<" Hamiltonian Element "<<tagName<<" was found at "<< Hindex<<endl;

        int numT=blockSeries/blockFreq ;
        nObservables+=1;
        nValues+=numT;

        app_log()<<"   "<<numT<<" values will be calculated every "<<blockFreq<<"*tau H^-1"<<endl;
        vector<int> pms(3);
        pms[0]=blockFreq;
        pms[1]=numT;
        pms[2]=blockSeries+2;
        walkerLengths.push_back(pms);

        int maxWsize=blockSeries+2;
        int pindx = P.addPropertyHistory(maxWsize);
        // summed values.
        P.addPropertyHistory(numT);
        // number of times accumulated. For resum
        
        Pindices.push_back(pindx);
//         app_log()<<"pindex "<<pindx<<endl;

      }
      tcur = tcur->next;
    }
    app_log()<<"Total number of observables calculated:"<<nObservables<<endl;
    app_log()<<"Total number of values calculated:"<<nValues<<endl;
    Values.resize(nValues,0.0);
    EValues.resize(nValues,0.0);
    FWValues.resize(nValues,0.0);
    return true;
  }
Ejemplo n.º 3
0
  bool ForwardWalking::putSpecial(xmlNodePtr cur, QMCHamiltonian& h, ParticleSet& P)
  {
    FirstHamiltonian = h.startIndex();
    nObservables=0;
    nValues=0;
    blockT=1;
    //       OhmmsAttributeSet attrib;
    //       attrib.add(blockT,"blockSize");
    //       attrib.put(cur);
    xmlNodePtr tcur = cur->children;
    while(tcur != NULL) {
      string cname((const char*)tcur->name);
      if(cname == "Observable") 
      {
        string tagName("none");
        int Hindex(-100);
        int blockSeries(0);
        int blockFreq(0);
        OhmmsAttributeSet Tattrib;
        Tattrib.add(tagName,"name");
        Tattrib.add(blockSeries,"max");
        Tattrib.add(blockFreq,"frequency");
        Tattrib.put(tcur);

        if (tagName.find("*")==string::npos)
        {
          //Single Observable case
          int numProps = P.PropertyList.Names.size();
          Hindex = h.getObservable(tagName)+NUMPROPERTIES;
          if(tagName=="LocalPotential") {
            Hindex=LOCALPOTENTIAL ;
            tagName="LocPot";
          }
          else if(tagName=="LocalEnergy") {
            Hindex=LOCALENERGY ;
            tagName="LocEn";
          }	  
          else if (Hindex==(NUMPROPERTIES-1)){
            app_log()<<"Not a valid H element("<<Hindex<<") Valid names are:";
            for (int jk=0;jk<h.sizeOfObservables();jk++) app_log()<<"  "<<h.getObservableName(jk);
            app_log()<<endl;
            exit(-1);
          }

          Names.push_back(tagName);
          Hindices.push_back( Hindex);
          app_log()<<" Hamiltonian Element "<<tagName<<" was found at "<< Hindex<<endl;

          int numT=blockSeries/blockFreq ;
          nObservables+=1;
          nValues+=numT;

          app_log()<<"   "<<numT<<" values will be calculated every "<<blockFreq<<"*tau H^-1"<<endl;
          vector<int> pms(3);
          pms[0]=blockFreq;
          pms[1]=numT;
          pms[2]=blockSeries+2;
          walkerLengths.push_back(pms);

          int maxWsize=blockSeries+2;
          int pindx = P.addPropertyHistory(maxWsize);
          // summed values.
          //         P.addPropertyHistory(numT);

          Pindices.push_back(pindx);

        }
        else
        {
          bool FOUNDH(false);
          // 	    Multiple observables for this tag
          int found=tagName.rfind("*");
          tagName.replace (found,1,"");

          int numProps = P.PropertyList.Names.size();
          for(int j=0;j<h.sizeOfObservables();j++)
          {
            string Hname = h.getObservableName(j);
            if (Hname.find(tagName) != string::npos)
            {
              //               vector<int> Parameters;
              //               if(blockSeries==0) 
              //                 putContent(Parameters,tcur);
              //               else
              //                 for( int pl=blockFreq;pl<=blockSeries;pl+=blockFreq) Parameters.push_back(pl);
              FOUNDH=true;
              app_log()<<" Hamiltonian Element "<<Hname<<" was found at "<< j<<endl;
              Names.push_back(Hname);
              Hindex = j+NUMPROPERTIES;
              Hindices.push_back( Hindex);
              int numT=blockSeries/blockFreq ;
              nObservables+=1;
              nValues+=numT;

              app_log()<<"   "<<numT<<" values will be calculated every "<<blockFreq<<"*tau H^-1"<<endl;
              vector<int> pms(3);
              pms[0]=blockFreq;
              pms[1]=numT;
              pms[2]=blockSeries+2;
              walkerLengths.push_back(pms);

              int maxWsize=blockSeries+2;
              int pindx = P.addPropertyHistory(maxWsize);
              Pindices.push_back(pindx);
            }
          }

          //handle FOUNDH
          if (FOUNDH)
          {
            nObservables+=1;
          }
          else
          {
            app_log()<<"Not a valid H element("<<Hindex<<") Valid names are:";
            for (int jk=0;jk<h.sizeOfObservables();jk++) app_log()<<"  "<<h.getObservableName(jk);
            app_log()<<endl;
            APP_ABORT("ForwardWalking::put");
          }
        }
      }
      tcur = tcur->next;
    }
    app_log()<<"Total number of observables calculated:"<<nObservables<<endl;
    app_log()<<"Total number of values calculated:"<<nValues<<endl;
    Values.resize(nValues);

    return true;
  }