1#ifndef PSEUDO_ANYGRID_HPP
2#define PSEUDO_ANYGRID_HPP
27namespace pseudopotential {
29class anygrid :
public pseudopotential::base {
32 anygrid(
bool uniform_grid) : uniform_grid_(uniform_grid) {}
34 double mesh_spacing()
const {
return 0.01; }
36 int mesh_size()
const {
44 virtual void grid(std::vector<double> &val)
const {
46 pseudopotential::base::grid(val);
52 virtual void grid_weights(std::vector<double> &val)
const {
54 pseudopotential::base::grid(val);
61 void interpolate(std::vector<double> &function)
const {
65 std::vector<double> function_in_grid = function;
67 assert(function.size() == grid_.size());
69 Spline function_spline;
70 function_spline.fit(grid_.data(), function_in_grid.data(),
71 function_in_grid.size(), SPLINE_FLAT_BC,
75 for (
double rr = 0.0; rr <= grid_[grid_.size() - 1]; rr += mesh_spacing()) {
76 function.push_back(function_spline.value(rr));
81 std::vector<double> grid_;
82 std::vector<double> grid_weights_;