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


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

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


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

示例1: LOGMSG

/*!\fn int DistanceTable::add(const ParticleSet& s,const ParticleSet& t, const char* aname) 
 *\param s source particle set
 *\param s target particle set
 *\param aname of a new DistanceTableData
 *\return index of the distance table with the name
 *\brief Adding AsymmetricDTD to the list, e.g., el-nuclei distance table
 */
int
DistanceTable::add(const ParticleSet& s, const ParticleSet& t,  
		   const char* aname) {

  string newname;
  if(aname) {
    newname = aname;
  } else {
    newname = s.getName();
    newname.append(t.getName());
  }

  LOGMSG("Creating a distance table with " << newname)

  map<string,int>::iterator it = TableMap.find(newname);

  ///the named pair does not exist, add a new asymmetric metrics
  if(it == TableMap.end()) {
    int n = TableList.size();
    TableList.push_back(new AsymmetricDTD<NoBConds<double,3> > (s,t));
    TableMap[newname] = n;
    VisitorID.push_back(t.tag());
    return n;
  } else {
    return (*it).second;
  }
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:34,代码来源:DistanceTable.cpp

示例2: UseBoundBox

ParticleSet::ParticleSet(const ParticleSet& p)
  : UseBoundBox(p.UseBoundBox), UseSphereUpdate(p.UseSphereUpdate),IsGrouped(p.IsGrouped)
  , ThreadID(0), mySpecies(p.getSpeciesSet()),SK(0), ParentTag(p.tag())
{
  initBase();
  initParticleSet();
  assign(p); //obly the base is copied, assumes that other properties are not assignable
  //need explicit copy:
  Mass=p.Mass;
  Z=p.Z;
  ostringstream o;
  o<<p.getName()<<ObjectTag;
  this->setName(o.str());
  app_log() << "  Copying a particle set " << p.getName() << " to " << this->getName() << " groups=" << groups() << endl;
  PropertyList.Names=p.PropertyList.Names;
  PropertyList.Values=p.PropertyList.Values;
  PropertyHistory=p.PropertyHistory;
  Collectables=p.Collectables;
  //construct the distance tables with the same order
  //first is always for this-this paier
  for (int i=1; i<p.DistTables.size(); ++i)
    addTable(p.DistTables[i]->origin());
  if(p.SK)
  {
    R.InUnit=p.R.InUnit;
    createSK();
    SK->DoUpdate=p.SK->DoUpdate;
  }
  if (p.Sphere.size())
    resizeSphere(p.Sphere.size());
  add_p_timer(myTimers);
  myTwist=p.myTwist;
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:33,代码来源:ParticleSet.cpp

示例3: PRE

StressPBCAA::StressPBCAA(ParticleSet& ref, bool active) :
  AA(0), myGrid(0), rVs(0), FirstTime(true), myConst(0.0), ForceBase(ref,ref), Ps(ref), is_active(active)
{
  ReportEngine PRE("StressPBCAA","StressPBCAA");
  //save source tag
  SourceID=ref.tag();
  //create a distance table: just to get the table name
  DistanceTableData *d_aa = DistanceTable::add(ref);
  PtclRefName=d_aa->Name;
  initBreakup(ref);
  prefix="S_"+PtclRefName;
  app_log() << "  Maximum K shell " << AA->MaxKshell << endl;
  app_log() << "  Number of k vectors " << AA->Fk.size() << endl;
  if(!is_active)
  {
    d_aa->evaluate(ref);
    update_source(ref);
   app_log()<<"Evaluating Stress SymTensor::Long Range\n"; 
    sLR=evalLR(ref);
   app_log()<<"Short Range...\n";
    sSR=evalSR(ref);
    stress=sLR+sSR+myConst;
    
    //RealType eL(0.0), eS(0.0);
    //if (computeForces)
    //{
    //  forces = 0.0;
    //  eS=evalSRwithForces(ref);
    //  // 1.3978248322
    //  eL=evalLRwithForces(ref);
    //  // 2.130267378
    //}
    //else
    //{
    //  eL=evalLR(ref);
    //  eS=evalSR(ref);
    //}
    //NewValue=Value = eL+eS+myConst;
    //app_log() << "  Fixed Coulomb potential for " << ref.getName();
    //app_log() << "\n    e-e Madelung Const. =" << MC0
    //          << "\n    Vtot     =" << Value << endl;
    
  }
  app_log() << "  Stress SymTensor components for  " << ref.getName();
  app_log() << "\n    e-e Madelung Const. =\n" << MC0
            << "\n    Stot     =\n" << stress 
            << "\n    S_SR     =\n" << sSR   
            << "\n    S_LR     =\n" << sLR
            << "\n    S_Const  =\n" << myConst<<endl;
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例4: put

  /** process an xml element
   * @param cur current xmlNodePtr
   * @return true, if successful.
   *
   * Creating MCWalkerConfiguration for all the ParticleSet
   * objects. 
   */
  bool ParticleSetPool::put(xmlNodePtr cur) 
  {

    ReportEngine PRE("ParticleSetPool","put");

    //const ParticleSet::ParticleLayout_t* sc=DistanceTable::getSimulationCell();
    //ParticleSet::ParticleLayout_t* sc=0;

    string id("e"), role("none");
    OhmmsAttributeSet pAttrib;
    pAttrib.add(id,"id"); pAttrib.add(id,"name"); 
    pAttrib.add(role,"role");
    pAttrib.put(cur);

    //backward compatibility
    if(id == "e" && role=="none") role="MC";

    ParticleSet* pTemp = getParticleSet(id);
    if(pTemp == 0) 
    {
      app_log() << "  Creating " << id << " particleset" << endl;
      pTemp = new MCWalkerConfiguration;
      //if(role == "MC") 
      //  pTemp = new MCWalkerConfiguration;
      //else 
      //  pTemp = new ParticleSet;
      if(SimulationCell) 
      {
        app_log() << "  Initializing the lattice of " << id << " by the global supercell" << endl;
        pTemp->Lattice.copy(*SimulationCell);
      }
      myPool[id] = pTemp;
      XMLParticleParser pread(*pTemp,TileMatrix);
      bool success = pread.put(cur);
      pTemp->setName(id);
      app_log() << pTemp->getName() <<endl;
      return success;
    } else {
      app_warning() << "particleset " << id << " is already created. Ignore this" << endl;
    }

    return true;
  }
开发者ID:digideskio,项目名称:qmcpack,代码行数:50,代码来源:ParticleSetPool.cpp

示例5: 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,代码来源:


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