本文整理汇总了C++中OhmmsAttributeSet类的典型用法代码示例。如果您正苦于以下问题:C++ OhmmsAttributeSet类的具体用法?C++ OhmmsAttributeSet怎么用?C++ OhmmsAttributeSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OhmmsAttributeSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
WMConstraints::InFuncType*
WMConstraints::createCorrelation(xmlNodePtr cur,BasisSetType* basis) {
int nc=0;
InFuncType* acombo=new InFuncType;
cur=cur->children;
while(cur != NULL) {
string cname((const char*)(cur->name));
if(cname == "parameter") {
string id("0");
string ref("0");
RealType c=1.0;
OhmmsAttributeSet aAttrib;
aAttrib.add(id,"id");
aAttrib.add(ref,"ref");
aAttrib.put(cur);
putContent(c,cur);
if(nc <basis->size()) acombo->add((*basis)[nc++],c,id);
}
cur=cur->next;
}
if(nc)
return acombo;
else {
delete acombo;
return 0;
}
}
示例2: sourceOpt
void WMConstraints::addBasisGroup(xmlNodePtr cur) {
string sourceOpt("e");
string elementType("e");
OhmmsAttributeSet aAttrib;
aAttrib.add(sourceOpt,"source");
aAttrib.add(elementType,"elementType");
aAttrib.put(cur);
RealType rcut(myGrid->rmax());
map<string,BasisSetType*>::iterator it(myBasisSet.find(elementType));
if(it == myBasisSet.end()) {
BasisSetType* newBasis=new BasisSetType;
cur=cur->children;
while(cur != NULL) {
string cname((const char*)(cur->name));
if(cname == "parameter") {
//BasisType* a=new BasisType(1.0,rcut);
WMFunctor<RealType>* a = new WMFunctor<RealType>(1.0,rcut);
a->put(cur);
newBasis->push_back(a);
}
cur=cur->next;
}
//add a new BasisSet
myBasisSet[elementType]=newBasis;
}
}
示例3: put
bool singleRPAJastrowBuilder::put(xmlNodePtr cur, int addOrbital)
{
MyName="Jep";
string rpafunc="RPA";
OhmmsAttributeSet a;
a.add(MyName,"name");
a.add(rpafunc,"function");
a.put(cur);
ParameterSet params;
RealType Rs(-1.0);
RealType Kc(-1.0);
params.add(Rs,"rs","double");
params.add(Kc,"kc","double");
params.put(cur);
if(Rs<0) {
Rs=tlen;
}
if(Kc<0){
Kc = 1e-6 ;
};
if (rpafunc=="RPA"){
myHandler= new LRRPAHandlerTemp<EPRPABreakup<RealType>,LPQHIBasis>(targetPtcl,Kc);
app_log()<<" using e-p RPA"<<endl;
}
else if (rpafunc=="dRPA") {
myHandler= new LRRPAHandlerTemp<derivEPRPABreakup<RealType>,LPQHIBasis>(targetPtcl,Kc);
app_log()<<" using e-p derivRPA"<<endl;
}
myHandler->Breakup(targetPtcl,Rs);
// app_log() << " Maximum K shell " << myHandler->MaxKshell << endl;
// app_log() << " Number of k vectors " << myHandler->Fk.size() << endl;
//Add short range part
Rcut = myHandler->get_rc()-0.1;
GridType* myGrid = new GridType;
int npts=static_cast<int>(Rcut/0.01)+1;
myGrid->set(0,Rcut,npts);
//create the numerical functor
nfunc = new FuncType;
SRA = new ShortRangePartAdapter<RealType>(myHandler);
SRA->setRmax(Rcut);
nfunc->initialize(SRA, myGrid);
J1s = new JneType (*sourcePtcl,targetPtcl);
for(int ig=0; ig<ng; ig++) {
J1s->addFunc(ig,nfunc);
}
app_log()<<" Only Short range part of E-I RPA is implemented"<<endl;
if (addOrbital) targetPsi.addOrbital(J1s,MyName);
return true;
}
示例4: success
/** process xml node for CPP
* @param cur xmlnode containing element+
*
* element/@name is used to find the index of the element of the
* IonConfig::SpeciesSet. The size of InpCPP is the number of species.
* The size of Centers is the number of ions.
*/
bool LocalCorePolPotential::put(xmlNodePtr cur)
{
bool success(true);
if(cur!= NULL)//input is provided
{
string ename;
cur= cur->children;
while(cur != NULL){
string cname((const char*)cur->name);
if(cname == "element")
{
string species_name;
OhmmsAttributeSet att;
att.add(species_name,"name");
att.put(cur);
if(species_name.size())
{
int itype = IonConfig.getSpeciesSet().addSpecies(species_name); //(const char*)e_ptr);
if(InpCPP[itype]==0) InpCPP[itype] = new CPP_Param;
app_log() << "CPP parameters for " << IonConfig.getSpeciesSet().speciesName[itype] << endl;
success = InpCPP[itype]->put(cur);
}
}
cur=cur->next;
}
}
for(int iat=0; iat<nCenters; iat++)
Centers[iat]=InpCPP[IonConfig.GroupID[iat]];
return success;
}
示例5: basisName
int SlaterDetBuilder::putDeterminant(xmlNodePtr cur, int firstIndex) {
string basisName("invalid");
string detname("NONE"), refname("NONE");
OhmmsAttributeSet aAttrib;
aAttrib.add(basisName,basisset_tag);
aAttrib.add(detname,"id");
aAttrib.add(refname,"ref");
aAttrib.put(cur);
xmlNodePtr c_ptr = NULL, o_ptr=NULL;
Det_t* adet=0;
//index of the last SlaterDeterminant
int dIndex=DetSet.size();
if(refname == "NONE") { //create one and use detname
if(detname =="NONE") { //no id is given, assign one
char newname[8];
sprintf(newname,"det%d",dIndex);
detname=newname;
}
}
map<string,SPOSetBasePtr>::iterator lit(SPOSet.find(detname));
SPOSetBasePtr psi;
if(lit == SPOSet.end()) {
#if defined(ENABLE_SMARTPOINTER)
psi.reset(myBasisSetFactory->createSPOSet(cur));
#else
psi = myBasisSetFactory->createSPOSet(cur);
#endif
psi->put(cur);
psi->checkObject();
SPOSet[detname]=psi;
} else {
psi = (*lit).second;
}
if(psi->getOrbitalSetSize()) {
map<string,Det_t*>::iterator dit(DetSet.find(detname));
if(dit == DetSet.end()) {
adet = new Det_t(psi,firstIndex);
adet->set(firstIndex,psi->getOrbitalSetSize());
DetSet[detname]=adet;
} else {
adet = (*dit).second;
}
firstIndex += psi->getOrbitalSetSize();
}
//only if a determinant is not 0
if(adet) SlaterDetSet.back()->add(adet);
return firstIndex;
}
示例6: spinOpt
bool JAABuilder::put(xmlNodePtr cur) {
string spinOpt("no");
string typeOpt("Two-Body");
string jastfunction("pade");
OhmmsAttributeSet aAttrib;
aAttrib.add(spinOpt,"spin");
aAttrib.add(typeOpt,"type");
aAttrib.add(jastfunction,"function");
aAttrib.put(cur);
IgnoreSpin=(spinOpt=="no");
bool success=false;
//if(jastfunction == "pade") {
// app_log() << " Two-Body Jastrow Function = " << jastfunction << endl;
// PadeJastrow<RealType> *dummy = 0;
// success = createJAA(cur,dummy);
//} else
if(jastfunction == "short") {
app_log() << " Modified Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
IgnoreSpin=true;
//ModPadeFunctor<RealType> *dummy = 0;
success = createJAA<ModPadeFunctor<RealType> >(cur,jastfunction);
}else if(jastfunction == "modMcMillan")
{
app_log() << " Modified McMillan Jastrow function Two-Body Jastrow Function = " << jastfunction << endl;
IgnoreSpin=true;
success = createJAA<ModMcMillanJ2Functor<RealType> >(cur,jastfunction);
}else if(jastfunction == "McMillan")
{
app_log() << " McMillan Jastrow (LONG RANGE!) function Two-Body Jastrow Function = " << jastfunction << endl;
IgnoreSpin=true;
success = createJAA<McMillanJ2Functor<RealType> >(cur,jastfunction);
}else if(jastfunction == "Gaussian")
{
app_log() << " Gaussian function Two-Body Jastrow Function = " << jastfunction << endl;
IgnoreSpin=true;
success = createJAA<GaussianFunctor<RealType> >(cur,jastfunction);
} else if(jastfunction == "shiftedGaussian")
{
app_log() << " Gaussian function Two-Body Jastrow Function = " << jastfunction << endl;
IgnoreSpin=true;
success = createJAA<TruncatedShiftedGaussianFunctor<RealType> >(cur,jastfunction);
}
//} else if(jastfunction == "rpa") {
// app_log() << " Two-Body Jastrow Function = " << jastfunction << endl;
// RPAJastrow<RealType> *dummy = 0;
// success = createJAA(cur,dummy);
//}
return success;
}
示例7: put
bool MPC::put(xmlNodePtr cur)
{
Ecut = -1.0;
OhmmsAttributeSet attribs;
attribs.add (Ecut, "cutoff");
attribs.put (cur);
if (Ecut < 0.0)
{
Ecut = 30.0;
app_log() << " MPC cutoff not found. Set using \"cutoff\" attribute.\n"
<< " Setting to default value of " << Ecut << endl;
}
return true;
}
示例8: while
bool eeI_JastrowBuilder::putkids (xmlNodePtr kids, J3type &J3)
{
SpeciesSet &iSet = sourcePtcl->getSpeciesSet();
SpeciesSet &eSet = targetPtcl.getSpeciesSet();
int numiSpecies = iSet.getTotalNum();
bool success=false;
while (kids != NULL) {
std::string kidsname = (char*)kids->name;
if (kidsname == "correlation") {
RealType ee_cusp=0.0;
RealType eI_cusp=0.0;
string iSpecies, eSpecies1("u"), eSpecies2("u");
OhmmsAttributeSet rAttrib;
rAttrib.add(iSpecies,"ispecies");
rAttrib.add(eSpecies1,"especies1");
rAttrib.add(eSpecies2,"especies2");
rAttrib.add(ee_cusp,"ecusp");
rAttrib.add(eI_cusp,"icusp");
rAttrib.put(kids);
typedef typename J3type::FuncType FT;
FT *functor = new FT(ee_cusp, eI_cusp);
functor->iSpecies = iSpecies;
functor->eSpecies1 = eSpecies1;
functor->eSpecies2 = eSpecies2;
int iNum = iSet.findSpecies (iSpecies);
int eNum1 = eSet.findSpecies (eSpecies1);
int eNum2 = eSet.findSpecies (eSpecies2);
functor->put (kids);
if (functor->cutoff_radius < 1.0e-6) {
app_log() << " eeI functor rcut is currently zero.\n"
<< " Setting to Wigner-Seitz radius = "
<< sourcePtcl->Lattice.WignerSeitzRadius << endl;
functor->cutoff_radius = sourcePtcl->Lattice.WignerSeitzRadius;
functor->reset();
}
strstream aname;
aname << iSpecies << "_" << eSpecies1 << "_" << eSpecies2;
J3.addFunc(aname.str(), iNum, eNum1, eNum2, functor);
}
kids = kids->next;
}
targetPsi.addOrbital(&J3,"eeI");
J3.setOptimizable(true);
return true;
}
示例9:
/** process xml node for each element
* @param cur xmlnode <element name="string" alpha="double" rb="double"/>
*/
bool LocalCorePolPotential::CPP_Param::put(xmlNodePtr cur)
{
OhmmsAttributeSet att;
att.add(alpha,"alpha");
att.add(r_b,"rb");
att.put(cur);
//const xmlChar* a_ptr = xmlGetProp(cur,(const xmlChar *)"alpha");
//const xmlChar* b_ptr = xmlGetProp(cur,(const xmlChar *)"rb");
//if(a_ptr) alpha = atof((const char*)a_ptr);
//if(b_ptr) r_b = atof((const char*)b_ptr);
C = -0.5*alpha;
one_over_rr = 1.0/r_b/r_b;
app_log() << "\talpha = " << alpha << " rb = " << r_b <<endl;
return true;
}
示例10: resetOptions
bool JastrowBuilder::put(xmlNodePtr cur) {
myNode=cur;
resetOptions();
OhmmsAttributeSet oAttrib;
oAttrib.add(typeOpt,"type");
oAttrib.add(nameOpt,"name");
oAttrib.add(funcOpt,"function");
oAttrib.add(transformOpt,"transform");
oAttrib.add(sourceOpt,"source");
oAttrib.add(spinOpt,"spin");
oAttrib.put(cur);
if(nameOpt[0] == '0')
{
app_warning() << " JastrowBuilder::put does not have name "<< endl;
return false;
}
if(typeOpt.find("One") < typeOpt.size())
return addOneBody(cur);
if(typeOpt.find("Two") < typeOpt.size())
return addTwoBody(cur);
if(typeOpt.find("Three") < typeOpt.size())
return addThreeBody(cur);
return false;
}
示例11: PRE
/** 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;
}
示例12: while
/** This should be moved to branch engine */
bool EstimatorManager::put(MCWalkerConfiguration& W, QMCHamiltonian& H, xmlNodePtr cur)
{
vector<string> extra;
cur = cur->children;
while(cur != NULL)
{
string cname((const char*)(cur->name));
if(cname == "estimator")
{
string est_name(MainEstimatorName);
string use_hdf5("yes");
OhmmsAttributeSet hAttrib;
hAttrib.add(est_name, "name");
hAttrib.add(use_hdf5, "hdf5");
hAttrib.put(cur);
if( (est_name == MainEstimatorName) || (est_name=="elocal") )
{
max4ascii=H.sizeOfObservables()+3;
add(new LocalEnergyEstimator(H,use_hdf5=="yes"),MainEstimatorName);
}
else
extra.push_back(est_name);
}
cur = cur->next;
}
if(Estimators.empty())
{
app_log() << " Adding a default LocalEnergyEstimator for the MainEstimator " << endl;
max4ascii=H.sizeOfObservables()+3;
add(new LocalEnergyEstimator(H,true),MainEstimatorName);
}
//Collectables is special and should not be added to Estimators
if(Collectables == 0 && H.sizeOfCollectables())
{
app_log() << " Using CollectablesEstimator for collectables, e.g. sk, gofr, density " << endl;
Collectables=new CollectablesEstimator(H);
}
return true;
}
示例13: start_version
bool HDFWalkerInputManager::put(xmlNodePtr cur)
{
//reference revision number
HDFVersion start_version(0,4);
//current node
int pid=myComm->rank();
string froot("0"), cfile("0");
//string target("e"), collect("no");
int anode=-1, nblocks=1, nprocs=1;
HDFVersion in_version(0,1); //set to be old version
OhmmsAttributeSet pAttrib;
pAttrib.add(cfile,"href");
pAttrib.add(cfile,"file");
pAttrib.add(froot,"fileroot");
pAttrib.add(anode,"node");
pAttrib.add(nprocs,"nprocs");
//pAttrib.add(collect,"collected");
pAttrib.add(in_version,"version");
pAttrib.put(cur);
bool success=false;
if(in_version>=start_version)
{
HDFWalkerInput_0_4 win(targetW,myComm,in_version);
success= win.put(cur);
cfile=win.FileName;
}
else
{
//missing version or old file
if(froot[0] != '0')//use nprocs
{
anode=pid;
if(nprocs==1)
cfile=froot;
else
{
char *h5name=new char[froot.size()+10];
sprintf(h5name,"%s.p%03d",froot.c_str(),pid);
cfile=h5name;
delete [] h5name;
}
}
int pid_target= (anode<0)? pid:anode;
if(pid_target == pid && cfile[0] != '0')
{
HDFWalkerInput_0_0 win(targetW,cfile);
success= win.put(cur);
}
}
if(success)
CurrentFileRoot = cfile;
return success;
}
示例14: while
void ECPotentialBuilder::useXmlFormat(xmlNodePtr cur) {
cur=cur->children;
while(cur != NULL) {
string cname((const char*)cur->name);
if(cname == "pseudo") {
string href("none");
string ionName("none");
string format("xml");
//RealType rc(2.0);//use 2 Bohr
OhmmsAttributeSet hAttrib;
hAttrib.add(href,"href");
hAttrib.add(ionName,"elementType"); hAttrib.add(ionName,"symbol");
hAttrib.add(format,"format");
//hAttrib.add(rc,"cutoff");
hAttrib.put(cur);
int speciesIndex=IonConfig.getSpeciesSet().findSpecies(ionName);
if(speciesIndex < IonConfig.getSpeciesSet().getTotalNum()) {
app_log() << endl << " Adding pseudopotential for " << ionName << endl;
ECPComponentBuilder ecp(ionName);
bool success=false;
if(format == "xml") {
if(href == "none") {
success=ecp.put(cur);
} else {
success=ecp.parse(href,cur);
}
}
else if(format == "casino")
{
//success=ecp.parseCasino(href,rc);
success=ecp.parseCasino(href,cur);
}
if(success) {
#if !defined(HAVE_MPI)
ecp.printECPTable();
#endif
if(ecp.pp_loc) {
localPot[speciesIndex]=ecp.pp_loc;
localZeff[speciesIndex]=ecp.Zeff;
hasLocalPot=true;
}
if(ecp.pp_nonloc) {
nonLocalPot[speciesIndex]=ecp.pp_nonloc;
hasNonLocalPot=true;
}
}
} else {
app_error() << " Ion species " << ionName << " is not found." << endl;
}
}
cur=cur->next;
}
}
示例15: while
void PolyConstraints::addSingleBasisPerSpecies(xmlNodePtr cur)
{
RealType rcut=10.0;
int npts=101;
RealType step=-1.0;
if(myGrid) {
rcut=myGrid->rmax();
npts = myGrid->size();
}
OhmmsAttributeSet gAttrib;
gAttrib.add(rcut,"rf");
BasisGroupType* curBG=0;
cur=cur->children;
while(cur != NULL)
{
string cname((const char*)(cur->name));
string elementType("e");
OhmmsAttributeSet aAttrib;
aAttrib.add(elementType,"elementType");
aAttrib.put(cur);
if(cname == "atomicBasisSet")
{
xmlNodePtr cur1=cur->children;
while(cur1 != NULL)
{
string cname1((const char*)(cur1->name));
if(cname1 == "basisGroup")
{
createBasisGroup(cur1,elementType,rcut);
}
else if(cname1 == "grid")
{
gAttrib.put(cur1);
}
cur1=cur1->next;
}
}
else if(cname == "basisGroup")
{
createBasisGroup(cur,elementType,rcut);
}
else if(cname == "grid")
gAttrib.put(cur);
cur=cur->next;
}
}