本文整理汇总了C++中ParticleSet::Species方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSet::Species方法的具体用法?C++ ParticleSet::Species怎么用?C++ ParticleSet::Species使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSet
的用法示例。
在下文中一共展示了ParticleSet::Species方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
using namespace ohmmsqmc;
xmlDocPtr m_doc;
xmlNodePtr m_root;
xmlXPathContextPtr m_context;
enum {SourceIndex = DistanceTableData::SourceIndex};
OHMMS::Controller->initialize(argc,argv);
OhmmsInfo welcome(argc,argv,OHMMS::Controller->mycontext());
///project description
OHMMS::ProjectData myProject;
///random number controller
OHMMS::RandomNumberControl myRandomControl;
if(argc>1) {
// build an XML tree from a the file;
LOGMSG("Opening file " << argv[1])
m_doc = xmlParseFile(argv[1]);
if (m_doc == NULL) {
ERRORMSG("File " << argv[1] << " is invalid")
xmlFreeDoc(m_doc);
return 1;
}
// Check the document is of the right kind
m_root = xmlDocGetRootElement(m_doc);
if (m_root == NULL) {
ERRORMSG("Empty document");
xmlFreeDoc(m_doc);
return 1;
}
} else {
WARNMSG("No argument is given. Assume that does not need an input file")
}
m_context = xmlXPathNewContext(m_doc);
xmlXPathObjectPtr result
= xmlXPathEvalExpression((const xmlChar*)"//project",m_context);
if(xmlXPathNodeSetIsEmpty(result->nodesetval)) {
WARNMSG("Project is not defined")
myProject.reset();
} else {
myProject.put(result->nodesetval->nodeTab[0]);
}
xmlXPathFreeObject(result);
//initialize the random number generator
xmlNodePtr rptr = myRandomControl.initialize(m_context);
if(rptr) {
xmlAddChild(m_root,rptr);
}
///the ions
ParticleSet ion;
MCWalkerConfiguration el;
el.setName("e");
int iu = el.Species.addSpecies("u");
int id = el.Species.addSpecies("d");
int icharge = el.Species.addAttribute("charge");
el.Species(icharge,iu) = -1;
el.Species(icharge,id) = -1;
bool init_els = determineNumOfElectrons(el,m_context);
result
= xmlXPathEvalExpression((const xmlChar*)"//particleset",m_context);
xmlNodePtr el_ptr=NULL, ion_ptr=NULL;
for(int i=0; i<result->nodesetval->nodeNr; i++) {
xmlNodePtr cur=result->nodesetval->nodeTab[i];
xmlChar* aname= xmlGetProp(cur,(const xmlChar*)"name");
if(aname) {
char fc = aname[0];
if(fc == 'e') {
el_ptr=cur;
}
else if(fc == 'i') {
ion_ptr=cur;
}
}
}
bool donotresize = false;
if(init_els) {
el.setName("e");
XMLReport("The configuration for electrons is already determined by the wave function")
donotresize = true;
}
if(el_ptr) {
XMLParticleParser pread(el,donotresize);
pread.put(el_ptr);
}
if(ion_ptr) {
//.........这里部分代码省略.........