29 template<
class BasisBuilderT>
32 bool spinpolarized =
false;
33 typename BasisBuilderT::BasisSetType* basisSet = 0;
34 cur = cur->xmlChildrenNode;
38 if (cname ==
"coefficient" || cname ==
"coefficients")
45 basisSet->resize(nup + ndown);
46 agpDet = std::make_unique<AGPDeterminant>(basisSet);
47 agpDet->resize(nup, ndown);
50 xmlNodePtr tcur = cur->xmlChildrenNode;
53 if (xmlStrEqual(tcur->name, (
const xmlChar*)
"lambda"))
55 int i = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"i")));
56 int j = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"j")));
57 double c = atof((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"c")));
58 agpDet->Lambda(i - offset, j - offset) = c;
61 agpDet->Lambda(j - offset, i - offset) = c;
67 else if (cname ==
"unpaired")
71 xmlNodePtr tcur = cur->xmlChildrenNode;
74 if (xmlStrEqual(tcur->name, (
const xmlChar*)
"lambda"))
76 int i = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"i")));
77 int j = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"j")));
78 double c = atof((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"c")));
79 agpDet->LambdaUP(j - offset, i - offset) = c;
89 app_log() <<
" Coefficients for the unpaired electrons " << std::endl;
99 APP_ABORT(
" AGPDeterminantBuilder::put exits. AGPDeterminant has been already created.\n");
100 return std::unique_ptr<AGPDeterminant>();
102 app_log() <<
" AGPDeterminantBuilder Creating AGPDeterminant." << std::endl;
103 xmlNodePtr curRoot = cur;
106 xmlNodePtr cPtr = NULL;
107 xmlNodePtr uPtr = NULL;
116 if (cname.find(
"coeff") < cname.size())
120 else if (cname.find(
"un") < cname.size())
128 std::ostringstream err_msg;
129 err_msg <<
" AGPDeterminantBuilder::put Cannot create AGPDeterminant." << std::endl
130 <<
" Missing <coefficients/>" << std::endl;
145 myBasisSet->
resize(nup + ndown);
146 agpDet = std::make_unique<AGPDeterminant>(myBasisSet);
147 agpDet->resize(nup, ndown);
150 xmlNodePtr tcur = cPtr->xmlChildrenNode;
153 if (xmlStrEqual(tcur->name, (
const xmlChar*)
"lambda"))
155 int i = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"i")));
156 int j = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"j")));
157 double c = atof((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"c")));
158 agpDet->Lambda(i - offset, j - offset) = c;
161 agpDet->Lambda(j - offset, i - offset) = c;
168 tcur = uPtr->xmlChildrenNode;
171 if (xmlStrEqual(tcur->name, (
const xmlChar*)
"lambda"))
173 int i = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"i")));
174 int j = atoi((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"j")));
175 double c = atof((
const char*)(xmlGetProp(tcur, (
const xmlChar*)
"c")));
176 agpDet->LambdaUP(j - offset, i - offset) = c;
180 app_log() <<
" AGPDeterminantBuilder::put Coefficients for the unpaired electrons " << std::endl;
186 APP_ABORT(
"failed to create an AGP determinant!\n");
const PSetMap & ptclPool
reference to a PSetMap
declaration of a builder class for AGPDeterminant
helper functions for EinsplineSetBuilder
An abstract class for wave function builders.
bool put(xmlNodePtr cur)
assign attributes to the set
int first(int igroup) const
return the first index of a group i
base class for a basis set
std::unique_ptr< WaveFunctionComponent > buildComponent(xmlNodePtr cur) override
process a xml node at cur
bool createAGP(BasisBuilderT *abuilder, xmlNodePtr cur)
std::map< std::string, const std::unique_ptr< ParticleSet > > PSetMap
AGPDeterminantBuilder(Communicate *comm, ParticleSet &els, const PSetMap &pset)
ParticleSet & targetPtcl
reference to the particle set on which targetPsi is defined
Wrapping information on parallelism.
int groups() const
return the number of groups
Specialized paritlce class for atomistic simulations.
Communicate * myComm
pointer to Communicate
class to handle a set of attributes of an xmlNode
char * castXMLCharToChar(xmlChar *c)
assign a value from a node. Use specialization for classes.
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
std::unique_ptr< AGPDeterminant > agpDet
AGPDeterminant.
std::unique_ptr< SPOSetBuilderFactory > mySPOSetBuilderFactory
basiset Factory
void resize(int ntargets)
resize the container
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
std::string getNodeName(xmlNodePtr cur)