Loading...
Searching...
No Matches
uniform_q_grid.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * UniformQGrid — metadata for a uniform q = |G| interpolation grid.
5 *
6 * Used by Fourier-transformed radial functions tabulated on a uniform q-grid
7 * (beta projectors, core charge, augmentation Q functions, etc.).
8 */
9
10#include <vector>
11
13
14namespace q3 {
15
19
20 /**
21 * Build a grid covering [0, maximum_q_value] with the given spacing.
22 */
23 static UniformQGrid from_maximum_q(Real maximum_q_value, Real q_spacing) {
24 UniformQGrid grid;
25 grid.q_spacing = q_spacing;
26 grid.number_of_q_points = static_cast<int>(maximum_q_value / q_spacing) + 4;
27 return grid;
28 }
29
30 /**
31 * q value at a grid index.
32 */
33 [[nodiscard]] Real q_at_index(int index) const {
34 return index * q_spacing;
35 }
36
37 /**
38 * All q values on the grid.
39 */
40 [[nodiscard]] std::vector<Real> q_point_values() const {
41 std::vector<Real> values(number_of_q_points);
42 for (int index = 0; index < number_of_q_points; index++) {
43 values[index] = q_at_index(index);
44 }
45 return values;
46 }
47};
48
49} // namespace q3
double Real
std::vector< Real > q_point_values() const
static UniformQGrid from_maximum_q(Real maximum_q_value, Real q_spacing)
Real q_at_index(int index) const