本文整理汇总了C++中MCWalkerConfiguration::convert2Cart方法的典型用法代码示例。如果您正苦于以下问题:C++ MCWalkerConfiguration::convert2Cart方法的具体用法?C++ MCWalkerConfiguration::convert2Cart怎么用?C++ MCWalkerConfiguration::convert2Cart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCWalkerConfiguration
的用法示例。
在下文中一共展示了MCWalkerConfiguration::convert2Cart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createESParticleSet
//.........这里部分代码省略.........
if(ions->getTotalNum() == 0) return 0;
typedef ParticleSet::SingleParticleIndex_t SingleParticleIndex_t;
vector<SingleParticleIndex_t> grid(OHMMS_DIM,SingleParticleIndex_t(1));
ions->Lattice.reset();
ions->Lattice.makeGrid(grid);
if(SimulationCell==0)
{
SimulationCell = new ParticleSet::ParticleLayout_t(ions->Lattice);
}
//create the electrons
MCWalkerConfiguration* qp = new MCWalkerConfiguration;
qp->setName(target);
qp->Lattice.copy(ions->Lattice);
//qp->Lattice.reset();
//qp->Lattice.makeGrid(grid);
app_log() << " Simulation cell radius = " << qp->Lattice.SimulationCellRadius << endl;
app_log() << " Wigner-Seitz radius = " << qp->Lattice.WignerSeitzRadius << endl;
SimulationCell->print(app_log());
myPool[target]=qp;
myPool[source]=ions;
//addParticleSet(qp);
//addParticleSet(ions);
{//get the number of electrons per spin
vector<int> num_spin;
xmlNodePtr cur1=cur->children;
while(cur1!=NULL)
{
string cname1((const char*)cur1->name);
if(cname1 == OrbitalBuilderBase::sd_tag)
{
num_spin.clear();
xmlNodePtr cur2=cur1->children;
while(cur2!=NULL)
{
string cname2((const char*)cur2->name);
if(cname2 == OrbitalBuilderBase::det_tag)
{
int n=0;
OhmmsAttributeSet a;
a.add(n,"size");
a.put(cur2);
if(num_spin.size()<2) num_spin.push_back(n);
}
cur2=cur2->next;
}
}
cur1=cur1->next;
}
//create species
SpeciesSet& species=qp->getSpeciesSet();
//add up and down
species.addSpecies("u");
if(num_spin.size()>1) species.addSpecies("d");
int chid=species.addAttribute("charge");
for(int i=0; i<num_spin.size(); ++i) species(chid,i)=-1.0;
int mid=species.addAttribute("membersize");
for(int i=0; i<num_spin.size(); ++i) species(mid,i)=num_spin[i];
mid=species.addAttribute("mass");
for(int i=0; i<num_spin.size(); ++i) species(mid,i)=1.0;
qp->create(num_spin);
}
//name it with the target
qp->setName(target);
//assign non-trivial positions for the quanmtum particles
if(qp->Lattice.SuperCellEnum)
{
makeUniformRandom(qp->R);
qp->R.setUnit(PosUnit::LatticeUnit);
qp->convert2Cart(qp->R);
qp->createSK();
}
else
{
InitMolecularSystem mole(this);
if(ions->getTotalNum()>1)
mole.initMolecule(ions,qp);
else
mole.initAtom(ions,qp);
}
//for(int i=0; i<qp->getTotalNum(); ++i)
// cout << qp->GroupID[i] << " " << qp->R[i] << endl;
if(qp->getTotalNum() == 0 || ions->getTotalNum() == 0)
{
delete qp;
delete ions;
APP_ABORT("ParticleSetPool failed to create particlesets for the electron structure calculation");
return 0;
}
return qp;
}