From 52932337fb7819019e7950a99b35c4edf23938ac Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 4 Oct 2026 11:56:32 +0200 Subject: [PATCH 1/4] Space group: a point-group promotion keeps the screws the adopted group decided When a refused point group is re-asked on the adopted group's merge (twin-immune zone / merge comparison), that merge no longer holds the adopted group's screw-absent axial reflections. The higher search then had nothing to judge on those rows, every candidate of the point group tied, and the lowest-numbered - the one claiming no screw - was written. Measured on an open-arm P4_2 2_1 2 crystal (8v2t): adopted P2_1 2_1 2_1, promoted by the twin-immune zone, all three axial rows "no control class", P 4 2 2 written. Among the candidates the higher search cannot separate, take the first that keeps every axial absence the adopted group claims (as the centring already is taken), drop from the alternatives the ones that do not, and stop reporting those rows as undetermined. Rows the adopted group left present are still in the merge and still decided by the higher search. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01K5K8jvPPbmCrbqnWkddTuB --- rugnux/Rugnux.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 74aa0c628..8e97094f6 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -8231,13 +8231,57 @@ ProcessResult Rugnux::RunPipeline(RugnuxObserver *observer, bool write_output, b hi_opts.cell = gemmi::UnitCell(*result.consensus_cell); if (end_msg.rotation_lattice_type.has_value()) hi_opts.lattice_system = end_msg.rotation_lattice_type->crystal_system; - const auto hi_search = SearchSpaceGroup(sm.merged, hi_opts); + auto hi_search = SearchSpaceGroup(sm.merged, hi_opts); // ...and its CENTRING is taken rather than read. The adopted group has already // removed its centring-absent class from this merge, so that class holds no data, // every candidate of the point group is equally consistent with it, and the // tie-break takes the lowest-numbered - which is the primitive one. Merging in // that would hand the higher arm the centring-absent reflections as if they were // data and lose the comparison on noise. Same move the metric-lattice ask makes. + // + // Its SCREWS are taken the same way, for the same reason: the adopted group's + // screw-absent axial reflections are not in this merge either, so on those rows + // the higher search has nothing to judge, its candidates tie, and the lowest- + // numbered - the one claiming no screw - is named. Measured on a P4_2 2_1 2 + // crystal adopted as P2_1 2_1 2_1 and promoted by the twin-immune zone: all three + // axial rows read "no control class" and P 4 2 2 was written. So among the + // candidates the higher search cannot separate, the ones that drop an axial + // absence the adopted group claims are dropped; the axial reflections the adopted + // group left present are in this merge and stay the higher search's to decide. + const gemmi::GroupOps lo_ops = sg.operations(); + const auto keeps_screws = [&](const gemmi::SpaceGroup &hi) { + const gemmi::GroupOps hi_ops = hi.operations(); + for (int axis = 0; axis < 3; ++axis) + for (int n = 1; n <= 6; ++n) { + gemmi::Op::Miller hkl{{0, 0, 0}}; + hkl[axis] = n; + if (lo_ops.is_systematically_absent(hkl) && !hi_ops.is_systematically_absent(hkl)) + return false; + } + return true; + }; + if (hi_search.best_space_group.has_value()) { + std::vector tied{*hi_search.best_space_group}; + tied.insert(tied.end(), hi_search.alternatives.begin(), hi_search.alternatives.end()); + const auto kept = std::find_if(tied.begin(), tied.end(), [&](const gemmi::SpaceGroup &c) { + return c.centring_type() == sg.centring_type() && keeps_screws(c); + }); + if (kept != tied.end()) { + hi_search.best_space_group = *kept; + hi_search.alternatives.clear(); + for (const auto &c : tied) + if (c.number != kept->number + && (c.centring_type() != sg.centring_type() || keeps_screws(c))) + hi_search.alternatives.push_back(c); + for (auto &c : hi_search.candidates) + if (c.selected && c.space_group.centring_type() == sg.centring_type()) + c.selected = keeps_screws(c.space_group); + // A row the adopted group decided is not open, whatever this merge holds of it. + std::erase_if(hi_search.undetermined_screws, [&](const auto &u) { + return lo_ops.is_systematically_absent({{u.row[0], u.row[1], u.row[2]}}); + }); + } + } std::optional hi_sg; if (hi_search.best_space_group.has_value() && hi_search.best_space_group->centring_type() == sg.centring_type()) From 3f89759cb5d70fe9feb8c0d45a22de25c6f8a622 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 4 Oct 2026 11:56:32 +0200 Subject: [PATCH 2/4] Space group: screw-absence bound 20 -> 8 nats, recalibrated on the zones Mapped every single-axis screw candidate of every primitive-lattice set in battery 3 (open + in-house) and the private arm against the deposited group. False zones with no violation read at most +4 nats (plus one pseudo- translation row at +30.5 that no bound separates); true zones go down to +10. The true zones under 20 are all short monoclinic rows (b ~ 25-30 A: four to six 0k0-odd reflections inside the search's resolution range, on weak data at a few percent of their row), refused at 20 on five crystals that are P2_1: four myoglobin sweeps (10.0-16.3 nats) and 6cs9 (10.8). The rc174-cand myob_x06da_split call sat at 21.1, one refit away from P2. Re-scoring the stored candidate tables at the new bound changes only those five plus 3r6o (I4_1 2 2 newly eligible, toward the deposited I4_1 screw); no adopted group elsewhere. New test section pins both sides: four 0k0-odd at 2% of their row are claimed (11.3 nats), at 20% they are not. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01K5K8jvPPbmCrbqnWkddTuB --- image_analysis/scale_merge/SearchSpaceGroup.h | 14 ++++++++++- tests/SearchSpaceGroupTest.cpp | 25 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/image_analysis/scale_merge/SearchSpaceGroup.h b/image_analysis/scale_merge/SearchSpaceGroup.h index 1c7bd85f6..9bf15f789 100644 --- a/image_analysis/scale_merge/SearchSpaceGroup.h +++ b/image_analysis/scale_merge/SearchSpaceGroup.h @@ -635,7 +635,19 @@ struct SearchSpaceGroupOptions { // exists to avoid. A thin monoclinic sweep reaching only three 0k0-odd reflections loses its // 2(1) to this. Lowering the floor to 7.7e-4 would let three through; that is a recalibration // and needs its own battery. - double min_screw_absence_evidence = 20.0; + // + // Recalibrated on the zones themselves rather than on the probe crystals: every single-axis + // candidate of every primitive-lattice set of a 230-set battery (open, in-house and private), + // labelled against the deposited group. A false zone with no violation reads at most +4 nats + // (a row that is weak, not dead, adds at most +6 to a group that is eligible without it), and the + // one false zone above that, +30.5, is a row that is genuinely present at a few percent of its + // neighbours under a pseudo-translation - no bound separates it from a true screw, whose rows + // read from +10 up. The true zones under 20 are all short rows: a 2(1) along a monoclinic axis of + // 25-30 A reaches four to six odd reflections inside the search's resolution range, and on weak + // data those sit at a few percent of their row, not at the floor - 10.0 to 16.3 nats, refused at + // 20 on every one of five such crystals. The bound sits in the measured gap. Two absences can now clear it if both are below about 2% of + // their row. + double min_screw_absence_evidence = 8.0; // ---- Glide planes (small-molecule space groups) ------------------------------------------- // Offer the NON-SOHNCKE space groups of the same proper-rotation set as candidates, so a glide diff --git a/tests/SearchSpaceGroupTest.cpp b/tests/SearchSpaceGroupTest.cpp index 59b912021..846e410cc 100644 --- a/tests/SearchSpaceGroupTest.cpp +++ b/tests/SearchSpaceGroupTest.cpp @@ -279,6 +279,31 @@ TEST_CASE("SearchSpaceGroup weighs a screw's absences by evidence, not by how ma CHECK(result.best_space_group->short_name() == "P21"); } + // A short monoclinic axis on weak data: four 0k0-odd reflections in range, each at 2% of its row + // rather than at the floor. That zone reads ~11 nats - refused under the old bound of 20 on five + // crystals that are P2_1 - and must be claimed; the same four at a fifth of their row must not. + SECTION("four absences at a few percent of a short row: the screw is found, at a fifth it is not") { + for (const auto& [fraction, expected] : {std::pair{0.02, "P21"}, std::pair{0.2, "P2"}}) { + auto merged = GenerateMergedReflectionsForSpaceGroup(sg, 18); + int kept = 0; + std::erase_if(merged, [&](MergedReflection& r) { + if (!gops.is_systematically_absent(gemmi::Op::Miller{{r.h, r.k, r.l}})) + return false; + if (kept >= 4) + return true; + ++kept; + r.I = static_cast(fraction * 350.0); + return false; + }); + REQUIRE(kept == 4); + + const auto result = SearchSpaceGroup(merged, opt); + INFO(SearchSpaceGroupResultToText(result)); + REQUIRE(result.best_space_group.has_value()); + CHECK(result.best_space_group->short_name() == expected); + } + } + SECTION("a uniformly weak axial row decides nothing, however many absences it holds") { // The whole 0k0 row badly measured: the predicted-absent reflections are weak, but so is the // rest of their row, so there is no contrast and no screw to claim. A violation count cannot From 8004e4945439b595ae99053da70643001b7aa0ed Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 4 Oct 2026 13:13:03 +0200 Subject: [PATCH 3/4] Space group: the promoted group's Sohncke answer follows the screws it kept The re-selection among tied higher-group candidates left sohncke_space_group at the old lowest-numbered pick, so the report read SPACE_GROUP_NAME P 42 21 2 beside SOHNCKE_SPACE_GROUP P 4 2 2. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01K5K8jvPPbmCrbqnWkddTuB --- rugnux/Rugnux.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 8e97094f6..b6ceb5140 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -8268,6 +8268,8 @@ ProcessResult Rugnux::RunPipeline(RugnuxObserver *observer, bool write_output, b }); if (kept != tied.end()) { hi_search.best_space_group = *kept; + if (kept->is_sohncke()) + hi_search.sohncke_space_group = *kept; hi_search.alternatives.clear(); for (const auto &c : tied) if (c.number != kept->number From 20d5146544547b90c8f9e93849944a7c6b256993 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 4 Oct 2026 13:25:13 +0200 Subject: [PATCH 4/4] Docs: changelog and decisions page for the two screw-axis changes Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01K5K8jvPPbmCrbqnWkddTuB --- docs/CHANGELOG.md | 2 ++ docs/CPU_DATA_ANALYSIS_DECISIONS.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a64928c70..ed244806a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,8 @@ * Rugnux: `.hkl` now holds unmerged, scaled full reflections (SHELX HKLF 4) on rotation data, so SHELXL computes Rint itself. * Rugnux reads Rigaku d*TREK SMV images (Saturn CCD), including detector 2theta, image orientation and encoded pixel overflows. * Rugnux integrates spots that grow wider than the integration disk away from the beam (typical of small molecules at high X-ray energy) over their measured footprint. +* Rugnux claims a screw axis from a short axial row of a few weak reflections, so such crystals (e.g. P2_1 with a ~30 A unique axis) are no longer written without the screw. +* Rugnux keeps the screw axes it found when a higher point group is adopted after the twin-law check, instead of writing the group without screws (e.g. P 4 2 2 for P4_2 2_1 2). ### 1.0.0-rc.173 diff --git a/docs/CPU_DATA_ANALYSIS_DECISIONS.md b/docs/CPU_DATA_ANALYSIS_DECISIONS.md index c3586f883..db14b2586 100644 --- a/docs/CPU_DATA_ANALYSIS_DECISIONS.md +++ b/docs/CPU_DATA_ANALYSIS_DECISIONS.md @@ -46,7 +46,7 @@ Both search merges also drop the **frames whose fitted per-frame scale came out **Centering** is accepted when the systematically-absent class is weak relative to the present one by *either* of two floor-independent tests: its mean signed $I/\sigma$ well below the present mean, *or* its rate of individually-significant reflections well below the present class's own significant rate. The second test covers weak and low-energy data, where a positive intensity floor (background and profile leakage) lifts the absent class's mean $I/\sigma$ well above zero and, when the present class is itself weak, carries the plain mean ratio past its bound; a false centering fails both tests, its absent class being as strong as the present one. When several centerings pass they are ranked by a **Beta-tail likelihood** rather than by a count of net absences: a count lets a centering that extinguishes many more reflections out-rank one that violates far fewer, and the likelihood weighs the violations against the class each belongs to instead. The acceptance bounds above are unchanged by that ranking. -**A confirmed promotion that is refused is decided by the twin-immune zone of its added operators, and only where that is undecided by merging under it.** The zone (§13.2) is the one reading that does not depend on the per-frame scales or on a reference operator: read on the all-observation P1 merge where the two search arms disagree, and on the adopted group's own merge at the remerge, an index-2 promotion whose calibrated zone evidence is acentric by 20 nats stays refused — on all observations, and the first added operator is recorded as the twin law — and one whose zone is centric by 20 nats is taken. Where the zone cannot decide (a higher index, no zone reflections in the shells with signal, within the margin), the merge is asked. Every gate that refuses a *confirmed* higher point group is a **ratio** — the added operators' disagreement against the parent's, or their $R$ against the best-agreeing operator anywhere — and both references are properties of how the crystal was mounted rather than of its symmetry. A 2-fold within a degree of the spindle records its mates on the same detector pixel half a turn later, so it carries no geometry-dependent systematic at all, and by being that clean it makes every other operator look bad against it; the best-agreeing operator can also be one of the operators under test, which collapses the ratio on worse data and raises it on better. So where a promotion is confirmed and then refused, the **merge** is asked instead of the ratio. Both groups are scaled and merged over one pinned resolution range — the adopted group's own cut — and the promotion is taken only if **neither $R_\mathrm{meas}$ nor ISa gets worse**. $R_\mathrm{meas}$ is multiplicity-corrected, so folding non-equivalent reflections together has to inflate it, and the error model is refitted per merge, so ISa says whether the extra multiplicity was bought with systematic disagreement. $CC_{1/2}$ and $\langle I/\sigma\rangle$ cannot arbitrate this: both *rise* on a false promotion too. Two details the comparison turns on: the refused point group's representative is primitive and symmorphic, so the arm merged under it takes the **adopted group's centring** — merged in the bare representative, a centred crystal is handed its centring-absent class as data, which inverts the decision — and the absence stage is asked of the adopted merge, so both arms carry the same absence classes and differ by the added rotations alone. The cost is two extra merges, and only on a run that records a refusal, which is a few in a hundred. +**A confirmed promotion that is refused is decided by the twin-immune zone of its added operators, and only where that is undecided by merging under it.** The zone (§13.2) is the one reading that does not depend on the per-frame scales or on a reference operator: read on the all-observation P1 merge where the two search arms disagree, and on the adopted group's own merge at the remerge, an index-2 promotion whose calibrated zone evidence is acentric by 20 nats stays refused — on all observations, and the first added operator is recorded as the twin law — and one whose zone is centric by 20 nats is taken. Where the zone cannot decide (a higher index, no zone reflections in the shells with signal, within the margin), the merge is asked. Every gate that refuses a *confirmed* higher point group is a **ratio** — the added operators' disagreement against the parent's, or their $R$ against the best-agreeing operator anywhere — and both references are properties of how the crystal was mounted rather than of its symmetry. A 2-fold within a degree of the spindle records its mates on the same detector pixel half a turn later, so it carries no geometry-dependent systematic at all, and by being that clean it makes every other operator look bad against it; the best-agreeing operator can also be one of the operators under test, which collapses the ratio on worse data and raises it on better. So where a promotion is confirmed and then refused, the **merge** is asked instead of the ratio. Both groups are scaled and merged over one pinned resolution range — the adopted group's own cut — and the promotion is taken only if **neither $R_\mathrm{meas}$ nor ISa gets worse**. $R_\mathrm{meas}$ is multiplicity-corrected, so folding non-equivalent reflections together has to inflate it, and the error model is refitted per merge, so ISa says whether the extra multiplicity was bought with systematic disagreement. $CC_{1/2}$ and $\langle I/\sigma\rangle$ cannot arbitrate this: both *rise* on a false promotion too. Two details the comparison turns on: the refused point group's representative is primitive and symmorphic, so the arm merged under it takes the **adopted group's centring** — merged in the bare representative, a centred crystal is handed its centring-absent class as data, which inverts the decision — and the absence stage is asked of the adopted merge, so both arms carry the same absence classes and differ by the added rotations alone. That merge no longer holds the adopted group's screw-absent axial reflections, so the higher group also **keeps the screws the adopted group decided** — among the higher candidates the merge cannot separate, the one that predicts every such axial absence is taken — rather than the lowest-numbered one, which claims none. The cost is two extra merges, and only on a run that records a refusal, which is a few in a hundred. **The lattice class is re-asked where the metric knows more.** The Bravais class comes from Niggli reduction and a lattice-character lookup (§6), and that lookup can land short of the truth or beside it: near the Niggli type-I/type-II boundary it is decided by the last digits of the refined cell, and a lattice that is nearly but not exactly hexagonal matches the hexagonal character even when no point group that class can host carries the two-folds the data actually have. Two recoveries run, both settled by the intensities. Every rotation the cell metric can host beyond the named class — read off Le Page's two-fold search on the lattice itself, which measures each rotation's obliquity in a primitive basis and owes nothing to the character table — is put to the intensities as a single operator, scored exactly as the search scores its own operators, on the same reflection population and the same $E^2$ normalisation. And where the metric group is larger than the adopted class's holohedry, the merge is reindexed into the metric group's conventional cell and the space-group search is run again there, with every gate live; the reindex is committed only where the search in the new setting confirms a strictly higher point group *and* the centring the new cell describes, so a pseudo-symmetric metric leaves the answer already in hand standing.