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


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

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


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

示例1: makeClones

  void CloneManager::makeClones(MCWalkerConfiguration& w, 
      TrialWaveFunction& psi, QMCHamiltonian& ham)
  {

    if(wClones.size()) {
      app_log() << "  Cannot make clones again. Use existing " << NumThreads << " clones" << endl;
      return;
    }

    app_log() << "Number of threads = " << NumThreads << endl;
    wClones.resize(NumThreads,0);
    psiClones.resize(NumThreads,0);
    hClones.resize(NumThreads,0);

    wClones[0]=&w;
    psiClones[0]=&psi;
    hClones[0]=&ham;

#if defined(ENABLE_CLONE_PSI_AND_H)
    char pname[16];
    for(int ip=1; ip<NumThreads; ++ip) 
    {
      sprintf(pname,"%s.c%i",w.getName().c_str(),ip);
      wClones[ip]=new MCWalkerConfiguration(w);
      wClones[ip]->setName(pname);
      psiClones[ip]=psi.makeClone(*wClones[ip]);
      hClones[ip]=ham.makeClone(*wClones[ip],*psiClones[ip]);
    }
#else
    cloneEngine.clone(w,psi,ham,wClones,psiClones,hClones);
#endif
  }
开发者ID:digideskio,项目名称:qmcpack,代码行数:32,代码来源:CloneManager.cpp

示例2: main


//.........这里部分代码省略.........
    for(int iat=0; iat<Centers; iat++) {
        double sep=0.8*Cut[iat];
        for(int iel=0; iel<Core[iat]/2; iel++,ncore++) {
            el.R[ncore]=ion.R[iat]+sep*chi[ncore];
            el.R[ncore+ihalf]=ion.R[iat]+sep*chi[ncore+ihalf];
        }
    }

    int ipart = ncore;
    int isave_iat=0;

    for(int iat=0; iat<Centers; iat++) {
        for(int nn=d_ii->M[iat]; nn<d_ii->M[iat+1]; nn++) {
            double bondlength = d_ii->r(nn);
            int jat = d_ii->J[nn];
            //only assign if the half bond-length < cutoff
            if(bondlength < Cut[iat]+Cut[jat]) {
                if(ipart < ihalf) {
                    XMLReport("Assigning particles = " << ipart << " and " << ipart+ihalf)
                    /*place 2 electrons (an up and a down) at half
                      the bond-length plus a random number multiplied
                      by 10% of the bond-length*/
                    el.R[ipart] = ion.R[iat]+0.5*d_ii->dr(nn)+0.1*bondlength*chi[ipart];
                    el.R[ipart+ihalf] = ion.R[iat]+0.5*d_ii->dr(nn)+0.1*bondlength*chi[ipart+ihalf];
                    ipart++;
                    isave_iat = iat;
                }
            }
        }
    }

    //assign the last particle (if odd number of particles)
    int flag = 1;
    ipart = el.getTotalNum()-1;
    if(irem) {
        XMLReport("Assigning last particle.")
        for(int iat = isave_iat+1; iat<Centers; iat++) {
            for(int nn=d_ii->M[iat]; nn<d_ii->M[iat+1]; nn++) {
                double bondlength = d_ii->r(nn);
                if((0.5*bondlength < Cut[iat]) && flag) {
                    XMLReport("Assigning particle = " << ipart)
                    el.R[ipart] = ion.R[iat]+0.5*d_ii->dr(nn)+0.1*bondlength*chi[ipart];
                    flag = 0;
                }
            }
        }
    }

    cout << "Ionic configuration : " << ion.getName() << endl;
    ion.get(cout);

    cout << "Electronic configuration : " << el.getName() << endl;
    el.get(cout);

    string newxml(myProject.CurrentRoot());
    newxml.append(".ptcl.xml");
    ofstream ptcl_out(newxml.c_str());

    /*
      ofstream molmol("assign.xyz");

      molmol << Centers+el.getTotalNum() << endl;
      molmol << endl;

      for(int iat=0; iat<Centers; iat++)
      molmol << ion.Species.speciesName[ion.GroupID[iat]] << 0.5292*ion.R[iat] << endl;

      for(int ipart=0; ipart<el.getTotalNum(); ipart++)
      molmol << "He" << 0.5292*el.R[ipart] << endl;

      molmol.close();
    */

    xmlXPathFreeContext(m_context);
    xmlFreeDoc(m_doc);

    int nup = el.last(0);
    int ndown = el.last(1)-el.last(0);

    ptcl_out << "<?xml version=\"1.0\"?>" << endl;
    ptcl_out << "<particleset name=\"e\">" << endl;
    ptcl_out << "<group name=\"u\" size=\"" << nup << "\">" << endl;
    ptcl_out << "<parameter name=\"charge\">-1</parameter>" << endl;
    ptcl_out << "<attrib name=\"position\" datatype=\"posArray\">" << endl;
    for (int ipart=0; ipart<nup; ++ipart)
        ptcl_out << el.R[ipart] << endl;
    ptcl_out << "</attrib>" << endl;
    ptcl_out << "</group>" << endl;
    ptcl_out << "<group name=\"d\" size=\"" << ndown << "\">" << endl;
    ptcl_out << "<parameter name=\"charge\">-1</parameter>" << endl;
    ptcl_out << "<attrib name=\"position\" datatype=\"posArray\">" << endl;
    for (int ipart=nup; ipart<el.getTotalNum(); ++ipart)
        ptcl_out << el.R[ipart] << endl;
    ptcl_out << "</attrib>" << endl;
    ptcl_out << "</group>" << endl;
    ptcl_out << "</particleset>" << endl;

    OHMMS::Controller->finalize();
    return 0;
}
开发者ID:,项目名称:,代码行数:101,代码来源:


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