Compare commits

...

1 Commits

Author SHA1 Message Date
leonarski_f 2fa9293fda HKLKeyGenerator: Make HKLKeyGenerator having already prebuilt gemmi data structures
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 15m38s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m32s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 17m5s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 17m12s
Build Packages / build:rpm (rocky8) (push) Successful in 17m26s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 18m4s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 18m41s
Build Packages / build:rpm (rocky9) (push) Successful in 11m20s
Build Packages / Generate python client (push) Successful in 35s
Build Packages / Build documentation (push) Successful in 1m2s
Build Packages / Create release (push) Skipped
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m45s
Build Packages / XDS test (neggia plugin) (push) Successful in 11m6s
Build Packages / XDS test (durin plugin) (push) Successful in 12m27s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 13m33s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 12m48s
Build Packages / DIALS test (push) Successful in 15m5s
Build Packages / Unit tests (push) Successful in 1h1m39s
2026-05-12 19:38:15 +02:00
6 changed files with 26 additions and 18 deletions
+11 -7
View File
@@ -6,8 +6,16 @@
#include "HKLKey.h"
#include "gemmi/symmetry.hpp"
HKLKeyGenerator::HKLKeyGenerator(bool merge_friedel, const std::optional<gemmi::SpaceGroup> &sg)
: merge_friedel(merge_friedel), sg(sg) {}
HKLKeyGenerator::HKLKeyGenerator(bool merge_friedel, int32_t space_group_number)
: HKLKeyGenerator(merge_friedel, *gemmi::find_spacegroup_by_number(space_group_number)) {
}
HKLKeyGenerator::HKLKeyGenerator(bool merge_friedel, const gemmi::SpaceGroup &sg)
: merge_friedel(merge_friedel),
sg(sg),
ops(sg.operations()),
asu(&sg) {
}
HKLKey HKLKeyGenerator::operator()(const MergedReflection &r) const {
return operator()(r.h, r.k, r.l);
@@ -20,7 +28,7 @@ HKLKey HKLKeyGenerator::operator()(const Reflection &r) const {
HKLKey HKLKeyGenerator::operator()(int32_t h, int32_t k, int32_t l) const {
HKLKey key{h, k, l, true};
if (!sg.has_value()) {
if (sg.number == 1) {
const HKLKey neg{-h, -k, -l, true};
if (std::tie(key.h, key.k, key.l) < std::tie(neg.h, neg.k, neg.l)) {
key.h = -key.h;
@@ -29,10 +37,6 @@ HKLKey HKLKeyGenerator::operator()(int32_t h, int32_t k, int32_t l) const {
key.plus = merge_friedel;
}
} else {
const auto sg_local = sg.value();
const auto ops = sg_local.operations();
const gemmi::ReciprocalAsu asu(&sg_local);
const gemmi::Op::Miller in{h, k, l};
const auto [hkl, sign_plus] = asu.to_asu_sign(in, ops);
+6 -2
View File
@@ -23,9 +23,13 @@ struct HKLKey {
class HKLKeyGenerator {
bool merge_friedel;
std::optional<gemmi::SpaceGroup> sg;
gemmi::SpaceGroup sg;
gemmi::GroupOps ops;
gemmi::ReciprocalAsu asu;
public:
HKLKeyGenerator(bool merge_friedel, const std::optional<gemmi::SpaceGroup> &sg);
HKLKeyGenerator(bool merge_friedel, int32_t space_group_number);
HKLKeyGenerator(bool merge_friedel, const gemmi::SpaceGroup &sg);
HKLKey operator()(const Reflection &r) const;
HKLKey operator()(const MergedReflection &r) const;
HKLKey operator()(int32_t h, int32_t k, int32_t l) const;
+1 -1
View File
@@ -41,7 +41,7 @@ namespace {
auto scaling_settings = x.GetScalingSettings();
HKLKeyGenerator key_generator(scaling_settings.GetMergeFriedel(), x.GetGemmiSpaceGroup() );
HKLKeyGenerator key_generator(scaling_settings.GetMergeFriedel(), x.GetSpaceGroupNumber().value_or(1) );
for (const auto &image: observations) {
for (const auto &r: image) {
+5 -6
View File
@@ -92,10 +92,10 @@ ScaleOnTheFly::ScaleOnTheFly(const std::vector<MergedReflection> &ref, const Dif
model(x.GetPartialityModel()),
s(x.GetScalingSettings()),
rot_wedge_deg(x.GetRotationWedgeForScaling()),
refine_rot_wedge(x.GetRefineRotationWedgeInScaling()) {
const HKLKeyGenerator key_generator(s.GetMergeFriedel(), sg);
refine_rot_wedge(x.GetRefineRotationWedgeInScaling()),
hkl_key_generator(s.GetMergeFriedel(), x.GetSpaceGroupNumber().value_or(1)) {
for (const auto &r: ref) {
const auto key = key_generator(r);
const auto key = hkl_key_generator(r);
reference_data[key] = r.I;
}
}
@@ -137,13 +137,12 @@ ScaleOnTheFlyResult ScaleOnTheFly::Scale(std::vector<Reflection> &reflections, s
}
size_t n_reflections = 0;
HKLKeyGenerator key_generator(s.GetMergeFriedel(), sg);
for (const auto &r: reflections) {
const HKLKey key = key_generator(r);
if (!Accept(r))
continue;
const HKLKey key = hkl_key_generator(r);
if (!reference_data.contains(key))
continue;
@@ -28,6 +28,7 @@ class ScaleOnTheFly {
const ScalingSettings s;
const std::optional<double> rot_wedge_deg;
const bool refine_rot_wedge;
const HKLKeyGenerator hkl_key_generator;
std::map<HKLKey, double> reference_data;
bool Accept(const Reflection &r);
+2 -2
View File
@@ -5,14 +5,14 @@
#include "../image_analysis/scale_merge/HKLKey.h"
TEST_CASE("HKLKey_NoSG_noMergeFriedel") {
HKLKeyGenerator hkl_key_gen(false, std::nullopt);
HKLKeyGenerator hkl_key_gen(false, 1);
CHECK(hkl_key_gen(-1, -2, -3) != hkl_key_gen(1,2,3));
CHECK(hkl_key_gen(-1,-2,-3) == hkl_key_gen(-1,-2,-3));
CHECK(hkl_key_gen(-1,-2,-3) != hkl_key_gen(1,-2,-3));
}
TEST_CASE("HKLKey_NoSG_MergeFriedel") {
HKLKeyGenerator hkl_key_gen(true, std::nullopt);
HKLKeyGenerator hkl_key_gen(true, 1);
CHECK(hkl_key_gen(-1, -2, -3) == hkl_key_gen(1,2,3));
CHECK(hkl_key_gen(-1,-2,-3) == hkl_key_gen(-1,-2,-3));
CHECK(hkl_key_gen(-1,-2,-3) != hkl_key_gen(1,-2,-3));