41 const std::vector<IntegerVector3D>& miller_indices,
42 const std::vector<Complex>& coefficients,
43 bool holds_half_sphere) {
45 grid.
init(grid_dimensions[0],
52 const std::size_t count = std::min(miller_indices.size(), coefficients.size());
53 for (std::size_t index = 0; index < count; index++) {
55 if (std::abs(miller.
x) > grid_dimensions[0] / 2 ||
56 std::abs(miller.
y) > grid_dimensions[1] / 2 ||
57 std::abs(miller.
z) > grid_dimensions[2] / 2) {
61 const bool is_origin = miller.
x == 0 && miller.
y == 0 && miller.
z == 0;
62 if (holds_half_sphere && !is_origin) {
64 std::conj(coefficients[index]);
75 const std::vector<IntegerVector3D>& miller_indices,
76 const std::vector<Complex>& coefficients,
77 bool holds_half_sphere) {
79 grid_dimensions, miller_indices, coefficients, holds_half_sphere);
80 std::vector<Real> field(complex_field.size());
81 for (std::size_t index = 0; index < complex_field.size(); index++)
82 field[index] = complex_field[index].real();
std::vector< Real > real_field_from_reciprocal_space(const std::array< int, 3 > &grid_dimensions, const std::vector< IntegerVector3D > &miller_indices, const std::vector< Complex > &coefficients, bool holds_half_sphere)
The same transform for a field that is real by construction, e.g. a density.
std::vector< Complex > complex_field_from_reciprocal_space(const std::array< int, 3 > &grid_dimensions, const std::vector< IntegerVector3D > &miller_indices, const std::vector< Complex > &coefficients, bool holds_half_sphere)