31 int sets_needed = nsets -
states.size();
33 for (
int s = 0;
s < sets_needed; ++
s)
34 states.push_back(std::make_unique<SPOSetInfo>());
47 std::string spo_object_name;
51 attrib.
add(spo_object_name,
"id");
52 attrib.
add(spo_object_name,
"name");
57 app_summary() <<
" Single particle orbitals (SPO)" << std::endl;
58 app_summary() <<
" ------------------------------" << std::endl;
60 <<
" Builder class name: " <<
ClassName << std::endl;
63 if (spo_object_name.empty())
72 std::unique_ptr<SPOSet> sposet;
91 app_warning() <<
"Specifying orbital rotation via optimize tag is deprecated. Use the rotated_spo element instead" 94 sposet->storeParamsBeforeRotation();
96 auto& sposet_ref = *sposet;
97 app_log() <<
" SPOSet " << sposet_ref.getName() <<
" is optimizable\n";
98 if (!sposet_ref.isRotationSupported())
100 sposet_ref.getClassName() +
"'.");
101 auto rot_spo = std::make_unique<RotatedSPOs>(sposet_ref.getName(), std::move(sposet));
102 xmlNodePtr tcur = cur->xmlChildrenNode;
105 std::string cname((
const char*)(tcur->name));
106 if (cname ==
"opt_vars")
108 std::vector<RealType> params;
110 rot_spo->setRotationParameters(params);
114 sposet = std::move(rot_spo);
117 if (sposet->getName().empty())
118 app_warning() <<
"SPOSet object doesn't have a name." << std::endl;
119 if (!spo_object_name.empty() && sposet->getName() != spo_object_name)
120 app_warning() <<
"SPOSet object name mismatched! input name: " << spo_object_name
121 <<
" object name: " << sposet->getName() << std::endl;
123 sposet->checkObject();
129 std::string spo_object_name;
132 attrib.
add(spo_object_name,
"name");
133 attrib.
add(method,
"method", {
"global",
"history"});
136 std::unique_ptr<SPOSet> sposet;
137 processChildren(cur, [&](
const std::string& cname,
const xmlNodePtr element) {
138 if (cname ==
"sposet")
147 if (!sposet->isRotationSupported())
149 sposet->getClassName() +
"'.");
151 sposet->storeParamsBeforeRotation();
152 auto rot_spo = std::make_unique<RotatedSPOs>(spo_object_name, std::move(sposet));
154 if (method ==
"history")
155 rot_spo->set_use_global_rotation(
false);
157 processChildren(cur, [&](
const std::string& cname,
const xmlNodePtr element) {
158 if (cname ==
"opt_vars")
160 std::vector<RealType> params;
162 rot_spo->setRotationParameters(params);
std::ostream & app_warning()
Base class for any object which needs to know about a MPI communicator.
helper functions for EinsplineSetBuilder
class to read state range information from sposet input
std::unique_ptr< SPOSet > createSPOSet(xmlNodePtr cur)
create an sposet from xml and save the resulting SPOSet
void reserve_states(int nsets=1)
reserve space for states (usually only one set, multiple for e.g. spin dependent einspline) ...
std::ostream & app_summary()
bool put(xmlNodePtr cur)
assign attributes to the set
std::vector< std::unique_ptr< SPOSetInfo > > states
state info of all possible states available in the basis
SPOSetBuilder(const std::string &type_name, Communicate *comm)
Wrapping information on parallelism.
Declaration of a base class of SPOSet Builders.
Communicate * myComm
pointer to Communicate
class to handle a set of attributes of an xmlNode
This a subclass for runtime errors that will occur on all ranks.
std::string ClassName
class Name
const std::string type_name_
type name of the SPO objects built by this builder.
bool putContent(T &a, xmlNodePtr cur)
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
void processChildren(const xmlNodePtr cur, const F &functor)
process through all the children of an XML element F is a lambda or functor void F/[](const std::stri...
virtual std::unique_ptr< SPOSet > createSPOSetFromXML(xmlNodePtr cur)=0
create an sposet from xml (legacy)
void barrier_and_abort(const std::string &msg) const
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
std::unique_ptr< SPOSet > createRotatedSPOSet(xmlNodePtr cur)
create orbital rotation transformation from xml and save the resulting SPOSet
bool legacy
whether implementation conforms only to legacy standard