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; }
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; } }
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; }
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; } }
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; }
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; } }
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; }
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; }
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; }
bool WaveFunctionFactory::addFermionTerm(xmlNodePtr cur) { ReportEngine PRE(ClassName,"addFermionTerm"); OrbitalBuilderBase* detbuilder=0; string orbtype("MolecularOrbital"); string nuclei("i"); OhmmsAttributeSet oAttrib; oAttrib.add(orbtype,"type"); oAttrib.add(nuclei,"source"); oAttrib.put(cur); //app_log() << "\n Slater determinant terms using " << orbtype << endl; #if defined(QMC_COMPLEX) if(orbtype == "electron-gas") { detbuilder = new ElectronGasComplexOrbitalBuilder(*targetPtcl,*targetPsi); } #else if(orbtype == "electron-gas") { detbuilder = new ElectronGasOrbitalBuilder(*targetPtcl,*targetPsi); } #endif else if(orbtype == "PWBasis" || orbtype == "PW" || orbtype == "pw") { detbuilder = new PWOrbitalBuilder(*targetPtcl,*targetPsi); } //else if(orbtype == "MolecularOrbital") //{ // detbuilder = new MolecularOrbitalBuilder(*targetPtcl,*targetPsi,ptclPool); //} else { detbuilder = new SlaterDetBuilder(*targetPtcl,*targetPsi,ptclPool); } if(detbuilder) { //valid determinant set detbuilder->setReportLevel(ReportLevel); detbuilder->put(cur); addNode(detbuilder,cur); return true; } else { return false; } }
/** 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; }
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; } }
/** 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; }
/** 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; }
/** main functio to optimize multiple contracted S orbitals */ void GTO2Slater::optimize() { //construct one-dim grid double ri = 1e-5; double rf = 10.0; int npts = 101; string gridType("log"); if(gridPtr) { OhmmsAttributeSet radAttrib; radAttrib.add(gridType,"type"); radAttrib.add(npts,"npts"); radAttrib.add(ri,"ri"); radAttrib.add(rf,"rf"); radAttrib.put(gridPtr); } myGrid.set(ri,rf,npts); //create a numerical grid funtor typedef OneDimCubicSpline<double> RadialOrbitalType; RadialOrbitalType radorb(&myGrid); int L= 0; //Loop over all the constracted S orbitals map<string,xmlNodePtr>::iterator it(sPtr.begin()),it_end(sPtr.end()); while(it != it_end) { //create contracted gaussian GTOType gset(L,Normalized); //read the radfunc's of basisGroup gset.putBasisGroup((*it).second); //convert to a radial functor Transform2GridFunctor<GTOType,RadialOrbitalType> transform(gset, radorb); transform.generate(myGrid.rmin(),myGrid.rmax(),myGrid.size()); //optimize it with the radial functor Any2Slater gto2slater(radorb); gto2slater.optimize(); ++it; } sPtr.clear(); }
bool HamiltonianPool::put(xmlNodePtr cur) { ReportEngine PRE("HamiltonianPool","put"); string id("h0"), target("e"),role("extra"); OhmmsAttributeSet hAttrib; hAttrib.add(id,"id"); hAttrib.add(id,"name"); hAttrib.add(role,"role"); hAttrib.add(target,"target"); hAttrib.put(cur); ParticleSet* qp=ptclPool->getParticleSet(target); if(qp == 0) {//never a good thing PRE.error("No target particle "+ target+ " exists."); return false; } bool set2Primary=false; //first Hamiltonian is set to the primary Hamiltonian if(myPool.empty() || role == "primary" ) set2Primary=true; HamiltonianFactory *curH=0; PoolType::iterator hit(myPool.find(id)); if(hit == myPool.end()) { curH= new HamiltonianFactory(qp, ptclPool->getPool(), psiPool->getPool(),myComm); curH->setName(id); myPool[id]=curH; } else curH=(*hit).second; bool success= curH->put(cur); if(set2Primary) primaryH=curH->targetH; return success; }
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; }
bool GTO2Slater::put(xmlNodePtr cur) { cur = cur->children; while(cur != NULL) { string cname((const char*)(cur->name)); if(cname == "grid") gridPtr = cur; else if(cname == "basisGroup") { string rid("invalid"); string rtype("Gaussian"); string norm("no"); int l=0; OhmmsAttributeSet inAttrib; inAttrib.add(rid,"rid"); inAttrib.add(l,"l"); inAttrib.add(rtype,"type"); inAttrib.add(norm,"normalized"); inAttrib.put(cur); if(rtype == "Gaussian" && l == 0) { //pick only S //if Ngto==1, don't do it if(norm == "yes") Normalized=true; else Normalized=false; map<string,xmlNodePtr>::iterator it(sPtr.find(rid)); if(it == sPtr.end()) { sPtr[rid]=cur; } } } cur=cur->next; } if(sPtr.empty()) return false; return true; }
OrbitalBase* WMConstraints::createOneBody(ParticleSet& target, ParticleSet& source) { vector<InFuncType*> jnSet; jnSet.resize(source.getSpeciesSet().getTotalNum(),0); xmlNodePtr cur=myNode->children; bool noOneBody=true; while(cur != NULL) { string cname((const char*)(cur->name)); if(cname == "basisGroup") { addBasisGroup(cur); } else if(cname =="correlation") { string speciesA("e"); string speciesB("e"); OhmmsAttributeSet aAttrib; aAttrib.add(speciesA,"speciesA"); aAttrib.add(speciesB,"speciesB"); aAttrib.put(cur); if(speciesA != speciesB) { map<string,BasisSetType*>::iterator it(myBasisSet.find(speciesA)); if(it == myBasisSet.end()) { app_error() << " WMBasisSet for " << speciesA << " does not exist." << endl; continue; } app_log() << " Creating a correlation function = " << speciesA << "-" << speciesB << endl; int gid=source.getSpeciesSet().addSpecies(speciesA); jnSet[gid] = createCorrelation(cur,(*it).second); noOneBody=false; } } cur=cur->next; } if(noOneBody) return 0; typedef OneBodyJastrow<FuncType> JneType; JneType* jne=new JneType(source,target); for(int ig=0; ig<jnSet.size(); ig++) { if(jnSet[ig]) { FuncType* nfunc= new FuncType(jnSet[ig],myGrid); jne->addFunc(ig,nfunc); FuncList.push_back(nfunc); InFuncList.push_back(jnSet[ig]); } } return jne; }
/** 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; }
bool ParticleSetPool::putLattice(xmlNodePtr cur) { ReportEngine PRE("ParticleSetPool","putLattice"); OhmmsAttributeSet pAttrib; pAttrib.add(TileMatrix,"tilematrix"); pAttrib.put(cur); if(SimulationCell==0) { app_log() << " Create Global SuperCell " << endl; SimulationCell = new ParticleSet::ParticleLayout_t; } else { app_log() << " Overwrite Global SuperCell " << endl; } LatticeParser a(*SimulationCell); bool success=a.put(cur); SimulationCell->print(app_log()); return success; }
GTOMolecularOrbitals::BasisSetType* GTOMolecularOrbitals::addBasisSet(xmlNodePtr cur) { if(!BasisSet) BasisSet = new BasisSetType(IonSys.getSpeciesSet().getTotalNum()); QuantumNumberType nlms; string rnl; //current number of centers int ncenters = CenterID.size(); int activeCenter; int gridmode = -1; bool addsignforM = true; string sph("spherical"), Morder("gaussian"); //go thru the tree cur = cur->xmlChildrenNode; while(cur!=NULL) { string cname((const char*)(cur->name)); if(cname == basis_tag || cname == "atomicBasisSet") { int expandlm = GAUSSIAN_EXPAND; string abasis("invalid"), norm("no"); //Register valid attributes attributes OhmmsAttributeSet aAttrib; aAttrib.add(abasis,"elementType"); aAttrib.add(abasis,"species"); aAttrib.add(sph,"angular"); aAttrib.add(addsignforM,"expM"); aAttrib.add(Morder,"expandYlm"); aAttrib.add(norm,"normalized"); aAttrib.put(cur); if(norm == "yes") Normalized=true; else Normalized=false; if(abasis == "invalid") continue; if(sph == "spherical") addsignforM=true; //include (-1)^m if(sph == "cartesian") addsignforM=false; if(Morder == "gaussian") { expandlm = GAUSSIAN_EXPAND; } else if(Morder == "natural"){ expandlm = NATURAL_EXPAND; } else if(Morder == "no") { expandlm = DONOT_EXPAND; } if(addsignforM) LOGMSG("Spherical Harmonics contain (-1)^m factor") else LOGMSG("Spherical Harmonics DO NOT contain (-1)^m factor") map<string,int>::iterator it = CenterID.find(abasis); //search the species name if(it == CenterID.end()) {//add the name to the map CenterID //CenterID[abasis] = activeCenter = ncenters++; CenterID[abasis]=activeCenter=IonSys.getSpeciesSet().findSpecies(abasis); int Lmax(0); //maxmimum angular momentum of this center int num(0);//the number of localized basis functions of this center //process the basic property: maximun angular momentum, the number of basis functions to be added vector<xmlNodePtr> radGroup; xmlNodePtr cur1 = cur->xmlChildrenNode; xmlNodePtr gptr=0; while(cur1 != NULL) { string cname1((const char*)(cur1->name)); if(cname1 == basisfunc_tag || cname1 == "basisGroup") { radGroup.push_back(cur1); int l=atoi((const char*)(xmlGetProp(cur1, (const xmlChar *)"l"))); Lmax = max(Lmax,l); if(expandlm) num += 2*l+1; else num++; } cur1 = cur1->next; } LOGMSG("Adding a center " << abasis << " centerid "<< CenterID[abasis]) LOGMSG("Maximum angular momentum = " << Lmax) LOGMSG("Number of centered orbitals = " << num) //create a new set of atomic orbitals sharing a center with (Lmax, num) //if(addsignforM) the basis function has (-1)^m sqrt(2)Re(Ylm) CenteredOrbitalType* aos = new CenteredOrbitalType(Lmax,addsignforM); aos->LM.resize(num); aos->NL.resize(num); //Now, add distinct Radial Orbitals and (l,m) channels num=0; vector<xmlNodePtr>::iterator it(radGroup.begin()); vector<xmlNodePtr>::iterator it_end(radGroup.end()); while(it != it_end) { cur1 = (*it); xmlAttrPtr att = cur1->properties; while(att != NULL) { string aname((const char*)(att->name)); if(aname == "rid" || aname == "id") { //accept id/rid rnl = (const char*)(att->children->content); } else { map<string,int>::iterator iit = nlms_id.find(aname); if(iit != nlms_id.end()) { //valid for n,l,m,s nlms[(*iit).second] = atoi((const char*)(att->children->content)); } } att = att->next; } LOGMSG("\n(n,l,m,s) " << nlms[0] << " " << nlms[1] << " " << nlms[2] << " " << nlms[3]) //add Ylm channels num = expandYlm(rnl,nlms,num,aos,cur1,expandlm); ++it; } LOGMSG("Checking the order of angular momentum ") std::copy(aos->LM.begin(), aos->LM.end(), ostream_iterator<int>(app_log()," ")); app_log() << endl; //add the new atomic basis to the basis set BasisSet->add(aos,activeCenter); }else { WARNMSG("Species " << abasis << " is already initialized. Ignore the input.") } } cur = cur->next; }
bool ForwardWalking::putSpecial(xmlNodePtr cur, QMCHamiltonian& h, ParticleSet& P) { FirstHamiltonian = h.startIndex(); nObservables=0; nValues=0; blockT=1; // OhmmsAttributeSet attrib; // attrib.add(blockT,"blockSize"); // attrib.put(cur); xmlNodePtr tcur = cur->children; while(tcur != NULL) { string cname((const char*)tcur->name); if(cname == "Observable") { string tagName("none"); int Hindex(-100); int blockSeries(0); int blockFreq(0); OhmmsAttributeSet Tattrib; Tattrib.add(tagName,"name"); Tattrib.add(blockSeries,"max"); Tattrib.add(blockFreq,"frequency"); Tattrib.put(tcur); if (tagName.find("*")==string::npos) { //Single Observable case int numProps = P.PropertyList.Names.size(); Hindex = h.getObservable(tagName)+NUMPROPERTIES; if(tagName=="LocalPotential") { Hindex=LOCALPOTENTIAL ; tagName="LocPot"; } else if(tagName=="LocalEnergy") { Hindex=LOCALENERGY ; tagName="LocEn"; } else if (Hindex==(NUMPROPERTIES-1)){ app_log()<<"Not a valid H element("<<Hindex<<") Valid names are:"; for (int jk=0;jk<h.sizeOfObservables();jk++) app_log()<<" "<<h.getObservableName(jk); app_log()<<endl; exit(-1); } Names.push_back(tagName); Hindices.push_back( Hindex); app_log()<<" Hamiltonian Element "<<tagName<<" was found at "<< Hindex<<endl; int numT=blockSeries/blockFreq ; nObservables+=1; nValues+=numT; app_log()<<" "<<numT<<" values will be calculated every "<<blockFreq<<"*tau H^-1"<<endl; vector<int> pms(3); pms[0]=blockFreq; pms[1]=numT; pms[2]=blockSeries+2; walkerLengths.push_back(pms); int maxWsize=blockSeries+2; int pindx = P.addPropertyHistory(maxWsize); // summed values. // P.addPropertyHistory(numT); Pindices.push_back(pindx); } else { bool FOUNDH(false); // Multiple observables for this tag int found=tagName.rfind("*"); tagName.replace (found,1,""); int numProps = P.PropertyList.Names.size(); for(int j=0;j<h.sizeOfObservables();j++) { string Hname = h.getObservableName(j); if (Hname.find(tagName) != string::npos) { // vector<int> Parameters; // if(blockSeries==0) // putContent(Parameters,tcur); // else // for( int pl=blockFreq;pl<=blockSeries;pl+=blockFreq) Parameters.push_back(pl); FOUNDH=true; app_log()<<" Hamiltonian Element "<<Hname<<" was found at "<< j<<endl; Names.push_back(Hname); Hindex = j+NUMPROPERTIES; Hindices.push_back( Hindex); int numT=blockSeries/blockFreq ; nObservables+=1; nValues+=numT; app_log()<<" "<<numT<<" values will be calculated every "<<blockFreq<<"*tau H^-1"<<endl; vector<int> pms(3); pms[0]=blockFreq; pms[1]=numT; pms[2]=blockSeries+2; walkerLengths.push_back(pms); int maxWsize=blockSeries+2; int pindx = P.addPropertyHistory(maxWsize); Pindices.push_back(pindx); } } //handle FOUNDH if (FOUNDH) { nObservables+=1; } else { app_log()<<"Not a valid H element("<<Hindex<<") Valid names are:"; for (int jk=0;jk<h.sizeOfObservables();jk++) app_log()<<" "<<h.getObservableName(jk); app_log()<<endl; APP_ABORT("ForwardWalking::put"); } } } tcur = tcur->next; } app_log()<<"Total number of observables calculated:"<<nObservables<<endl; app_log()<<"Total number of values calculated:"<<nValues<<endl; Values.resize(nValues); return true; }
bool TwoBodyJastrowBuilder::put(xmlNodePtr cur) { string functionOpt("pade"); string transformOpt("no"); string sourceOpt("9NONE"); string spinOpt("yes"); OhmmsAttributeSet oAttrib; oAttrib.add(functionOpt,"function"); oAttrib.add(transformOpt,"transform"); oAttrib.add(sourceOpt,"source"); oAttrib.add(spinOpt,"spin"); oAttrib.put(cur); IgnoreSpin = (spinOpt == "no"); if(sourceOpt[0] != '9') { map<string,ParticleSet*>::iterator pa_it(ptclPool.find(sourceOpt)); if(pa_it != ptclPool.end()) { sourcePtcl=(*pa_it).second; } } bool success=false; OrbitalConstraintsBase* control=0; //@todo automatically set it to yes with PBC bool useSpline= (transformOpt == "yes"); app_log() << " TwoBodyJastrowBuilder for " << functionOpt << endl; if(functionOpt == "pade") { //control = new PadeConstraints(IgnoreSpin); //Transform is ignored. Cutoff function is not too good if(useSpline) { control = new PadeOnGridConstraints(IgnoreSpin); } else { control = new PadeConstraints(IgnoreSpin); } } else if(functionOpt == "scaledpade") { control = new ScaledPadeConstraints(IgnoreSpin); } else if(functionOpt == "rpa") { if(useSpline) { control = new RPAPBCConstraints(IgnoreSpin); } else { control = new RPAConstraints(IgnoreSpin); } } else if(functionOpt == "WM") { control = new WMConstraints(IgnoreSpin); } if(control==0) { //try generic JAABuilder and NJAABuilder OrbitalBuilderBase* jbuilder=0; if(useSpline) { jbuilder = new NJAABuilder(targetPtcl,targetPsi); } else { jbuilder = new JAABuilder(targetPtcl,targetPsi); } return jbuilder->put(cur); } success=control->put(cur); if(!control->put(cur)) { delete control; return false; } ComboOrbital* jcombo=new ComboOrbital(control); control->addTwoBodyPart(targetPtcl, jcombo); if(sourcePtcl) { // add one-body term using Zeff and e-e B OrbitalBase* j1=control->createOneBody(targetPtcl,*sourcePtcl); if(j1) jcombo->Psi.push_back(j1); } control->addOptimizables(targetPsi.VarList); targetPsi.addOrbital(jcombo); return success; }
GridMolecularOrbitals::BasisSetType* GridMolecularOrbitals::addBasisSet(xmlNodePtr cur) { if(!BasisSet) BasisSet = new BasisSetType(IonSys.getSpeciesSet().getTotalNum()); QuantumNumberType nlms; string rnl; //current number of centers int ncenters = CenterID.size(); int activeCenter; int gridmode = -1; bool addsignforM = false; string sph("default"), Morder("gaussian"); //go thru the tree cur = cur->xmlChildrenNode; map<string,RGFBuilderBase*> rbuilderlist; while(cur!=NULL) { string cname((const char*)(cur->name)); if(cname == basis_tag || cname == "atomicBasisSet") { int expandlm = GAUSSIAN_EXPAND; string abasis("invalid"), btype("Numerical"); //Register valid attributes attributes OhmmsAttributeSet aAttrib; aAttrib.add(abasis,"elementType"); aAttrib.add(abasis,"species"); aAttrib.add(btype,"type"); aAttrib.add(sph,"angular"); aAttrib.add(addsignforM,"expM"); aAttrib.add(Morder,"expandYlm"); aAttrib.put(cur); if(abasis == "invalid") continue; if(sph == "spherical") addsignforM=1; //include (-1)^m if(Morder == "gaussian") { expandlm = GAUSSIAN_EXPAND; } else if(Morder == "natural") { expandlm = NATURAL_EXPAND; } else if(Morder == "no") { expandlm = DONOT_EXPAND; } if(addsignforM) LOGMSG("Spherical Harmonics contain (-1)^m factor") else LOGMSG("Spherical Harmonics DO NOT contain (-1)^m factor") //search the species name map<string,int>::iterator it = CenterID.find(abasis); if(it == CenterID.end()) //add the name to the map CenterID { if(btype == "Numerical" || btype == "NG" || btype == "HFNG") { rbuilder = new NumericalRGFBuilder(cur); } else { rbuilder = new Any2GridBuilder(cur); } //CenterID[abasis] = activeCenter = ncenters++; CenterID[abasis]=activeCenter=IonSys.getSpeciesSet().findSpecies(abasis); int Lmax(0); //maxmimum angular momentum of this center int num(0);//the number of localized basis functions of this center //process the basic property: maximun angular momentum, the number of basis functions to be added vector<xmlNodePtr> radGroup; xmlNodePtr cur1 = cur->xmlChildrenNode; xmlNodePtr gptr=0; while(cur1 != NULL) { string cname1((const char*)(cur1->name)); if(cname1 == basisfunc_tag || cname1 == "basisGroup") { radGroup.push_back(cur1); int l=atoi((const char*)(xmlGetProp(cur1, (const xmlChar *)"l"))); Lmax = max(Lmax,l); //expect that only Rnl is given if(expandlm) num += 2*l+1; else num++; } else if(cname1 == "grid") { gptr = cur1; } cur1 = cur1->next; } XMLReport("Adding a center " << abasis << " centerid "<< CenterID[abasis]) XMLReport("Maximum angular momentum = " << Lmax) XMLReport("Number of centered orbitals = " << num) //create a new set of atomic orbitals sharing a center with (Lmax, num) //if(addsignforM) the basis function has (-1)^m sqrt(2)Re(Ylm) CenteredOrbitalType* aos = new CenteredOrbitalType(Lmax,addsignforM); aos->LM.resize(num); aos->NL.resize(num); //Now, add distinct Radial Orbitals and (l,m) channels num=0; rbuilder->setOrbitalSet(aos,abasis); //assign radial orbitals for the new center rbuilder->addGrid(gptr); //assign a radial grid for the new center vector<xmlNodePtr>::iterator it(radGroup.begin()); vector<xmlNodePtr>::iterator it_end(radGroup.end()); while(it != it_end) { cur1 = (*it); xmlAttrPtr att = cur1->properties; while(att != NULL) { string aname((const char*)(att->name)); if(aname == "rid" || aname == "id") //accept id/rid { rnl = (const char*)(att->children->content); } else { map<string,int>::iterator iit = nlms_id.find(aname); if(iit != nlms_id.end()) //valid for n,l,m,s { nlms[(*iit).second] = atoi((const char*)(att->children->content)); } } att = att->next; } XMLReport("\n(n,l,m,s) " << nlms[0] << " " << nlms[1] << " " << nlms[2] << " " << nlms[3]) //add Ylm channels num = expandYlm(rnl,nlms,num,aos,cur1,expandlm); ++it; } //add the new atomic basis to the basis set BasisSet->add(aos,activeCenter); #if !defined(HAVE_MPI) rbuilder->print(abasis,1); #endif if(rbuilder) { delete rbuilder; rbuilder=0; } } else { WARNMSG("Species " << abasis << " is already initialized. Ignore the input.") } } cur = cur->next; }
bool ElectronGasOrbitalBuilder::put(xmlNodePtr cur){ int nc=0; PosType twist(0.0); OhmmsAttributeSet aAttrib; aAttrib.add(nc,"shell"); aAttrib.add(twist,"twist"); aAttrib.put(cur); typedef DiracDeterminant<RealEGOSet> Det_t; typedef SlaterDeterminant<RealEGOSet> SlaterDeterminant_t; int nat=targetPtcl.getTotalNum(); int nup=nat/2; HEGGrid<RealType,OHMMS_DIM> egGrid(targetPtcl.Lattice); if(nc == 0) nc = egGrid.getShellIndex(nup); if(nc<0) { app_error() << " HEG Invalid Shell." << endl; APP_ABORT("ElectronGasOrbitalBuilder::put"); } if(nup!=egGrid.getNumberOfKpoints(nc)) { app_error() << " The number of particles does not match to the shell." << endl; app_error() << " Suggested values for the number of particles " << endl; app_error() << " " << 2*egGrid.getNumberOfKpoints(nc) << " for shell "<< nc << endl; app_error() << " " << 2*egGrid.getNumberOfKpoints(nc-1) << " for shell "<< nc-1 << endl; APP_ABORT("ElectronGasOrbitalBuilder::put"); return false; } int nkpts=(nup-1)/2; //create a E(lectron)G(as)O(rbital)Set egGrid.createGrid(nc,nkpts); RealEGOSet* psi=new RealEGOSet(egGrid.kpt,egGrid.mk2); //create up determinant Det_t *updet = new Det_t(psi,0); updet->set(0,nup); //create down determinant Det_t *downdet = new Det_t(psi,nup); downdet->set(nup,nup); //create a Slater determinant SlaterDeterminant_t *sdet = new SlaterDeterminant_t; sdet->add(updet); sdet->add(downdet); //add a DummyBasisSet sdet->setBasisSet(new DummyBasisSet); //add Slater determinant to targetPsi targetPsi.addOrbital(sdet,"SlaterDet"); return true; }
bool ThreeBodyGeminal::put(xmlNodePtr cur) { //BasisSize = GeminalBasis->TotalBasis; BasisSize = GeminalBasis->getBasisSetSize(); app_log() << " The number of Geminal functions " <<"for Three-body Jastrow " << BasisSize << endl; app_log() << " The number of particles " << NumPtcls << endl; Lambda.resize(BasisSize,BasisSize); //disable lambda's so that element-by-element input can be handled FreeLambda.resize(BasisSize*(BasisSize+1)/2); FreeLambda=false; //zero is default Lambda=0.0; //for(int ib=0; ib<BasisSize; ib++) Lambda(ib,ib)=NormFac; //for(int ib=0; ib<BasisSize; ib++) // for(int jb=ib; jb<BasisSize; ++jb) // { // Lambda(ib,jb)=Random(); // if(jb!=ib) Lambda(jb,ib)=Lambda(ib,jb); // } if(cur == NULL) { FreeLambda=true; } else { //read from an input nodes string aname("j3"); string datatype("no"); int sizeIn(0); IndexOffSet=1; OhmmsAttributeSet attrib; attrib.add(aname,"id"); attrib.add(sizeIn,"size"); attrib.add(aname,"name"); attrib.add(datatype,"type"); attrib.add(IndexOffSet,"offset"); attrib.put(cur); ID_Lambda=aname; if(datatype.find("rray")<datatype.size()) { if (sizeIn==Lambda.rows()) { putContent(Lambda,cur); } FreeLambda=true; //addOptimizables(varlist); //symmetrize it //for(int ib=0; ib<BasisSize; ib++) { // sprintf(coeffname,"%s_%d_%d",aname.c_str(),ib+IndexOffSet,ib+IndexOffSet); // varlist[coeffname]=Lambda(ib,ib); // for(int jb=ib+1; jb<BasisSize; jb++) { // sprintf(coeffname,"%s_%d_%d",aname.c_str(),ib+IndexOffSet,jb+IndexOffSet); // Lambda(jb,ib) = Lambda(ib,jb); // varlist[coeffname]=Lambda(ib,jb); // } //} } else { xmlNodePtr tcur=cur->xmlChildrenNode; while(tcur != NULL) { if(xmlStrEqual(tcur->name,(const xmlChar*)"lambda")) { int iIn=atoi((const char*)(xmlGetProp(tcur,(const xmlChar*)"i"))); int jIn=atoi((const char*)(xmlGetProp(tcur,(const xmlChar*)"j"))); int i=iIn-IndexOffSet; int j=jIn-IndexOffSet; double c=atof((const char*)(xmlGetProp(tcur,(const xmlChar*)"c"))); Lambda(i,j)=c; FreeLambda(i*BasisSize+j)=true; if(i != j) Lambda(j,i)=c; //sprintf(coeffname,"%s_%d_%d",aname.c_str(),iIn,jIn); //varlist[coeffname]=c; } tcur=tcur->next; } } } //myVars are set myVars.clear(); char coeffname[16]; int ii=0; for(int ib=0; ib<BasisSize; ib++) { if(FreeLambda(ii++)) { sprintf(coeffname,"%s_%d_%d",ID_Lambda.c_str(),ib,ib); myVars.insert(coeffname,Lambda(ib,ib)); } for(int jb=ib+1; jb<BasisSize; jb++) { if(FreeLambda(ii++)) { sprintf(coeffname,"%s_%d_%d",ID_Lambda.c_str(),ib,jb); myVars.insert(coeffname,Lambda(ib,jb)); } } } //app_log() << " Lambda Variables " << endl; //myVars.print(app_log()); //app_log() << endl; V.resize(NumPtcls,BasisSize); Y.resize(NumPtcls,BasisSize); dY.resize(NumPtcls,BasisSize); d2Y.resize(NumPtcls,BasisSize); curGrad.resize(NumPtcls); curLap.resize(NumPtcls); curVal.resize(NumPtcls); tGrad.resize(NumPtcls); tLap.resize(NumPtcls); curV.resize(BasisSize); delV.resize(BasisSize); Uk.resize(NumPtcls); dUk.resize(NumPtcls,NumPtcls); d2Uk.resize(NumPtcls,NumPtcls); //app_log() << " Three-body Geminal coefficients " << endl; //app_log() << Lambda << endl; //GeminalBasis->resize(NumPtcls); return true; }
/** Create a two-body Jatrow function with a template *@param cur the current xmlNode *@param dummy null pointer used to identify FN * *The template class JeeType is a functor which handles the *evaluation of the function value, gradients and laplacians using *distance tables. This is a specialized builder function for *spin-dependent Jastrow function,e.g., for electrons, two functions *are created for uu(dd) and ud(du). */ template <class FN> TwoBodyJastrowOrbital<FN>* JAABuilder::createJAA(xmlNodePtr cur, const string& jname) { string corr_tag("correlation"); int ng = targetPtcl.groups(); int ia=0, ib=0, iab=0; xmlNodePtr gridPtr=NULL; cur = cur->children; const SpeciesSet& species(targetPtcl.getSpeciesSet()); typedef TwoBodyJastrowOrbital<FN> JeeType; JeeType *J2 = new JeeType(targetPtcl,targetPsi.is_manager()); typedef DiffTwoBodyJastrowOrbital<FN> dJ2Type; dJ2Type *dJ2 = new dJ2Type(targetPtcl); RealType rc=targetPtcl.Lattice.WignerSeitzRadius; int pairs=0; while (cur != NULL) { string cname((const char*)(cur->name)); if (cname == corr_tag) { string spA("u"); string spB("u"); OhmmsAttributeSet rAttrib; rAttrib.add(spA, "speciesA"); rAttrib.add(spA, "species1"); rAttrib.add(spB, "speciesB"); rAttrib.add(spB, "species2"); rAttrib.put(cur); if (spA==targetPsi.getName()) //could have used the particle name { spA=species.speciesName[0]; spB=species.speciesName[0]; } int ia = species.findSpecies(spA); int ib = species.findSpecies(spB); if (ia==species.size() || ia == species.size()) { APP_ABORT("JAABuilder::createJAA is trying to use invalid species"); } string pairID=spA+spB; FN *j= new FN; j->cutoff_radius=rc; j->put(cur); J2->addFunc(pairID,ia,ib,j); dJ2->addFunc(pairID,ia,ib,j); ++pairs; } cur = cur->next; } // while cur if (pairs) { J2->dPsi=dJ2; string j2name="J2_"+jname; targetPsi.addOrbital(J2,j2name); return J2; } else {//clean up and delete the twobody orbitals APP_ABORT("JAABuilder::put Failed to create Two-Body with "+jname); return 0; } }
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"); OrbitalBase* newJ = 0; //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; newJ = createJAA<ModPadeFunctor<RealType> >(cur,jastfunction); } else if (jastfunction == "modmcmillan") { app_log() << " Modified McMillan Jastrow function Two-Body Jastrow Function = " << jastfunction << endl; IgnoreSpin=true; newJ = createJAA<ModMcMillanJ2Functor<RealType> >(cur,jastfunction); } else if (jastfunction == "combomcmillan") { app_log() << " Combo McMillan Jastrow function Two-Body Jastrow Function = " << jastfunction << endl; IgnoreSpin=true; newJ = createJAA<comboMcMillanJ2Functor<RealType> >(cur,jastfunction); } else if (jastfunction == "mcmillan") { app_log() << " McMillan (LONG RANGE!) Two-Body Jastrow Function = " << jastfunction << endl; IgnoreSpin=true; SpeciesSet& species(targetPtcl.getSpeciesSet()); TwoBodyJastrowOrbital<McMillanJ2Functor<RealType> >* a = createJAA<McMillanJ2Functor<RealType> >(cur,jastfunction); species(species.addAttribute("J2_A"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->A; species(species.addAttribute("J2_B"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->B; newJ = a; } else if (jastfunction == "mcmillanj2g") { app_log() << " McMillan Two-Body Jastrow Function (Gaussian for r < 2.5) = " << jastfunction << endl; IgnoreSpin=true; SpeciesSet& species(targetPtcl.getSpeciesSet()); TwoBodyJastrowOrbital<McMillanJ2GFunctor<RealType> >* a = createJAA<McMillanJ2GFunctor<RealType> >(cur,jastfunction); species(species.addAttribute("J2_A"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->A; species(species.addAttribute("J2_B"),species.addSpecies(species.speciesName[targetPtcl.GroupID[0]])) = (a->F[a->F.size()-1])->B; newJ = a; } else if (jastfunction == "gaussian") { app_log() << " Gaussian function Two-Body Jastrow Function = " << jastfunction << endl; IgnoreSpin=true; newJ = createJAA<GaussianFunctor<RealType> >(cur,jastfunction); } else if (jastfunction == "shiftedgaussian") { app_log() << " Gaussian function Two-Body Jastrow Function = " << jastfunction << endl; IgnoreSpin=true; newJ = createJAA<TruncatedShiftedGaussianFunctor<RealType> >(cur,jastfunction); } else if (jastfunction == "padetwo2ndorderfunctor") { app_log() << " PadeTwo2ndOrderFunctor Jastrow function Two-Body Jastrow Function = " << jastfunction << endl; //IgnoreSpin=true; newJ = createJAA<PadeTwo2ndOrderFunctor<RealType> >(cur,jastfunction); } //} else if(jastfunction == "rpa") { // app_log() << " Two-Body Jastrow Function = " << jastfunction << endl; // RPAJastrow<RealType> *dummy = 0; // success = createJAA(cur,dummy); //} return (newJ != 0); }
bool TrialDMCCorrection::putSpecial(xmlNodePtr cur, QMCHamiltonian& h, ParticleSet& P ) { FirstHamiltonian = h.startIndex(); nObservables=0; nValues=0; resum=100000; int blockSeries(0); int blockFreq(0); OhmmsAttributeSet attrib; attrib.add(resum,"resum"); attrib.add(blockSeries,"max"); attrib.add(blockFreq,"frequency"); attrib.put(cur); // app_log()<<" Forward walking block size is "<< blockT<<"*Tau"<<endl; // P.phLength=0; bool FIRST=true; CountIndex = P.addPropertyHistory(1); P.PropertyHistory[CountIndex][0]=0; xmlNodePtr tcur = cur->children; while(tcur != NULL) { string cname((const char*)tcur->name); // app_log()<<cname<<endl; if(cname == "Observable") { string tagName("none"); int Hindex(-100); // int blockSeries(0); // int blockFreq(0); OhmmsAttributeSet Tattrib; Tattrib.add(tagName,"name"); // Tattrib.add(blockSeries,"max"); // Tattrib.add(blockFreq,"frequency"); Tattrib.put(tcur); int numProps = P.PropertyList.Names.size(); // Hindex = P.PropertyList.add(tagName); Hindex = h.getObservable(tagName)+NUMPROPERTIES; if(tagName=="LocalPotential") { Hindex=LOCALPOTENTIAL ; tagName="LocPot"; } else if (Hindex==(NUMPROPERTIES-1)){ app_log()<<"Not a valid H element("<<Hindex<<") Valid names are:"; for (int jk=0;jk<h.sizeOfObservables();jk++) app_log()<<" "<<h.getObservableName(jk); app_log()<<endl; exit(-1); } /* if ((Hindex==-100)){ app_log()<<" Hamiltonian Element "<<tagName<<" does not exist!! "<<Hindex<<endl; assert(Hindex>=0); }*/ Names.push_back(tagName); Hindices.push_back( Hindex); app_log()<<" Hamiltonian Element "<<tagName<<" was found at "<< Hindex<<endl; int numT=blockSeries/blockFreq ; nObservables+=1; nValues+=numT; app_log()<<" "<<numT<<" values will be calculated every "<<blockFreq<<"*tau H^-1"<<endl; vector<int> pms(3); pms[0]=blockFreq; pms[1]=numT; pms[2]=blockSeries+2; walkerLengths.push_back(pms); int maxWsize=blockSeries+2; int pindx = P.addPropertyHistory(maxWsize); // summed values. P.addPropertyHistory(numT); // number of times accumulated. For resum Pindices.push_back(pindx); // app_log()<<"pindex "<<pindx<<endl; } tcur = tcur->next; } app_log()<<"Total number of observables calculated:"<<nObservables<<endl; app_log()<<"Total number of values calculated:"<<nValues<<endl; Values.resize(nValues,0.0); EValues.resize(nValues,0.0); FWValues.resize(nValues,0.0); return true; }