32#include <rapidxml.hpp>
42 std::istreambuf_iterator<char>()) {
58 bool has_local_potential =
root_node_->first_node(
"local-potential");
59 bool has_nl_projectors =
root_node_->first_node(
"nonlocal-projectors");
60 bool has_semilocal_potentials =
61 root_node_->first_node(
"semilocal-potentials");
62 bool has_pseudo_wavefunctions =
63 root_node_->first_node(
"pseudo-wave-functions");
64 if (has_nl_projectors && has_local_potential) {
66 }
else if (has_semilocal_potentials && has_pseudo_wavefunctions) {
76 tag1 =
"nonlocal-projectors";
79 tag1 =
"semilocal-potentials";
86 rapidxml::xml_node<> *node =
root_node_->first_node(tag1.c_str());
88 node = node->first_node(tag2.c_str());
90 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
92 node = node->next_sibling(tag2.c_str());
100 rapidxml::xml_node<> *node =
root_node_->first_node(
"grid");
104 int size = value<int>(node->first_attribute(
"npts"));
106 std::istringstream stst(node->first_node(
"grid-data")->value());
107 for (
int ii = 0; ii <
size; ii++) {
113 assert(fabs(
grid_[0]) <= 1e-10);
123 for (
unsigned ii = 1; ii <
grid_.size() - 1; ii++)
143 return value<int>(
spec_node_->first_attribute(
"atomic-number"));
152 return value<double>(
spec_node_->first_node(
"valence-configuration")
153 ->first_attribute(
"total-valence-charge"));
160 rapidxml::xml_node<> *node =
spec_node_->first_node(
"exchange-correlation")
161 ->first_node(
"libxc-info")
162 ->first_node(
"functional");
164 if (value<std::string>(node->first_attribute(
"type")) ==
"exchange") {
166 value<int>(node->first_attribute(
"id")));
168 node = node->next_sibling(
"functional");
175 rapidxml::xml_node<> *node =
spec_node_->first_node(
"exchange-correlation")
176 ->first_node(
"libxc-info")
177 ->first_node(
"functional");
179 if (value<std::string>(node->first_attribute(
"type")) ==
"correlation") {
181 value<int>(node->first_attribute(
"id")));
183 node = node->next_sibling(
"functional");
192 rapidxml::xml_node<> *node =
root_node_->first_node(
"nonlocal-projectors");
194 node = node->first_node(
"proj");
196 int read_ic = value<int>(node->first_attribute(
"seq")) - 1;
197 nc = std::max(nc, read_ic + 1);
198 node = node->next_sibling(
"proj");
208 rapidxml::xml_node<> *node =
209 root_node_->first_node(
"nonlocal-projectors")->first_node(
"proj");
213 node = node->next_sibling(
"proj");
222 rapidxml::xml_node<> *node =
223 root_node_->first_node(
"nonlocal-projectors")->first_node(
"proj");
226 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
227 if (read_l ==
l) count++;
228 node = node->next_sibling(
"proj");
235 rapidxml::xml_node<> *node =
236 root_node_->first_node(
"nonlocal-projectors")->first_node(
"proj");
238 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
239 int read_ic = value<int>(node->first_attribute(
"seq")) - 1;
240 if (
l == read_l && ic == read_ic)
242 node = node->next_sibling(
"proj");
247 double d_ij(
int l,
int ic,
int jc)
const {
251 rapidxml::xml_node<> *node =
252 root_node_->first_node(
"nonlocal-projectors")->first_node(
"proj");
254 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
255 int read_ic = value<int>(node->first_attribute(
"seq")) - 1;
256 if (
l == read_l && ic == read_ic)
258 node = node->next_sibling(
"proj");
261 return value<double>(node->first_attribute(
"ekb"));
267 rapidxml::xml_node<> *node =
268 root_node_->first_node(
"pseudo-wave-functions")->first_node(
"pswf");
270 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
273 node = node->next_sibling(
"pswf");
279 rapidxml::xml_node<> *node =
280 root_node_->first_node(
"semilocal-potentials")->first_node(
"slps");
282 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
285 node = node->next_sibling(
"slps");
291 rapidxml::xml_node<> *node =
root_node_->first_node(
"pseudocore-charge");
297 for (
unsigned ii = 0; ii <
val.size(); ii++)
298 val[ii] /= 4.0 * M_PI;
305 for (
unsigned ii = 0; ii <
val.size(); ii++)
306 val[ii] /= 4.0 * M_PI;
310 return spec_node_->first_attribute(
"relativity")->value() ==
315 rapidxml::xml_node<> *node =
316 root_node_->first_node(
"nonlocal-projectors")->first_node(
"proj");
318 int read_l =
letter_to_l(node->first_attribute(
"l")->value());
319 int read_ic = value<int>(node->first_attribute(
"seq")) - 1;
320 if (
l == read_l && ic == read_ic) {
321 double read_j = value<double>(node->first_attribute(
"j"));
322 std::cout <<
l <<
" " << ic <<
" " << read_j << std::endl;
323 return lrint(2.0 * read_j);
325 node = node->next_sibling(
"proj");
333 bool potential_padding =
false)
const {
335 rapidxml::xml_node<> *node =
336 base_node->first_node(
"radfunc")->first_node(
"data");
339 if (node->first_attribute(
"npts"))
340 size = value<int>(node->first_attribute(
"npts"));
342 std::istringstream stst(node->value());
343 for (
int ii = 0; ii <
size; ii++)
346 if (potential_padding) {
347 for (
unsigned ii =
size; ii <
grid_.size(); ii++)
350 for (
unsigned ii =
size; ii <
grid_.size(); ii++)
Definition: anygrid.hpp:29
std::vector< double > grid_
Definition: anygrid.hpp:81
double mesh_spacing() const
Definition: anygrid.hpp:34
int mesh_size_
Definition: anygrid.hpp:83
std::vector< double > grid_weights_
Definition: anygrid.hpp:82
void interpolate(std::vector< double > &function) const
Definition: anygrid.hpp:61
std::string filename_
Definition: base.hpp:175
pseudopotential::type type_
Definition: base.hpp:185
int lmax_
Definition: base.hpp:186
Definition: element.hpp:34
double mass() const
Definition: element.hpp:73
static std::string trim(std::string str, const std::string &chars="\t\n\v\f\r ")
Definition: element.hpp:140
double valence_charge() const
Definition: psml.hpp:151
std::string symbol() const
Definition: psml.hpp:138
pseudopotential::exchange exchange() const
Definition: psml.hpp:158
double mass() const
Definition: psml.hpp:146
void projector(int l, int ic, std::vector< double > &val) const
Definition: psml.hpp:234
bool has_density()
Definition: psml.hpp:301
psml(const std::string &filename, bool uniform_grid=false)
Definition: psml.hpp:39
static int letter_to_l(const std::string &letter)
Definition: psml.hpp:359
bool has_radial_function(int l) const
Definition: psml.hpp:264
void density(std::vector< double > &val) const
Definition: psml.hpp:303
std::string description() const
Definition: psml.hpp:136
rapidxml::xml_node * spec_node_
Definition: psml.hpp:379
double d_ij(int l, int ic, int jc) const
Definition: psml.hpp:247
int size() const
Definition: psml.hpp:134
pseudopotential::correlation correlation() const
Definition: psml.hpp:173
bool has_total_angular_momentum() const
Definition: psml.hpp:309
pseudopotential::format format() const
Definition: psml.hpp:130
int llocal() const
Definition: psml.hpp:156
void radial_potential(int l, std::vector< double > &val) const
Definition: psml.hpp:278
int nprojectors_per_l(int l) const
Definition: psml.hpp:218
std::ifstream file_
Definition: psml.hpp:375
bool has_nlcc() const
Definition: psml.hpp:290
int projector_2j(int l, int ic) const
Definition: psml.hpp:314
std::vector< char > buffer_
Definition: psml.hpp:376
void read_function(rapidxml::xml_node<> *base_node, std::vector< double > &val, bool potential_padding=false) const
Definition: psml.hpp:332
rapidxml::xml_node * root_node_
Definition: psml.hpp:378
int atomic_number() const
Definition: psml.hpp:142
void radial_function(int l, std::vector< double > &val) const
Definition: psml.hpp:266
void nlcc_density(std::vector< double > &val) const
Definition: psml.hpp:295
rapidxml::xml_document doc_
Definition: psml.hpp:377
void local_potential(std::vector< double > &val) const
Definition: psml.hpp:203
int nprojectors() const
Definition: psml.hpp:207
int nchannels() const
Definition: psml.hpp:188
!The assertions are ignored if the code is compiled in not debug when !prints out the assertion string
Definition: global.h:58
void const fint const fint * val
Definition: iihash_low.cc:41
Definition: anygrid.hpp:27
correlation
Definition: base.hpp:74
format
Definition: base.hpp:49
exchange
Definition: base.hpp:64
ptrdiff_t l
Definition: operate_inc.c:51