19 app_log() <<
" ECPComponentBuilder::buildL2 " << std::endl;
22 app_error() <<
" Global grid needs to be defined." << std::endl;
27 std::string eunits =
"hartree";
28 std::string format =
"r*V";
31 attrib.
add(eunits,
"units");
32 attrib.
add(format,
"format");
33 attrib.
add(rcut,
"cutoff");
38 if (eunits.find(
"ydberg") < eunits.size())
40 app_log() <<
" Input energy unit = Rydberg " << std::endl;
45 app_log() <<
" Assuming Hartree unit" << std::endl;
47 bool is_r_times_V(
true);
50 else if (format ==
"V")
54 app_error() <<
" Unrecognized format \"" << format <<
"\" in PP file." << std::endl;
59 app_error() <<
" L2 attribute cutoff is missing or negative. Cutoff must be a positive real number." << std::endl;
65 std::vector<RealType> vL2in(npts);
66 xmlNodePtr c = cur->children;
69 if (xmlStrEqual(c->name, (
const xmlChar*)
"radfunc"))
71 xmlNodePtr c1 = c->children;
74 if (xmlStrEqual(c1->name, (
const xmlChar*)
"data"))
85 app_log() <<
" Input pseudopotential is converted into r*V" << std::endl;
86 for (
int i = 0; i < npts; i++)
92 const int max_points = 100000;
93 app_log() <<
" Creating a Linear Grid Rmax=" << rmax << std::endl;
94 auto grid = std::make_unique<LinearGrid<RealType>>();
100 if (ng <= max_points)
104 grid->set(0.0, rmax, ng);
107 grid->set(0.0, rmax, max_points);
111 ng =
std::min(max_points, static_cast<int>(rmax / d) + 1);
112 grid->set(0, rmax, ng);
120 std::vector<RealType> new_vL2(ng);
121 std::vector<RealType> new_vL2in(ngIn);
122 for (
int i = 0; i < ngIn; i++)
123 new_vL2in[i] = Vprefactor * vL2in[i];
125 infunc.
spline(0, 0.0, ngIn - 1, 0.0);
126 for (
int i = 1; i < ng - 1; i++)
129 new_vL2[i] = infunc.splint(r) / r;
131 new_vL2[0] = new_vL2[1];
132 new_vL2[ng - 1] = 0.0;
133 auto vL2 = std::make_unique<RadialPotentialType>(std::move(grid), new_vL2);
137 pp_L2 = std::make_unique<L2RadialPotential>();
138 pp_L2->vL2 = std::move(vL2);
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
bool put(xmlNodePtr cur)
assign attributes to the set
std::ostream & app_error()
void spline(int imin, value_type yp1, int imax, value_type ypn) override
Evaluate the 2nd derivative on the grid points.
std::unique_ptr< mGridType > grid_global
MakeReturn< UnaryNode< FnCeil, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t ceil(const Vector< T1, C1 > &l)
Communicate * myComm
pointer to Communicate
Declaration of a builder class for an ECP component for an ionic type.
class to handle a set of attributes of an xmlNode
bool putContent(T &a, xmlNodePtr cur)
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
std::unique_ptr< L2RadialPotential > pp_L2
void buildL2(xmlNodePtr cur)
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