5#ifndef GEMMI_RECGRID_HPP_
6#define GEMMI_RECGRID_HPP_
26 return std::abs(
half_u ? u : 2 * u) < this->
nu &&
27 std::abs(2 * v) < this->
nv &&
28 std::abs(
half_w ? w : 2 * w) < this->
nw;
32 throw std::out_of_range(
"ReciprocalGrid: index out of grid.");
35 size_t index_n(
int u,
int v,
int w)
const {
36 return this->
index_q(u >= 0 ? u : u + this->
nu,
37 v >= 0 ? v : v + this->
nv,
38 w >= 0 ? w : w + this->
nw);
58 if (2 * point.
v >=
this->nv)
60 if (2 * point.
w >=
this->nw &&
64 std::swap(hkl[0], hkl[2]);
78 fail(
"get_value_by_hkl(): ZYX order is not supported yet");
83 value = this->
get_value(hkl[0], hkl[1], hkl[2]);
100 template <
typename R=T>
106 fail(
"get_asu_values(): ZYX order is not supported yet");
111 int max_h = (this->
nu - 1) / 2;
112 int max_k = (this->
nv - 1) / 2;
114 double max_1_d2 = 0.;
116 max_1_d2 = 1. / (dmin * dmin);
123 std::unique_ptr<GroupOps> gops;
127 for (hkl[0] = -
max_h; hkl[0] <=
max_h; ++hkl[0]) {
128 int hi = hkl[0] >= 0 ? hkl[0] : hkl[0] + this->
nu;
129 int hi_ = -hkl[0] >= 0 ? -hkl[0] : -hkl[0] + this->
nu;
130 for (hkl[1] = -
max_k; hkl[1] <=
max_k; ++hkl[1]) {
135 int ki_ = -hkl[1] >= 0 ? -hkl[1] : -hkl[1] + this->
nv;
136 for (; hkl[2] < 0; ++hkl[2])
137 if (asu.
is_in(hkl) &&
138 (max_1_d2 == 0. ||
this->unit_cell.calculate_1_d2(hkl) < max_1_d2) &&
143 int ki = hkl[1] >= 0 ? hkl[1] : hkl[1] + this->
nv;
144 for (; hkl[2] <=
max_l; ++hkl[2])
145 if (asu.
is_in(hkl) &&
147 (
with_sys_abs || !gops->is_systematically_absent(hkl)) &&
148 (
with_000 || !(hkl[0] == 0 && hkl[1] == 0 && hkl[2] == 0))) {
149 int li = hkl[2] >= 0 ? hkl[2] : hkl[2] + this->
nw;
AsuData for storing reflection data.
3d grids used by CCP4 maps, cell-method search and hkl data.
std::array< int, 3 > Miller
A synonym for convenient passing of hkl.
constexpr double mott_bethe_const()
T friedel_mate_value(T v)
void fail(const std::string &msg)
grid coordinates (modulo size) and a pointer to value
A common subset of Grid and ReciprocalGrid.
T get_value_q(int u, int v, int w) const
bool is_in(const Op::Miller &hkl) const
AsuData< R > prepare_asu_data(double dmin=0, double unblur=0, bool with_000=false, bool with_sys_abs=false, bool mott_bethe=false)
T get_value_by_hkl(Miller hkl, double unblur=0, bool mott_bethe=false) const
Miller to_hkl(const typename GridBase< T >::Point &point) const
size_t index_n(int u, int v, int w) const
T get_value(int u, int v, int w) const
size_t index_checked(int u, int v, int w) const
T get_value_or_zero(int u, int v, int w) const
double calculate_1_d2(const typename GridBase< T >::Point &point) const
void check_index(int u, int v, int w) const
double calculate_d(const typename GridBase< T >::Point &point) const
void set_value(int u, int v, int w, T x)
bool has_index(int u, int v, int w) const
double calculate_d(const Miller &hkl) const
Calculate d-spacing.
Miller get_hkl_limits(double dmin) const
double calculate_1_d2(const Miller &hkl) const