Reworks the --model / French-Wilson / R-free path so a batch of datasets of
one crystal form yields comparable maps and a shared test set, and fixes a
French-Wilson prior bug.
- French-Wilson: fix inverted centric/acentric prior - the call passed
!centric into the selector, swapping the two Wilson forms for every weak
reflection. Add a test pinning a centric weak |F| below an acentric one.
- R-free flags: assign by a pure per-hkl hash instead of a per-dataset
resolution-shell stratification, so every dataset of one crystal form gets
the same free set (needed for ensemble refinement / PanDDA). Still a pure
function of the Laue-ASU key, so Bijvoet/symmetry mates never split.
- R-free flags: import a reference MTZ's FreeR_flag column when present
(CCP4 test=0, auto-complement for a phenix-style test=1), so a whole
campaign inherits one shared test set. New ApplyReferenceFreeFlags, wired
post-merge in both the full-analysis and --scale paths.
- Model maps: scale the model with an overall scale, anisotropic B and flat
bulk solvent only - drop the free-form per-shell K(1/d^2) rescale, which
reshaped each dataset's radial amplitude profile differently and made a
batch of maps non-comparable.
- Merohedral indexing: model validation resolves the ambiguity by lowest
R-free only when there is no reference; with a reference MTZ the indexing
is already resolved against it (merge stage / stills scaling) and that
authoritative choice is kept.
- Remove a stale <algorithm> include; update docs and changelog.
Tests: french_wilson, rfree, reference_mtz (new), reindex, hkl_key all pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
RfreeFlagsTest: determinism (pure function of the reflection), ~5% free fraction,
Friedel/Bijvoet pairs never split, symmetry equivalents share a flag, resolution
stratification (free set spans shells), and fraction=0 flags nothing.
FrenchWilsonTest: strong reflections reduce to sqrt(I), weak/negative intensities get
a positive amplitude, amplitudes are always finite and non-negative (incl. centric /
epsilon>1 reflections in P4(3)2(1)2), and unusable sigma falls back to sqrt(max(I,0)).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>