From 53d338105a2fca5c7bc0595ddfc8bab1349b716e Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 21 Nov 2026 19:40:08 +0100 Subject: [PATCH] Report: SUPERCELL_POSSIBLE no longer asks the class's mean I/sigma The flag needed the half-integer class to read >= 0.5 per reflection besides a rocking part of 2% three standard errors clear. On a weak sweep that hid classes the run measured clearly: on simulated crystals whose true cell is the doubled one and whose run answered in the half cell, classes rocking at 3.8 +- 0.2 % to 9.0 +- 0.5 % of the lattice (class 0.10-0.46) were reported as "no indication", and three more whose class stands clear of the six empty ones (the test that has the doubled cell merged) at 0.3-1.2 % went unmentioned. The flag now fires on either piece of evidence the run already holds: the significant rocking part, or a class standing clear of its null. Triage against the simulation truth (corpus runs so far, flags re-read from their own evidence; two cases re-run): supercell flag owed 10, raised 1 -> 8, false alarms 0 -> 0 over 45 cases with no superstructure (the f0 controls among them). The two still missed carry 0.5-1 % classes the probe does not measure. Holton wedges: unchanged (8 flags, all from the rocking part, as before). Battery subset: 12 more sets flagged (sub-cell depositions with a significant rocking class - the flag says the doubled cell is in the data, not that it is the cell to refine in); no verdict, space group or statistic changes. Whether such a cell should be ADOPTED is not changed here: the probe's shape of the class (0.016 -> 0.21 of the lattice by 3.7 A on a 12 % simulated case) is the same as on battery sets deposited in the half cell, so the cell decision stays as it was. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3 --- docs/RUGNUX_REPORT.md | 7 ++++--- rugnux/ResultReport.cpp | 24 ++++++++++++++++-------- tests/ResultReportTest.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/docs/RUGNUX_REPORT.md b/docs/RUGNUX_REPORT.md index a16df564e..d18b7a054 100644 --- a/docs/RUGNUX_REPORT.md +++ b/docs/RUGNUX_REPORT.md @@ -874,9 +874,10 @@ and rocks holds reflections of a superstructure this cell does not index; **`SUP is the Niggli-reduced cell the lattice doubles to. One that is occupied but hardly rocks is diffuse or disordered intensity rather than Bragg reflections. -**`SUPERCELL_POSSIBLE=`** is `TRUE` where the class is measured (`SUPERCELL_I_OVER_SIGMA=` at least -0.5) and part of it rocks like Bragg reflections (`SUPERCELL_ROCK_PCT=` at least 2 %, three standard -errors clear of zero). It says the doubled cell is there in the data, not that it is the cell to refine +**`SUPERCELL_POSSIBLE=`** is `TRUE` where part of the class rocks like Bragg reflections +(`SUPERCELL_ROCK_PCT=` at least 2 %, three standard errors clear of zero), or where a class stands clear +of the six empty ones out to the limit (the test that has both cells merged, below). Its mean I/σ is not +asked: on a weak sweep a class far below one per reflection can still be measured clearly. It says the doubled cell is there in the data, not that it is the cell to refine in: a crystal whose two halves are nearly alike (a pseudo-translation) is described by either cell, and spots of further lattice domains can land on the half-integer positions too. A `TRUE` is also a warning under the `SUPERCELL_POSSIBLE` flag, and the summary's `Supercell` line carries the same advice. diff --git a/rugnux/ResultReport.cpp b/rugnux/ResultReport.cpp index 9223bcb80..2ef6bd847 100644 --- a/rugnux/ResultReport.cpp +++ b/rugnux/ResultReport.cpp @@ -74,13 +74,20 @@ namespace { const char *BANNER = " ******************************************************************************"; - // Advisory, not a decision: the half-integer class is measured ( at least 0.5) and part of - // it rocks like Bragg reflections (at least 2% of the lattice's, three standard errors clear). On - // the battery's 105 rotation sets this names 8 - both crystals whose accepted cell is the doubled - // one, a pseudo-translation whose doubled description is an accepted alternative, and five correct - // sub-cells with real but weak half-integer intensity. + // Advisory, not a decision: part of the half-integer class rocks like Bragg reflections (at least 2% + // of the lattice's, three standard errors clear), or the class stands clear of its null. Most of the + // battery sets it names are correct sub-cells with real but weak half-integer intensity - the + // depositor's call as much as the data's, which is why it is a prompt to check. + // Either reading of the class is evidence the run holds: its rocking part, significant on its own + // standard error, or a class standing clear of the six empty ones out to the limit + // (DoubledCellWorthMerging, SupercellClass::occupied). Neither asks the class's mean I/sigma: a + // class can be far below one per reflection and still rock at 9.0 +- 0.5% of the lattice. Measured + // on simulated crystals whose true cell is the doubled one and whose run answered in the half cell, + // a bound of 0.5 on that I/sigma left 5 of them unflagged at rocking parts of 3.8-9.0%, and the + // rocking part alone 3 more whose class stands clear of its null at 0.3-1.2%; no simulated crystal + // without a superstructure reads either. bool SupercellPossible(const ProcessResult::SupercellClass &sc) { - return sc.i_over_sigma >= 0.5 && sc.rock_pct >= 2.0 && sc.rock_pct > 3.0 * sc.rock_se_pct; + return (sc.rock_pct >= 2.0 && sc.rock_pct > 3.0 * sc.rock_se_pct) || !sc.occupied.empty(); } // A warning is a prompt to check, so it fires wherever SupercellPossible does - including on correct @@ -2222,7 +2229,8 @@ ReportDocument BuildReportDocument(const std::string &output_prefix, " empty. One that is occupied and rocks holds reflections of an index-2 superstructure the\n" " lattice does not index, and they are not integrated in this cell. An occupied class that\n" " does not rock is diffuse or disordered intensity rather than Bragg reflections.\n" - " SUPERCELL_POSSIBLE is TRUE, and a warning to check, where the class is measured and rocks.\n" + " SUPERCELL_POSSIBLE is TRUE, and a warning to check, where the class rocks or stands clear\n" + " of the six other classes out to the limit.\n" " It says the doubled cell is there in the data, not that it is the cell to refine in: a\n" " crystal whose two halves are nearly alike (a pseudo-translation) is described in either,\n" " and spots of further lattice domains can also land on the half-integer positions.")); @@ -4045,7 +4053,7 @@ ReportDocument BuildReportDocument(const std::string &output_prefix, if (!SupercellPossible(sc)) checked_row("Supercell", {PathologyCode::SUPERCELL_POSSIBLE}, "no indication"); else - checked_row("Supercell", {PathologyCode::SUPERCELL_POSSIBLE}, fmt::format("POSSIBLE, check - class {} {} {} rocks like Bragg reflections " + checked_row("Supercell", {PathologyCode::SUPERCELL_POSSIBLE}, fmt::format("POSSIBLE, check - class {} {} {} holds Bragg-like intensity " "(rocking part {:.1f}%); a nearly exact pseudo-translation is described " "in either cell{}; {}", sc.h, sc.k, sc.l, sc.rock_pct, domains ? ", and the further lattice domains found may put " diff --git a/tests/ResultReportTest.cpp b/tests/ResultReportTest.cpp index 4af6c326c..e61b2f446 100644 --- a/tests/ResultReportTest.cpp +++ b/tests/ResultReportTest.cpp @@ -1381,6 +1381,31 @@ TEST_CASE("ResultReport_SupercellCheck", "[Diagnostics]") { CHECK(text.find("\nPATHOLOGY_FLAGS= NONE\n") != std::string::npos); } +TEST_CASE("ResultReport_SupercellCheck_WeakClass", "[Diagnostics]") { + DiffractionExperiment x(DetJF(1)); + ProcessResult result; + result.consensus_cell = UnitCell{.a = 50.0f, .b = 60.0f, .c = 70.0f, + .alpha = 90.0f, .beta = 90.0f, .gamma = 90.0f}; + result.has_merge_statistics = true; + ProcessResult::SupercellClass sc; + sc.h = 0; sc.k = 0; sc.l = 1; + sc.occupancy_pct = 4.3; + sc.rock_pct = 3.8; + sc.rock_se_pct = 0.2; + sc.i_over_sigma = 0.1; + sc.doubled_cell = UnitCell{.a = 50.0f, .b = 60.0f, .c = 140.0f, .alpha = 90.0f, .beta = 90.0f, .gamma = 90.0f}; + result.supercell = sc; + // Measured clearly on a weak sweep: the class's own I/sigma does not hide it. + CHECK(RenderResultReport("p", "in.h5", x, result).find("\nSUPERCELL_POSSIBLE= TRUE\n") != std::string::npos); + + // Too small to rock 2 %, but standing clear of the six other classes. + result.supercell->rock_pct = 1.2; + result.supercell->rock_se_pct = 0.05; + CHECK(RenderResultReport("p", "in.h5", x, result).find("\nSUPERCELL_POSSIBLE= FALSE\n") != std::string::npos); + result.supercell->occupied.push_back({0, 0, 1}); + CHECK(RenderResultReport("p", "in.h5", x, result).find("\nSUPERCELL_POSSIBLE= TRUE\n") != std::string::npos); +} + TEST_CASE("ResultReport_TwinningOutsidePhysicalRange", "[Diagnostics]") { DiffractionExperiment x(DetJF(1)); ProcessResult result;