5#ifndef GEMMI_RECGRID_HPP_
6#define GEMMI_RECGRID_HPP_
28 return std::abs(
half_u ? u : 2 * u) < this->
nu &&
29 std::abs(2 * v) < this->
nv &&
30 std::abs(
half_w ? w : 2 * w) < this->
nw;
34 throw std::out_of_range(
"ReciprocalGrid: index out of grid.");
37 size_t index_n(
int u,
int v,
int w)
const {
38 return this->
index_q(u >= 0 ? u : u + this->
nu,
39 v >= 0 ? v : v + this->
nv,
40 w >= 0 ? w : w + this->
nw);
60 if (2 * point.
v >=
this->nv)
62 if (2 * point.
w >=
this->nw &&
66 std::swap(hkl[0], hkl[2]);
80 fail(
"get_value_by_hkl(): ZYX order is not supported yet");
85 value = this->
get_value(hkl[0], hkl[1], hkl[2]);
102 template <
typename R=T>
108 fail(
"get_asu_values(): ZYX order is not supported yet");
109 int max_h = (this->
nu - 1) / 2;
110 int max_k = (this->
nv - 1) / 2;
112 double max_1_d2 = 0.;
114 max_1_d2 = 1. / (dmin * dmin);
121 std::unique_ptr<GroupOps> gops;
125 for (hkl[0] = -
max_h; hkl[0] <=
max_h; ++hkl[0]) {
126 int hi = hkl[0] >= 0 ? hkl[0] : hkl[0] + this->
nu;
127 int hi_ = -hkl[0] >= 0 ? -hkl[0] : -hkl[0] + this->
nu;
128 for (hkl[1] = -
max_k; hkl[1] <=
max_k; ++hkl[1]) {
133 int ki_ = -hkl[1] >= 0 ? -hkl[1] : -hkl[1] + this->
nv;
134 for (; hkl[2] < 0; ++hkl[2])
135 if (asu.
is_in(hkl) &&
136 (max_1_d2 == 0. ||
this->unit_cell.calculate_1_d2(hkl) < max_1_d2) &&
141 int ki = hkl[1] >= 0 ? hkl[1] : hkl[1] + this->
nv;
142 for (; hkl[2] <=
max_l; ++hkl[2])
143 if (asu.
is_in(hkl) &&
145 (
with_sys_abs || !gops->is_systematically_absent(hkl)) &&
146 (
with_000 || !(hkl[0] == 0 && hkl[1] == 0 && hkl[2] == 0))) {
147 int li = hkl[2] >= 0 ? hkl[2] : hkl[2] + this->
nw;
signed char friedel_mate_value(signed char v)
std::array< int, 3 > Miller
A synonym for convenient passing of hkl.
constexpr double mott_bethe_const()
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