32#include <rapidxml.hpp>
36namespace pseudopotential {
38class upf2 :
public pseudopotential::upf {
41 upf2(
const std::string &filename,
bool uniform_grid =
false)
42 : pseudopotential::upf(uniform_grid), file_(filename.c_str()),
43 buffer_((std::istreambuf_iterator<char>(file_)),
44 std::istreambuf_iterator<char>()) {
48 buffer_.push_back(
'\0');
49 doc_.parse<0>(&buffer_[0]);
51 root_node_ = doc_.first_node(
"UPF");
54 throw status::FORMAT_NOT_SUPPORTED;
56 if (root_node_->first_attribute(
"version")->value()[0] !=
'2')
57 throw status::FORMAT_NOT_SUPPORTED;
59 std::string pseudo_type = root_node_->first_node(
"PP_HEADER")
60 ->first_attribute(
"pseudo_type")
63 if (pseudo_type ==
"NC" || pseudo_type ==
"SL") {
64 type_ = pseudopotential::type::KLEINMAN_BYLANDER;
65 }
else if (pseudo_type ==
"USPP") {
66 type_ = pseudopotential::type::ULTRASOFT;
67 }
else if (pseudo_type ==
"PAW") {
72 type_ = pseudopotential::type::PAW;
74 throw status::UNSUPPORTED_TYPE;
81 rapidxml::xml_base<> *xmin =
82 root_node_->first_node(
"PP_MESH")->first_attribute(
"xmin");
85 if (xmin &&
fabs(value<double>(xmin)) > 1.0e-10)
88 rapidxml::xml_node<> *node =
89 root_node_->first_node(
"PP_MESH")->first_node(
"PP_R");
93 rapidxml::xml_attribute<> *size_attr = node->first_attribute(
"size");
96 if (size_attr == NULL)
97 size_attr = root_node_->first_node(
"PP_MESH")->first_attribute(
"mesh");
99 if (size_attr == NULL)
100 throw status::FORMAT_NOT_SUPPORTED;
102 int size = value<int>(size_attr);
104 grid_.resize(size + start_point_);
105 std::istringstream stst(node->value());
107 for (
int ii = 0; ii < size; ii++)
108 stst >> grid_[start_point_ + ii];
110 assert(
fabs(grid_[0]) <= 1e-10);
114 rapidxml::xml_node<> *node =
115 root_node_->first_node(
"PP_MESH")->first_node(
"PP_RAB");
119 int size = get_size(node);
121 grid_weights_.resize(size + start_point_);
122 std::istringstream stst(node->value());
123 grid_weights_[0] = 0.5 * (grid_[1] - grid_[0]);
124 for (
int ii = 0; ii < size; ii++)
125 stst >> grid_weights_[start_point_ + ii];
128 for (
double rr = 0.0; rr <= grid_[grid_.size() - 1]; rr += mesh_spacing())
134 std::vector<bool> has_l(MAX_L,
false);
139 proj_l_.resize(nprojectors());
140 proj_c_.resize(nprojectors());
143 for (
int iproj = 0; iproj < nprojectors(); iproj++) {
144 std::ostringstream tag;
145 tag <<
"PP_BETA." << iproj + 1;
146 rapidxml::xml_node<> *node =
147 root_node_->first_node(
"PP_NONLOCAL")->first_node(tag.str().c_str());
151 int read_l = value<int>(node->first_attribute(
"angular_momentum"));
153 lmax_ = std::max(lmax_, read_l);
154 proj_l_[iproj] = read_l;
155 has_l[read_l] =
true;
160 for (
int jproj = 0; jproj < iproj; jproj++)
161 if (read_l == proj_l_[jproj])
164 nchannels_ = std::max(nchannels_, proj_c_[iproj] + 1);
170 for (
int l = 0;
l <= lmax_;
l++)
177 rapidxml::xml_node<> *node =
178 root_node_->first_node(
"PP_NONLOCAL")->first_node(
"PP_DIJ");
182 dij_.resize((lmax_ + 1) * nchannels_ * nchannels_);
184 for (
unsigned kk = 0; kk < dij_.size(); kk++)
187 std::istringstream stst(node->value());
188 for (
int ii = 0; ii < nprojectors(); ii++) {
189 for (
int jj = 0; jj < nprojectors(); jj++) {
193 if (proj_l_[ii] != proj_l_[jj]) {
194 assert(
fabs(val) < 1.0e-10);
199 d_ij(proj_l_[ii], proj_c_[ii], proj_c_[jj]) = val;
206 rapidxml::xml_node<> *node =
207 root_node_->first_node(
"PP_NONLOCAL")->first_node(
"PP_QIJ");
209 rapidxml::xml_node<> *augmentation =
210 root_node_->first_node(
"PP_NONLOCAL")->first_node(
"PP_AUGMENTATION");
211 if (node == NULL && augmentation != NULL)
212 node = augmentation->first_node(
"PP_Q");
215 qij_.resize((lmax_ + 1) * nchannels_ * nchannels_);
217 for (
unsigned kk = 0; kk < qij_.size(); kk++)
220 std::istringstream stst(node->value());
221 for (
int ii = 0; ii < nprojectors(); ii++) {
222 for (
int jj = 0; jj < nprojectors(); jj++) {
227 if (proj_l_[ii] != proj_l_[jj]) {
228 assert(
fabs(val) < 1.0e-10);
232 q_ij(proj_l_[ii], proj_c_[ii], proj_c_[jj]) = val;
238 read_radial_augmentation();
240 if (type_ == pseudopotential::type::PAW)
244 pseudopotential::format format()
const {
245 return pseudopotential::format::UPF2;
248 int size()
const {
return buffer_.size(); };
251 return root_node_->first_node(
"PP_INFO")->value();
255 return element::trim(root_node_->first_node(
"PP_HEADER")
256 ->first_attribute(
"element")
260 int atomic_number()
const {
261 element el(symbol());
262 return el.atomic_number();
265 double mass()
const {
266 element el(symbol());
270 double valence_charge()
const {
271 return value<double>(
272 root_node_->first_node(
"PP_HEADER")->first_attribute(
"z_valence"));
275 pseudopotential::exchange exchange()
const {
276 std::string functional = root_node_->first_node(
"PP_HEADER")
277 ->first_attribute(
"functional")
279 if (functional ==
"PBE")
280 return pseudopotential::exchange::PBE;
281 if (functional ==
"PBESOL")
282 return pseudopotential::exchange::PBE_SOL;
283 if (functional ==
"SLA PW NOGX NOGC")
284 return pseudopotential::exchange::LDA;
285 if (functional ==
"BLYP")
286 return pseudopotential::exchange::B88;
291 if (!has_dft_token(functional,
"SLA"))
292 return pseudopotential::exchange::UNKNOWN;
293 if (has_dft_token(functional,
"PSX"))
294 return pseudopotential::exchange::PBE_SOL;
295 if (has_dft_token(functional,
"PBX"))
296 return pseudopotential::exchange::PBE;
297 if (has_dft_token(functional,
"B88"))
298 return pseudopotential::exchange::B88;
299 if (has_dft_token(functional,
"NOGX"))
300 return pseudopotential::exchange::LDA;
301 return pseudopotential::exchange::UNKNOWN;
304 pseudopotential::correlation correlation()
const {
305 std::string functional = root_node_->first_node(
"PP_HEADER")
306 ->first_attribute(
"functional")
308 if (functional ==
"PBE")
309 return pseudopotential::correlation::PBE;
310 if (functional ==
"PBESOL")
311 return pseudopotential::correlation::PBE_SOL;
312 if (functional ==
"SLA PW NOGX NOGC")
313 return pseudopotential::correlation::LDA_PW;
314 if (functional ==
"BLYP")
315 return pseudopotential::correlation::LYP;
319 if (has_dft_token(functional,
"LYP"))
320 return pseudopotential::correlation::LYP;
321 if (!has_dft_token(functional,
"PW"))
322 return pseudopotential::correlation::UNKNOWN;
323 if (has_dft_token(functional,
"PSC"))
324 return pseudopotential::correlation::PBE_SOL;
325 if (has_dft_token(functional,
"PBC"))
326 return pseudopotential::correlation::PBE;
327 if (has_dft_token(functional,
"NOGC"))
328 return pseudopotential::correlation::LDA_PW;
329 return pseudopotential::correlation::UNKNOWN;
332 void local_potential(std::vector<double> &potential)
const {
333 rapidxml::xml_node<> *node = root_node_->first_node(
"PP_LOCAL");
337 int size = get_size(node);
339 potential.resize(size + start_point_);
340 std::istringstream stst(node->value());
341 for (
int ii = 0; ii < size; ii++) {
342 stst >> potential[ii + start_point_];
343 potential[ii + start_point_] *= 0.5;
345 if (start_point_ > 0)
346 extrapolate_first_point(potential);
348 interpolate(potential);
351 int nprojectors()
const {
353 root_node_->first_node(
"PP_HEADER")->first_attribute(
"number_of_proj"));
356 int nprojectors_per_l(
int l)
const {
359 for (
int jproj = 0; jproj < nprojectors(); jproj++)
360 if (proj_l_[jproj] ==
l)
361 nchannel = std::max(proj_c_[jproj]+1, nchannel);
365 void projector(
int l,
int i, std::vector<double> &proj)
const {
366 rapidxml::xml_node<> *node = NULL;
369 while (iproj < nprojectors() && (
l != proj_l_[iproj] ||
i != proj_c_[iproj])) {
372 std::stringstream tag;
373 tag <<
"PP_BETA." << iproj+1;
374 node = root_node_->first_node(
"PP_NONLOCAL")->first_node(tag.str().c_str());
378 int size = get_size(node);
380 proj.resize(size + start_point_);
381 std::istringstream stst(node->value());
382 for (
int ii = 0; ii < size; ii++)
383 stst >> proj[ii + start_point_];
387 for (
int ii = 1; ii < size + start_point_; ii++)
388 proj[ii] /= grid_[ii];
389 extrapolate_first_point(proj);
394 bool has_radial_function(
int l)
const {
return false; }
396 void radial_function(
int l, std::vector<double> &function)
const {
400 void radial_potential(
int l, std::vector<double> &function)
const {
404 bool has_nlcc()
const {
return root_node_->first_node(
"PP_NLCC"); }
406 void nlcc_density(std::vector<double> &density)
const {
407 rapidxml::xml_node<> *node = root_node_->first_node(
"PP_NLCC");
410 int size = get_size(node);
412 density.resize(size + start_point_);
414 std::istringstream stst(node->value());
415 for (
int ii = 0; ii < size; ii++)
416 stst >> density[start_point_ + ii];
417 extrapolate_first_point(density);
420 interpolate(density);
423 bool has_total_angular_momentum()
const {
424 return root_node_->first_node(
"PP_SPIN_ORB");
427 void beta(
int iproj,
int &
l, std::vector<double> &proj)
const {
428 rapidxml::xml_node<> *node = NULL;
430 std::stringstream tag;
431 tag <<
"PP_BETA." << iproj + 1;
432 node = root_node_->first_node(
"PP_NONLOCAL")->first_node(tag.str().c_str());
436 l = value<int>(node->first_attribute(
"angular_momentum"));
438 int size = get_size(node);
440 proj.resize(size + start_point_);
441 std::istringstream stst(node->value());
442 for (
int ii = 0; ii < size; ii++)
443 stst >> proj[ii + start_point_];
447 for (
int ii = 1; ii < size + start_point_; ii++)
448 proj[ii] /= grid_[ii];
449 extrapolate_first_point(proj);
454 void dnm_zero(
int nbeta, std::vector<std::vector<double>> &dnm)
const {
456 for (
int i = 0;
i < nbeta;
i++) {
457 dnm[
i].resize(nbeta);
458 for (
int j = 0;
j < nbeta;
j++) {
459 dnm[
i][
j] = dij_[
i * nbeta +
j];
464 bool has_density()
const {
return root_node_->first_node(
"PP_RHOATOM"); }
466 void density(std::vector<double> &val)
const {
467 rapidxml::xml_node<> *node = root_node_->first_node(
"PP_RHOATOM");
470 int size = get_size(node);
472 val.resize(size + start_point_);
474 std::istringstream stst(node->value());
475 for (
int ii = 0; ii < size; ii++)
476 stst >> val[start_point_ + ii];
479 for (
int ii = 1; ii < size + start_point_; ii++)
480 val[ii] /= 4.0 * M_PI * grid_[ii] * grid_[ii];
481 extrapolate_first_point(val);
486 int nwavefunctions()
const {
488 root_node_->first_node(
"PP_HEADER")->first_attribute(
"number_of_wfc"));
491 void wavefunction(
int index,
int &n,
int &
l,
double &occ,
492 std::vector<double> &proj)
const {
493 rapidxml::xml_node<> *node = NULL;
495 std::stringstream tag;
496 tag <<
"PP_CHI." <<
index + 1;
497 node = root_node_->first_node(
"PP_PSWFC")->first_node(tag.str().c_str());
501 l = value<int>(node->first_attribute(
"l"));
506 if (node->first_attribute(
"n")) {
507 n = value<int>(node->first_attribute(
"n"));
508 }
else if (node->first_attribute(
"label")) {
509 std::string label = node->first_attribute(
"label")->value();
510 n = atoi(label.substr(0, 1).c_str());
515 occ = value<double>(node->first_attribute(
"occupation"));
517 int size = get_size(node);
519 proj.resize(size + start_point_);
520 std::istringstream stst(node->value());
521 for (
int ii = 0; ii < size; ii++)
522 stst >> proj[ii + start_point_];
526 for (
int ii = 1; ii < size + start_point_; ii++)
527 proj[ii] /= grid_[ii];
528 extrapolate_first_point(proj);
534 int projector_2j(
int l,
int ic)
const {
539 for (
int iproj = 0; iproj < nprojectors(); iproj++) {
540 std::stringstream tag;
541 tag <<
"PP_RELBETA." << iproj + 1;
543 rapidxml::xml_node<> *node =
544 root_node_->first_node(
"PP_SPIN_ORB")->first_node(tag.str().c_str());
547 std::string labell = node->first_attribute(
"lll")->value();
548 if(atoi(labell.c_str()) ==
l && proj_c_[iproj] == ic){
549 std::string labelj = node->first_attribute(
"jjj")->value();
550 double j = atof(labelj.c_str());
552 return lrint(
j * 2.0);
561 int wavefunction_2j(
int ii)
const {
563 std::stringstream tag;
564 tag <<
"PP_RELWFC." << ii;
566 rapidxml::xml_node<> *node =
567 root_node_->first_node(
"PP_SPIN_ORB")->first_node(tag.str().c_str());
570 std::string label = node->first_attribute(
"jchi")->value();
571 double j = atof(label.c_str());
573 return lrint(
j * 2.0);
581 bool has_paw()
const {
return type_ == pseudopotential::type::PAW; }
583 int paw_nwavefunctions()
const {
584 rapidxml::xml_node<> *node = root_node_->first_node(
"PP_FULL_WFC");
587 rapidxml::xml_attribute<> *attr = node->first_attribute(
"number_of_wfc");
590 return value<int>(attr);
593 void paw_ae_wavefunction(
int index, std::vector<double> &val)
const {
594 read_full_wfc(
"PP_AEWFC",
index, val);
597 void paw_ps_wavefunction(
int index, std::vector<double> &val)
const {
598 read_full_wfc(
"PP_PSWFC",
index, val);
601 bool paw_has_rel_wavefunctions()
const {
602 rapidxml::xml_node<> *full = root_node_->first_node(
"PP_FULL_WFC");
605 return full->first_node(
"PP_AEWFC_REL.1") != NULL;
608 void paw_ae_wavefunction_rel(
int index, std::vector<double> &val)
const {
609 read_full_wfc(
"PP_AEWFC_REL",
index, val);
612 bool has_paw_ae_nlcc()
const {
613 rapidxml::xml_node<> *paw = root_node_->first_node(
"PP_PAW");
614 return paw != NULL && paw->first_node(
"PP_AE_NLCC") != NULL;
617 void paw_ae_nlcc(std::vector<double> &val)
const {
618 read_paw_radial(
"PP_AE_NLCC", val,
false);
621 void paw_ae_vlocal(std::vector<double> &val)
const {
626 read_paw_radial(
"PP_AE_VLOC", val,
true);
629 void paw_occupations(std::vector<double> &val)
const {
630 read_plain_array(required_node(paw_node(),
"PP_OCCUPATIONS"), val,
634 void paw_multipoles(std::vector<double> &val)
const {
635 read_plain_array(required_node(augmentation_node(),
"PP_MULTIPOLES"), val,
636 nprojectors() * nprojectors() * (paw_augmentation_lmax() + 1));
639 int paw_augmentation_lmax()
const {
640 rapidxml::xml_node<> *aug = augmentation_node();
644 rapidxml::xml_attribute<> *attr = aug->first_attribute(
"lmax_aug");
646 attr = aug->first_attribute(
"l_max_aug");
649 return value<int>(attr);
653 rapidxml::xml_node<> *aug = augmentation_node();
656 rapidxml::xml_attribute<> *attr = aug->first_attribute(
"shape");
664 double paw_cutoff_radius()
const {
665 rapidxml::xml_node<> *aug = augmentation_node();
668 rapidxml::xml_attribute<> *attr = aug->first_attribute(
"cutoff_r");
669 if (attr != NULL && value<double>(attr) > 0.0)
670 return value<double>(attr);
673 attr = aug->first_attribute(
"cutoff_r_index");
676 int index = value<int>(attr);
677 if (index < 1 || start_point_ + index - 1 >= (
int)grid_.size())
679 return grid_[start_point_ +
index - 1];
682 double paw_core_energy()
const {
683 rapidxml::xml_node<> *paw = root_node_->first_node(
"PP_PAW");
686 rapidxml::xml_attribute<> *attr = paw->first_attribute(
"core_energy");
689 return 0.5 * value<double>(attr);
695 int paw_ncore_orbitals()
const {
696 rapidxml::xml_node<> *orbs = core_orbitals_node();
699 rapidxml::xml_attribute<> *attr =
700 orbs->first_attribute(
"number_of_core_orbitals");
703 return value<int>(attr);
706 void paw_core_orbital(
int index, std::vector<double> &val)
const {
708 rapidxml::xml_node<> *node = core_orbital_node(
index);
711 int size = get_size(node);
712 val.resize(size + start_point_);
713 std::istringstream stst(node->value());
714 for (
int ii = 0; ii < size; ii++)
715 stst >> val[ii + start_point_];
717 for (
int ii = 1; ii < size + start_point_; ii++)
718 val[ii] /= grid_[ii];
719 extrapolate_first_point(val);
724 int paw_core_orbital_l(
int index)
const {
725 return core_orbital_attr_int(
index,
"l");
728 int paw_core_orbital_n(
int index)
const {
729 return core_orbital_attr_int(
index,
"n");
736 std::istringstream words(dft);
738 while (words >> word) {
739 if (word.size() != token.size())
743 if (std::toupper(
static_cast<unsigned char>(word[ii])) !=
744 std::toupper(
static_cast<unsigned char>(token[ii]))) {
755 rapidxml::xml_node<> *core_orbitals_node()
const {
756 rapidxml::xml_node<> *gipaw = root_node_->first_node(
"PP_GIPAW");
759 return gipaw->first_node(
"PP_GIPAW_CORE_ORBITALS");
762 rapidxml::xml_node<> *core_orbital_node(
int index)
const {
763 rapidxml::xml_node<> *orbs = core_orbitals_node();
766 std::ostringstream tag;
767 tag <<
"PP_GIPAW_CORE_ORBITAL." <<
index + 1;
768 return orbs->first_node(tag.str().c_str());
774 int core_orbital_attr_int(
int index,
const char *name)
const {
775 rapidxml::xml_node<> *node = core_orbital_node(
index);
777 rapidxml::xml_attribute<> *attr = node->first_attribute(name);
779 return lrint(value<double>(attr));
782 rapidxml::xml_node<> *augmentation_node()
const {
783 rapidxml::xml_node<> *nonlocal = root_node_->first_node(
"PP_NONLOCAL");
784 if (nonlocal == NULL)
786 return nonlocal->first_node(
"PP_AUGMENTATION");
789 rapidxml::xml_node<> *paw_node()
const {
790 return root_node_->first_node(
"PP_PAW");
796 static rapidxml::xml_node<> *required_node(rapidxml::xml_node<> *parent,
799 throw status::FORMAT_NOT_SUPPORTED;
800 rapidxml::xml_node<> *node = parent->first_node(name);
802 throw status::FORMAT_NOT_SUPPORTED;
809 void check_paw_nodes()
const {
810 rapidxml::xml_node<> *full = required_node(root_node_,
"PP_FULL_WFC");
811 int nwfc = paw_nwavefunctions();
812 if (nwfc != nprojectors())
813 throw status::FORMAT_NOT_SUPPORTED;
814 for (
int ii = 0; ii < nwfc; ii++) {
815 std::ostringstream ae, ps;
816 ae <<
"PP_AEWFC." << ii + 1;
817 ps <<
"PP_PSWFC." << ii + 1;
818 required_node(full, ae.str().c_str());
819 required_node(full, ps.str().c_str());
821 required_node(paw_node(),
"PP_AE_VLOC");
822 required_node(paw_node(),
"PP_OCCUPATIONS");
823 required_node(augmentation_node(),
"PP_MULTIPOLES");
824 if (paw_augmentation_lmax() < 0)
825 throw status::FORMAT_NOT_SUPPORTED;
830 static void read_values(rapidxml::xml_node<> *node,
int size,
int offset,
831 std::vector<double> &val) {
832 std::istringstream stst(node->value());
833 for (
int ii = 0; ii < size; ii++) {
834 stst >> val[ii + offset];
836 throw status::FORMAT_NOT_SUPPORTED;
842 void read_full_wfc(
const char *prefix,
int index,
843 std::vector<double> &val)
const {
844 std::ostringstream tag;
845 tag << prefix <<
"." <<
index + 1;
846 rapidxml::xml_node<> *node = required_node(
847 root_node_->first_node(
"PP_FULL_WFC"), tag.str().c_str());
849 int size = get_size(node);
850 val.resize(size + start_point_);
851 read_values(node, size, start_point_, val);
853 for (
int ii = 1; ii < size + start_point_; ii++)
854 val[ii] /= grid_[ii];
855 extrapolate_first_point(val);
862 void read_paw_radial(
const char *name, std::vector<double> &val,
863 bool rydberg)
const {
864 rapidxml::xml_node<> *node = required_node(paw_node(), name);
866 int size = get_size(node);
867 val.resize(size + start_point_);
868 read_values(node, size, start_point_, val);
870 for (
int ii = start_point_; ii < size + start_point_; ii++)
872 extrapolate_first_point(val);
880 void read_plain_array(rapidxml::xml_node<> *node, std::vector<double> &val,
881 int default_size = -1)
const {
882 rapidxml::xml_attribute<> *size_attr = node->first_attribute(
"size");
883 int size = default_size;
884 if (size_attr != NULL)
885 size = value<int>(size_attr);
887 throw status::FORMAT_NOT_SUPPORTED;
889 read_values(node, size, 0, val);
892 bool attr_is_true(rapidxml::xml_attribute<> *attr)
const {
897 std::transform(val.begin(), val.end(), val.begin(), ::tolower);
899 return val ==
"t" || val ==
"true" || val ==
".true." || val ==
"1";
902 rapidxml::xml_node<> *first_child(rapidxml::xml_node<> *parent,
907 return parent->first_node(name.c_str());
910 void read_radial_augmentation() {
911 rapidxml::xml_node<> *nonlocal = root_node_->first_node(
"PP_NONLOCAL");
912 rapidxml::xml_node<> *augmentation =
913 first_child(nonlocal,
"PP_AUGMENTATION");
915 if (augmentation == NULL)
918 bool with_l = attr_is_true(augmentation->first_attribute(
"q_with_l"));
919 int lmax_aug = with_l ? 2 * lmax_ : 0;
921 initialize_radial_augmentation(with_l, lmax_aug);
923 for (
int ii = 0; ii < nprojectors(); ii++) {
924 for (
int jj = ii; jj < nprojectors(); jj++) {
926 for (
int ltot = std::abs(proj_l_[ii] - proj_l_[jj]);
927 ltot <= proj_l_[ii] + proj_l_[jj]; ltot += 2) {
928 std::ostringstream tag;
929 tag <<
"PP_QIJL." << ii + 1 <<
"." << jj + 1 <<
"." << ltot;
930 read_radial_augmentation_node(augmentation, tag.str(), ii, jj,
934 std::ostringstream tag;
935 tag <<
"PP_QIJ." << ii + 1 <<
"." << jj + 1;
936 read_radial_augmentation_node(augmentation, tag.str(), ii, jj, 0);
942 void read_radial_augmentation_node(rapidxml::xml_node<> *augmentation,
945 rapidxml::xml_node<> *node = augmentation->first_node(tag.c_str());
950 rapidxml::xml_attribute<> *l_attr = node->first_attribute(
"angular_momentum");
952 assert(value<int>(l_attr) == ltot);
954 rapidxml::xml_attribute<> *index_attr =
955 node->first_attribute(
"composite_index");
956 if (index_attr != NULL)
957 assert(value<int>(index_attr) == (jj + 1) * jj / 2 + ii + 1);
959 int size = get_size(node);
960 assert(size + start_point_ ==
int(grid_.size()));
962 std::vector<double> val(grid_.size(), 0.0);
963 std::istringstream stst(node->value());
964 for (
int ip = 0; ip < size; ip++) {
965 stst >> val[start_point_ + ip];
976 while (ip0 <
int(val.size()) && grid_[ip0] <= 1e-10)
978 for (
int ip = ip0; ip < int(val.size()); ip++)
979 val[ip] /= grid_[ip] * grid_[ip];
982 if (grid_.size() > 1 && grid_[0] <= 1e-10)
985 set_radial_augmentation(ii, jj, ltot, val);
988 int get_size(
const rapidxml::xml_node<> *node)
const {
989 int size = grid_.size() - start_point_;
991 rapidxml::xml_attribute<> *size_attr = node->first_attribute(
"size");
993 if (size_attr != NULL)
994 size = value<int>(size_attr);
1000 std::vector<char> buffer_;
1001 rapidxml::xml_document<> doc_;
1002 rapidxml::xml_node<> *root_node_;
1003 std::vector<int> proj_l_;
1004 std::vector<int> proj_c_;
if write to the Free Software Franklin Fifth USA !The assertions are ignored if the code is compiled in not debug when !prints out the assertion string
double fabs(double __x) __attribute__((__nothrow__
const int *restrict index