space group: the b-veto goes

It refused a higher point group when the added operator cost too much extra error
in the scaling model, relative to the parent's. It was guarded by "H could not be
computed" and followed by the H refusal, so it could only ever act where H - the
one statistic that discriminates here - is blind. Over 1213 candidate rows on 148
datasets it is reached seven times, every one of them with H not a number, fires
twice on a single dataset, and changes no result anywhere.

What it does do is make a space group depend on the compiler flags. On that one
dataset a plain Release build refuses a correct P2_12_12_1 and reports P2, while
the same source built for x86-64-v3 does not, because the quantity it compares is
not a measurement at all - it is the bisection's own ceiling, over a parent whose
error term is larger than the signal it is added to. A decision that moves with
the flags is worse than one that is consistently wrong, and no bound repairs this
one: genuine promotions now measure up to 5.8 where the bound was calibrated at
1.62 against a twin at 2.1, so the two populations have swapped sides.

The case it was meant to catch - a merohedral twin too sparse for H - is already
answered below it by the added-operator R gate, whose reference is the global best
rather than the parent, so it still speaks where H does not.

No space group and no cell changes on 148 datasets: 100 open, 34 in-house, 14
private.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GxZqDiFP3KqriBhNdcR56
This commit is contained in:
leonarski_fandClaude Opus 5 committed 2026-09-13 16:13:48 +02:00
1 parent beae384bb7
commit dc0d7e65d8
3 files changed
+15 -77

No files matched your search

@@ -1536,25 +1536,6 @@ SearchSpaceGroupResult SearchSpaceGroup(
&& (miscalibrated || (std::isfinite(c.chi2) && std::isfinite(chi2_ref)
&& c.chi2 <= chi2_ref * opt.max_merge_chi2_rescue)))
consistent = true;
// Veto a chi^2-passing promotion whose b clearly ballooned (above the largest genuine step, below a
// twin); a genuine but imperfectly-scaled high-symmetry merge stays under the bound and is untouched.
// The parent b is floored (min_systematic_b_for_veto) so a near-zero parent on excellent data cannot
// fabricate a huge ratio out of a still-tiny absolute b (a genuine 422 at b=0.05 over a 222 parent at
// b=0.008 is not a twin - a real twin drives b to ~0.19 regardless).
//
// The veto also answers to the H test: it does not fire on a promotion H has CONFIRMED. The two
// can disagree because they measure different things - b is fitted against the merged sigmas, so
// it moves with the measurement, while H compares intensities with intensities - and where they
// do, H is the one that was measured to separate a twin from a real symmetry (see
// max_operator_h_ratio and max_systematic_b_veto). A twin fails both.
const bool h_confirmed = std::isfinite(h_ratio) && h_ratio <= opt.max_operator_h_ratio;
bool b_refused = false;
if (consistent && !h_confirmed && parent_b > 1e-4
&& c.b_extra > std::max(parent_b, opt.min_systematic_b_for_veto) * opt.max_systematic_b_veto) {
consistent = false;
b_refused = true;
}
// The H test is a necessary condition for promotion where it can be computed: it is the only
// statistic measured to separate genuine symmetry from a merohedral twin across data amounts.
const bool h_refused = std::isfinite(h_ratio) && h_ratio > opt.max_operator_h_ratio;
@@ -1591,8 +1572,7 @@ SearchSpaceGroupResult SearchSpaceGroup(
if (!consistent) {
// Same three sentences the highest refusal gets below, but kept per candidate for the
// ledger: short, because the long form is written once for the group the user is told about.
c.why = h_refused ? "H ratio" : r_refused ? "added-operator R" : b_refused ? "systematic b"
: "merge chi^2";
c.why = h_refused ? "H ratio" : r_refused ? "added-operator R" : "merge chi^2";
// Record the highest-order refusal so the caller can say WHY it is processing lower.
if (c.order > refused_order && c.pg->representative) {
refused_order = c.order;
@@ -1618,14 +1598,6 @@ SearchSpaceGroupResult SearchSpaceGroup(
+ FormatDouble(opt.max_operator_r_over_floor, 1))
+ "x) - at full resolution the added operator relates reflections that "
"disagree far beyond measurement error, i.e. it is not a real symmetry";
else if (b_refused)
// Against the FLOORED parent b, which is what the test compared - quoting the raw
// parent b reads as a far bigger balloon than the one that actually tripped the veto.
refused_why = "its merge's systematic error b is " + FormatDouble(c.b_extra, 3)
+ " against the subgroup's "
+ FormatDouble(std::max(parent_b, opt.min_systematic_b_for_veto), 3)
+ " (bound " + FormatDouble(opt.max_systematic_b_veto, 2)
+ "x) - the added operator forces unequal intensities together";
else if (std::isfinite(c.chi2) && std::isfinite(chi2_ref))
refused_why = "merge chi^2 is " + FormatDouble(c.chi2 / chi2_ref, 2)
+ "x the subgroup's (bound " + FormatDouble(opt.max_merge_chi2_ratio, 2) + ")";
+13 -47
View File
@@ -308,12 +308,12 @@ struct SearchSpaceGroupOptions {
// scaled has already been measured to produce on these same four numbers. Re-measure it whenever
// that scaling changes rather than trusting it through such a change.
//
// 1.44, not the 1.78 those four numbers were read in. This bound and max_systematic_b_veto below
// are bounds on a RATIO of two b values, so their scale is set by how merge_systematic_b
// normalises its reduced chi^2 - and that normalisation changed, from the observation count N to
// the fit's degrees of freedom N - G. Every ratio in the corpus fell with it: a measured -23.7%
// median over three disjoint corpora, lower in 42 of 42 promotions, because the low-multiplicity
// parent loses a larger fraction of its dof than the candidate and so gains more b. Measured on
// 1.44, not the 1.78 those four numbers were read in. This bound is a bound on a RATIO of two b
// values, so its scale is set by how merge_systematic_b normalises its reduced chi^2 - and that
// normalisation changed, from the observation count N to the fit's degrees of freedom N - G.
// Every ratio in the corpus fell with it: a measured -23.7% median over three disjoint corpora,
// lower in 42 of 42 promotions, because the low-multiplicity parent loses a larger fraction of
// its dof than the candidate and so gains more b. Measured on
// one trigonal crystal, same merge, only the divisor differing: the parent's b 0.126 -> 0.181
// (+43%) against the candidate's 0.219 -> 0.254 (+16%), and the ratio 1.74 -> 1.40.
//
@@ -326,40 +326,6 @@ struct SearchSpaceGroupOptions {
// derivation that argued 1.38.
double max_systematic_b_ratio = 1.44;
// Veto bound. The systematic-b test above is otherwise only a rescue - it can promote a chi^2-borderline
// genuine step but never demote a chi^2-passing one. A merohedral twin whose within-orbit scatter looks
// self-consistent (chi^2 ratio below max_merge_chi2_ratio) therefore slips through on chi^2 alone even
// though merging its non-equivalent reflections balloons b. So a chi^2-passing high-symmetry promotion
// whose b, relative to the largest confirmed subgroup, exceeds this bound is vetoed and kept in its true
// lower symmetry. Calibrated on the rotation-test battery against a merohedral R3->R32 twin at b-ratio
// ~2.6, with the largest genuine step then measured at ~1.8.
//
// That gap is far narrower than it looked: a genuine cubic 222 -> 23 step on weak low-energy data sits
// at 1.94. Masking the beam-stop shadow moved it to 2.07 and demoted the crystal - and it did so while
// IMPROVING both merges, because b is fitted against the merged sigmas and the subgroup's b improved
// more (0.164 -> 0.148) than the cubic merge's (0.319 -> 0.306). A ratio with 3% of headroom, which the
// measurement can move in either direction, cannot decide a symmetry on its own. So the veto is applied
// only where the H test has NOT confirmed the promotion: H compares intensities with intensities, has no
// sigma in it, and is the statistic that was actually measured to separate a twin (see
// max_operator_h_ratio). Where both fire the promotion is still refused, and every twin on the battery
// and in the synthetic harness fires both. The veto only ever keeps a clearly-ballooned promotion down,
// never promotes.
// 1.62 = 2.0 rescaled by the same 0.808 as max_systematic_b_ratio above, and for the same reason:
// it reads the same ratio, whose scale moved under it. This half is the less certain of the two -
// the veto has not been observed to fire on any corpus it has been measured over, so nothing
// measured says where it now sits - but leaving it in the old units while the statistic moved is
// the very mistake being corrected, and it would leave the veto systematically weaker than the
// calibration above intends.
double max_systematic_b_veto = 1.62;
// Floor on the parent's systematic-b when forming the veto ratio. On excellent data a genuine merge's
// b is near zero (ISa well above 20), so even a small, harmless absolute increase gives a huge b-ratio
// and the veto would wrongly reject real high symmetry (a true tetragonal 422 whose parent 222 sits at
// b=0.008 and 422 at b=0.049 - both tiny - reads as a 6x balloon). A real twin, by contrast, drives b
// to a large ABSOLUTE value (~0.19). Flooring the parent b here makes the ratio meaningful only once b
// is a non-negligible fraction of I; below the floor the increase is treated as noise, not a twin.
double min_systematic_b_for_veto = 0.05;
// Promotion gate on the operator disagreement H = median|I1-I2|/(I1+I2), taken as the ratio of the
// operators the promotion ADDS to the operators of the parent group already confirmed on the same
// reflections. A real symmetry operator relates equal intensities, so its H matches the parent's
@@ -427,12 +393,11 @@ struct SearchSpaceGroupOptions {
// intensity-weighted R (r_stat: a SUM, so the strong low-resolution reflections that carry the
// contrast dominate it, where the median H under-weights them), and that R is judged against a
// CLEAN reference. This is the one Stage-A gate whose reference cannot be contaminated by false
// operators: the H ratio and the systematic-b veto both normalise against the PARENT group, and a
// parent can itself be a false promotion (a pseudo-tetragonal 2 -> 222 -> 422 cascade confirms
// 222 by pooling the one real 2-fold with two false ones, so the 422 step is then measured
// against an already-contaminated 222, and every ratio reads ~1.4 and passes). It also acts on
// the first step out of P1, where there is no parent to normalise against at all and the operator
// CC floor stood alone. Sigma-free, so unlike the chi^2 and b gates it does not saturate with the
// operators: the H ratio normalises against the PARENT group, and a parent can itself be a false
// promotion (a pseudo-tetragonal 2 -> 222 -> 422 cascade confirms 222 by pooling the one real
// 2-fold with two false ones, so the 422 step is then measured against an already-contaminated
// 222, and every ratio reads ~1.4 and passes). It also acts on the first step out of P1, where
// there is no parent to normalise against at all and the operator CC floor stood alone. Sigma-free, so unlike the chi^2 and b gates it does not saturate with the
// merge's ISa on a starved search merge.
//
// Two references, each scale-free so the bound means the same on every crystal (the property an
@@ -464,7 +429,8 @@ struct SearchSpaceGroupOptions {
// chi^2 ratio then grows with point-group order for genuine high symmetry too and can no longer
// arbitrate, so a promotion is confirmed on the systematic-b test alone (which re-fits its own error
// and stays valid). A well-calibrated merge sits near 1; 3.0 (sigmas ~1.7x too small) marks the point
// where the ratio stops being trustworthy. The balloon veto still guards against a twin.
// where the ratio stops being trustworthy. The H and added-operator-R gates below still guard
// against a twin: both are necessary conditions no rescue can lift.
double chi2_ref_reliable = 3.0;
// Adopt this space group's point group instead of the one Stage A would choose, and go straight to
+1 -1
View File
@@ -22,7 +22,7 @@
// SearchSpaceGroupTest.cpp exercises Stage B (systematic absences) on noise-free, exactly-symmetric
// intensities. The decision that actually goes wrong on real crystals is Stage A: whether the extra
// operator of the metric holohedry is a real symmetry or a twin law. That decision runs through the
// merge chi^2 gate, its systematic-b rescue and the systematic-b veto - none of which the noise-free
// merge chi^2 gate, its systematic-b rescue and the operator gates - none of which the noise-free
// set can reach, because it has no errors for a chi^2 to be reduced by.
//
// Three crystals are modelled per lattice, all with the SAME metric symmetry (a merohedral twin has