From fe3a28a1c0cce4f5fadd476833cd7149d5162607 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 20 Sep 2026 19:02:47 +0200 Subject: [PATCH] Drop the centring-absent reflections from the reported twin statistics AnalyzeTwinning takes the lattice centring so that the reflections the centring extinguishes stay out of both statistics, but only the pre-promotion test passed it. The final, reported verdict and --mode scale did not, and a merged ASU in a centred group still carries keys in the absent class - noise, and an L-test partner step landing on one pairs a real reflection with an absent one. Both now pass the adopted group's centring. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_013nW6FNRP1bBJJ8pfHiByAT --- rugnux/Rugnux.cpp | 10 +++++++++- rugnux/rugnux_cli.cpp | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 627a94efb..883e1467e 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -6943,8 +6943,16 @@ ProcessResult Rugnux::RunPipeline(RugnuxObserver *observer, bool write_output, b result.tncs.peak_percent, result.tncs.vector_frac[0], result.tncs.vector_frac[1], result.tncs.vector_frac[2], result.tncs.vector_length_A); + // Without the reflections the lattice centring extinguishes, as the pre-promotion test + // above is measured: the merged ASU of a centred group still holds keys in the absent + // class (the merge writes what it was given), they are noise rather than intensities, + // and an L-test partner step that lands on one pairs a real reflection with an absent. + // This is the number the user reads, so it is the one that must be treated. + const char twin_centring = twin_sg ? twin_sg->centring_type() + : end_msg.rotation_lattice_type.has_value() + ? end_msg.rotation_lattice_type->centering : 'P'; result.twinning = AnalyzeTwinning(sm.merged, twin_sg, 20, - TranslationalNCSVectorForLTest(result.tncs)); + TranslationalNCSVectorForLTest(result.tncs), twin_centring); // Set on the struct the text below is rendered from. AnalyzeTwinning returns a fresh result // with this flag clear, so setting it only afterwards left the statistics text asserting // "No twinning: the Laue class is holohedral" as a fact while the report, rendering the same diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index 69cbb1b70..bc47bde04 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -1868,8 +1868,12 @@ static int RunRugnux(int argc, char **argv) { tncs = AnalyzeTranslationalNCS(merged_reflections, gemmi::UnitCell(*uc), twin_sg); if (tncs.measurable) std::cout << std::endl << TranslationalNCSToText(tncs); + // Same as the full pipeline: without the reflections the lattice centring extinguishes. The + // merged ASU of a centred group still holds keys in the absent class, and they are noise, not + // intensities, in both statistics. const auto twinning = AnalyzeTwinning(merged_reflections, twin_sg, 20, - TranslationalNCSVectorForLTest(tncs)); + TranslationalNCSVectorForLTest(tncs), + twin_sg ? twin_sg->centring_type() : 'P'); std::cout << std::endl << TwinningAnalysisToText(twinning) << std::endl; // Diffraction anisotropy, exactly as the full pipeline computes it (Rugnux.cpp) - report-only,