/** constructor
   * @param h QMCHamiltonian to define the components
   * @param hcopy number of copies of QMCHamiltonians
   */
  CSPolymerEstimator::CSPolymerEstimator(QMCHamiltonian& h, int hcopy, 
      MultiChain* polymer)
//   : Reptile(polymer)
  {
    Reptile = polymer;
    NumCopies=hcopy;
    NumObservables = h.size();
    scalars.resize(NumCopies+NumCopies*(NumCopies-1)/2);
    scalars_saved=scalars;
    //d_data.resize(NumCopies*3+NumCopies*(NumCopies-1)/2);
  }
 LocalEnergyEstimator::LocalEnergyEstimator(QMCHamiltonian& h):Href(h) { 
   int hterms(h.size());
   SizeOfHamiltonians = hterms;
   FirstHamiltonian = h.startIndex();
   elocal.resize(SizeOfHamiltonians+LE_MAX);
   elocal_name.resize(SizeOfHamiltonians+LE_MAX);
   elocal_name[ENERGY_INDEX] = "LocalEnergy";
   elocal_name[ENERGY_SQ_INDEX] = "Variance";
   elocal_name[POTENTIAL_INDEX] = "LocalPotential";
   int ii(LE_MAX);
   for(int i=0; i < SizeOfHamiltonians; i++) elocal_name[ii++] = h.getName(i);
 }
Example #3
0
  /** This should be moved to branch engine */
  bool EstimatorManager::put(MCWalkerConfiguration& W, QMCHamiltonian& H, xmlNodePtr cur) 
  {
    vector<string> extra;
    cur = cur->children;
    while(cur != NULL) 
    {
      string cname((const char*)(cur->name));
      if(cname == "estimator") 
      {
        string est_name(MainEstimatorName);
        string use_hdf5("yes");
        OhmmsAttributeSet hAttrib;
        hAttrib.add(est_name, "name");
        hAttrib.add(use_hdf5, "hdf5");
        hAttrib.put(cur);
        if( (est_name == MainEstimatorName) || (est_name=="elocal") )
        {
          if(use_hdf5 == "yes")
          {
            max4ascii=H.size()+3;//write only physical energies
            add(new LocalEnergyEstimatorHDF(H),MainEstimatorName);
          }
          else
          {//fall back to the ascii file
            max4ascii=H.sizeOfObservables()+3;
            add(new LocalEnergyEstimator(H),MainEstimatorName);
          }
        }
        else if (est_name=="WFMConly")
        {
          max4ascii=H.sizeOfObservables()+10;
          app_log() << "  Using WFMConly for the MainEstimator " << endl;
          add(new WFMCOnlyEstimator(H),MainEstimatorName);
          est_name=MainEstimatorName;
        }
        else if (est_name=="releasednode")
        { 
          int Smax(100);
          int primary(1);
          OhmmsAttributeSet hAttrib;
          hAttrib.add(Smax, "Smax");
          hAttrib.add(primary, "primary");
          hAttrib.put(cur);
        
          max4ascii=H.sizeOfObservables()+ 4 + 3*(Smax+1);
          app_log() << "  Using ReleasedNode for the MainEstimator with Smax="<<Smax<<" and max4ascii="<<max4ascii << endl;
          if (primary==2) add(new ReleasedNodeEnergyEstimator(H,Smax),MainEstimatorName);
          else add(new AlternateReleasedNodeEnergyEstimator(H,Smax),MainEstimatorName);
          est_name=MainEstimatorName;
        }
        else if (est_name=="forwardwalking")
        {
          max4ascii=2*H.sizeOfObservables()+4;
          app_log() << "  Doing forwardwalking on hdf5 " << endl;
          add(new ForwardWalkingEstimator(H),MainEstimatorName);
          est_name=MainEstimatorName;
        }        else 
          extra.push_back(est_name);
      } 
      cur = cur->next;
    }

    if(Estimators.empty()) 
    {
      app_log() << "  Adding a default LocalEnergyEstimator for the MainEstimator " << endl;
      max4ascii=H.sizeOfObservables()+3;
      add(new LocalEnergyEstimator(H),MainEstimatorName);
      //add(new LocalEnergyOnlyEstimator(),MainEstimatorName);
    } 

    if(Collectables == 0 && H.sizeOfCollectables())
    {
      app_log() << "  Using CollectablesEstimator for collectables, e.g. sk, gofr, density " << endl;
      Collectables=new CollectablesEstimator(H);
      add(Collectables,"collectables");
    }
    return true;
  }