31namespace pseudopotential {
33class upf :
public pseudopotential::anygrid {
36 upf(
bool uniform_grid) : pseudopotential::anygrid(uniform_grid) {}
38 double d_ij(
int l,
int i,
int j)
const {
39 assert(
l >= 0 &&
l <= lmax_);
40 assert(
i >= 0 &&
i <= nchannels());
41 assert(
j >= 0 &&
j <= nchannels());
43 return dij_[
l * nchannels() * nchannels() +
i * nchannels() +
j];
47 int llocal()
const {
return llocal_; }
49 int nchannels()
const {
return nchannels_; }
51 double &d_ij(
int l,
int i,
int j) {
52 assert(
l >= 0 &&
l <= lmax_);
53 assert(
i >= 0 &&
i <= nchannels());
54 assert(
j >= 0 &&
j <= nchannels());
56 return dij_[
l * nchannels() * nchannels() +
i * nchannels() +
j];
59 void extrapolate_first_point(std::vector<double> &function_)
const {
61 assert(function_.size() >= 4);
62 assert(grid_.size() >= 4);
67 double f1 = function_[1];
68 double f2 = function_[2];
69 double f3 = function_[3];
74 function_[0] =
f1 * x2 * x3 * (x2 - x3) +
f2 * x1 * x3 * (x3 - x1) +
75 f3 * x1 * x2 * (x1 - x2);
76 function_[0] /= (x1 - x2) * (x1 - x3) * (x2 - x3);
79 std::vector<double> dij_;