diff --git a/image_analysis/scale_merge/HKLKey.cpp b/image_analysis/scale_merge/HKLKey.cpp index 3bdbfe61..6929b804 100644 --- a/image_analysis/scale_merge/HKLKey.cpp +++ b/image_analysis/scale_merge/HKLKey.cpp @@ -68,6 +68,14 @@ HKLKey HKLKeyGenerator::operator()(int32_t h, int32_t k, int32_t l) const { return key; } +bool HKLKeyGenerator::IsSystematicallyAbsent(int32_t h, int32_t k, int32_t l) const { + return ops.is_systematically_absent(gemmi::Op::Miller{h, k, l}); +} + +bool HKLKeyGenerator::IsSystematicallyAbsent(const Reflection &r) const { + return IsSystematicallyAbsent(r.h, r.k, r.l); +} + bool AcceptReflection(const Reflection &r, std::optional d_min_limit) { if (!std::isfinite(r.I)) return false; diff --git a/image_analysis/scale_merge/HKLKey.h b/image_analysis/scale_merge/HKLKey.h index 51fbab48..70044c74 100644 --- a/image_analysis/scale_merge/HKLKey.h +++ b/image_analysis/scale_merge/HKLKey.h @@ -39,6 +39,9 @@ public: HKLKey operator()(const Reflection &r) const; HKLKey operator()(const MergedReflection &r) const; HKLKey operator()(int32_t h, int32_t k, int32_t l) const; + + bool IsSystematicallyAbsent(int32_t h, int32_t k, int32_t l) const; + bool IsSystematicallyAbsent(const Reflection &r) const; }; HKLKey CanonicalHKL(const Reflection &r, bool merge_friedel, const std::optional &sg); diff --git a/image_analysis/scale_merge/Merge.cpp b/image_analysis/scale_merge/Merge.cpp index 3c5e2fc4..4b383ddc 100644 --- a/image_analysis/scale_merge/Merge.cpp +++ b/image_analysis/scale_merge/Merge.cpp @@ -99,6 +99,9 @@ std::vector MergeAll(const DiffractionExperiment &x, if (reflections[i].empty()) continue; for (const auto &r: reflections[i]) { + if (key_generator.IsSystematicallyAbsent(r)) + continue; + if (r.image_scale_corr <= 0.0 || !std::isfinite(r.image_scale_corr)) continue; if (!AcceptReflection(r, high_resolution_limit)) @@ -286,6 +289,9 @@ MergeStatistics MergeStats(const DiffractionExperiment &x, continue; for (const auto &r: reflections[i]) { + if (key_generator.IsSystematicallyAbsent(r)) + continue; + if (r.image_scale_corr <= 0.0 || !std::isfinite(r.image_scale_corr)) continue;