当前位置: 首页>>代码示例>>C++>>正文


C++ QMCHamiltonian::getName方法代码示例

本文整理汇总了C++中QMCHamiltonian::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ QMCHamiltonian::getName方法的具体用法?C++ QMCHamiltonian::getName怎么用?C++ QMCHamiltonian::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMCHamiltonian的用法示例。


在下文中一共展示了QMCHamiltonian::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hterms

 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);
 }
开发者ID:digideskio,项目名称:qmcpack,代码行数:12,代码来源:LocalEnergyEstimator.cpp

示例2: clone

  void HamiltonianPool::clone(const MCWalkerConfiguration& qp, const TrialWaveFunction& psi, const QMCHamiltonian& h,
      vector<MCWalkerConfiguration*>& plist, 
      vector<TrialWaveFunction*>& olist, 
      vector<QMCHamiltonian*>& hlist) 
  {
    int np=omp_get_max_threads();
    {
      ReportEngine PRE("HamiltonianPool","clone");
      app_log() << "Number of threads = " << np << endl;
    }

    //temporarily turnoff stream buffer for the clones
    OhmmsInfo::Log->turnoff();
    OhmmsInfo::Warn->turnoff();

    //clone ParticleSet and TrialWaveFunction
    WaveFunctionFactory* psiFac=psiPool->getWaveFunctionFactory(psi.getName());
    psiFac->setCloneSize(np);

    //capture cloned WaveFunctionFactory*
    vector<WaveFunctionFactory*> otemp;
    otemp.resize(np,0);

    //allocate the data on each thread
//#pragma omp parallel 
//    {
//      int ip=omp_get_thread_num();
//#pragma omp critical 
//      {
//        if(ip) {
//          char pname[16],oname[16];
//          sprintf(pname,"%s.c%i",qp.getName().c_str(),ip);
//          plist[ip]=new MCWalkerConfiguration(qp);
//          plist[ip]->setName(pname);
//
//          sprintf(oname,"%s.c%i",psi.getName().c_str(),ip);
//          otemp[ip]= psiFac->clone(plist[ip],ip,oname);
//        }
//      }
//    }
//    
//    //add the Clones to the pools
//    for(int ip=1; ip<np; ip++) 
//    {
//      ptclPool->addParticleSet(plist[ip]);
//      psiPool->addFactory(otemp[ip]);
//      olist[ip]=otemp[ip]->targetPsi;
//      if(ip%2==1) olist[ip]->reverse();
//    }
//
    
    //add the Clones to the pools
    for(int ip=1; ip<np; ++ip) 
    {
      plist[ip]=new MCWalkerConfiguration(qp);

      char oname[16];
      sprintf(oname,"%s.c%i",psi.getName().c_str(),ip);
      // Don't recreate with a factory anymore
      //otemp[ip]= psiFac->clone(plist[ip],ip,oname);
      //ptclPool->addParticleSet(plist[ip]);
      //psiPool->addFactory(otemp[ip]);
      //olist[ip]=otemp[ip]->targetPsi;

      // Just clone the TrialWaveFunction.
      ptclPool->addParticleSet(plist[ip]);
      olist[ip]=psiFac->targetPsi->makeClone(*plist[ip]);
      olist[ip]->setName(oname);

      //need to add a WaveFunctionFactory so that Hamiltonian can use them
      otemp[ip]=new WaveFunctionFactory(*psiFac);//make a shallow copy
      otemp[ip]->setPsi(olist[ip]);
      psiPool->addFactory(otemp[ip]);
    }

    //find the HamiltonianFactory* to be cloned
    HamiltonianFactory* hFac=0;
    PoolType::iterator hit(myPool.find(h.getName()));
    if(hit == myPool.end()) {
      hFac=(*(myPool.begin())).second;
    } else {
      hFac=(*hit).second;
    }
    hFac->setCloneSize(np);

    vector<HamiltonianFactory*> htemp;
    htemp.resize(np,0);

//#pragma omp parallel 
//    {
//      int ip=omp_get_thread_num();
//#pragma omp critical 
//      {
//        if(ip) {
//          char hname[16];
//          sprintf(hname,"%s.c%i",h.getName().c_str(),ip);
//          htemp[ip]= hFac->clone(plist[ip],olist[ip],ip,hname);
//        }
//      }
//    }
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:qmcpack,代码行数:101,代码来源:HamiltonianPool.cpp


注:本文中的QMCHamiltonian::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。