From da641c603ac4ce44eb1183dda6317fce08bd1a32 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 31 Oct 2026 22:04:39 +0100 Subject: [PATCH] Stills: --model no longer changes the processing - its intensities are not the per-image reference Since rc164 a serial-stills run given --model with -C/-S computed structure factors from the model and handed them to the image pass as the reference intensities (ReferenceIntensities), the same path a reference MTZ takes. That reference also feeds the per-image scale and CC, so the frames dropped as collapsed, the radial scale, the indexing-ambiguity choice and from there the whole merge differed with and without the model: on a PAL CCD set CC1/2 0.976 without it, 0.893 with it, at the same code. A model is placed and validated after the merge; only a reference MTZ (-z) is a processing input now. The data-only ambiguity resolution (space group given) runs as without a model, and validation still relabels the finished merge into the model's indexing where it wins. With and without --model the merged reflections of that set are now identical, bit for bit. Docs updated. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQqN9qRD57vnShzTC37 --- docs/RUGNUX_ADVANCED.md | 16 ++++++++-------- docs/RUGNUX_CLI.md | 2 +- docs/RUGNUX_TUTORIAL.md | 6 +++--- rugnux/Rugnux.cpp | 25 +++++-------------------- rugnux/RugnuxScaleMerge.cpp | 5 ++--- 5 files changed, 19 insertions(+), 35 deletions(-) diff --git a/docs/RUGNUX_ADVANCED.md b/docs/RUGNUX_ADVANCED.md index d387a1436..b32c70d43 100644 --- a/docs/RUGNUX_ADVANCED.md +++ b/docs/RUGNUX_ADVANCED.md @@ -46,10 +46,10 @@ against a foreign dataset injects that dataset's systematics — so `-z` never p errors into the intensities. `--reference-column` picks the column to read where the automatic choice (`F-model`, else `IMEAN`/`I`, else `FP`/`FOBS`/`F`) is not the right one. -For the indexing ambiguity an atomic model does as well: `--model` computes the intensities it -needs from the structure (a model that fits also sets the hand label and the setting, see -[Validating against a model](#validating-against-a-model-rugnux---model)). Where a reference dataset exists, prefer it; -where only a model does, it resolves the ambiguity just the same. +An atomic model does not take part in the processing: `--model` is placed and validated after the merge, +and a run with one merges exactly what a run without one does. A model that fits then sets the frame the +merge is written in - the hand label, the setting and the indexing (see +[Validating against a model](#validating-against-a-model-rugnux---model)) - by relabelling it, never by re-merging. ### The indexing ambiguity @@ -102,15 +102,15 @@ How to resolve it: | **Rotation**, a reference dataset exists | `-z reference.mtz`. Once the space group is settled, each candidate reindexing of the merged intensities is correlated with the reference and the best-correlating one is re-merged. Only the *hkl* labels change; the cell does not | | **Serial stills**, a reference dataset exists | `-z reference.mtz`. Resolved **per image**, at integration time, by correlating each crystal's intensities with the reference — so the merge never mixes hands in the first place. Where the crystals' own cells tell the indexings apart (pseudo-merohedry), a crystal its cell decides keeps that indexing and the reference decides the rest. The data-only resolution below runs as a check: `AMBIGUITY_DATA_DISAGREES=` | | **Rotation**, only a model | `--model model.pdb`. The merged data are fitted to the model in each candidate indexing and the lowest R-free wins — provided the model first beats its random-orientation null (`MODEL_FIT= ACCEPTED`) and its lead over the runner-up beats the lead a random placement of the same model takes; the written reflections are then reindexed into it, so the file, the R-factors and the maps agree. Where either bar is missed the data keep the indexing they were merged in, and the report says by how much (`MODEL_INDEXING_MARGIN_SIGMA`). It is the **data** that are relabelled, never the model: every dataset of one crystal form processed against the same model comes out in that model's indexing, so the reflection files and maps of a screening campaign compare directly. The relabelling is a proper rotation of the lattice, so the merging statistics are unchanged and I(+)/I(-) keep their hand | -| **Serial stills**, only a model | `--model model.pdb`, with the cell and space group given (`-C` / `-S`). Structure factors are computed from the model up front and used as the reference for the per-image test, exactly as a reference MTZ would be, the crystals their own cell decides again excepted. The data-only resolution below is then run only as a check: `AMBIGUITY_DATA_DISAGREES=` counts the crystals on which it would have chosen otherwise | -| **Serial stills**, neither, space group given (`-S`) | Nothing to do: the crystals are made consistent with each other from the data alone (`INDEXING_AMBIGUITY_RESOLVED= data`), in an indexing that is arbitrary against other data sets. A model or reference still settles the weakest crystals more reliably than the other crystals can, and puts the merge in its own indexing | +| **Serial stills**, only a model, space group given (`-S`) | The crystals are made consistent with each other from the data alone, as in the row below - the model plays no part in the processing. Validation then fits the merge to the model in each candidate indexing, as for rotation data, and relabels the written reflections into the model's indexing where it wins | +| **Serial stills**, neither, space group given (`-S`) | Nothing to do: the crystals are made consistent with each other from the data alone (`INDEXING_AMBIGUITY_RESOLVED= data`), in an indexing that is arbitrary against other data sets. A reference still settles the weakest crystals more reliably than the other crystals can, and puts the merge in its own indexing | | Neither | The run warns and merges in whichever indexing it found: for rotation data a usable dataset in an arbitrary frame; for stills whose space group the run determined, a merge of mixed indexings, which looks like a perfect twin and can pass for higher symmetry than the crystal has. Run again with `-S` | Two things to know about where the choice lands: - **`--mode scale` cannot repair a stills run after the fact.** The per-image test happens at - integration time, so a `_process.h5` whose images were integrated without a reference — an MTZ or a - model — has already lost the distinction, and no re-merge brings it back; the data-only resolution + integration time, so a `_process.h5` whose images were integrated without a reference MTZ has + already lost the distinction, and no re-merge brings it back; the data-only resolution runs in the full pipeline, not in `--mode scale`. On rotation data, where the ambiguity is one choice for the whole dataset, `--mode scale --model model.pdb` does resolve it. - **The choice reaches the written reflections**, not only the R-factors and the maps: the merged diff --git a/docs/RUGNUX_CLI.md b/docs/RUGNUX_CLI.md index 45674058f..8f91c26ea 100644 --- a/docs/RUGNUX_CLI.md +++ b/docs/RUGNUX_CLI.md @@ -304,7 +304,7 @@ serial stills; `fft` (GPU) / `fftw` (CPU) index **de novo** and suit strong rota | `-z, --reference ` | Reference data of the same crystal form — an MTZ or a PDB structure-factor mmCIF (`-sf.cif`), gzipped or not, recognised by content; `--reference-mtz` is the same option: fixes the space group, its setting and the cell, resolves the [indexing ambiguity](RUGNUX_ADVANCED.md#the-indexing-ambiguity), hands over the R-free set and reports CCref. Not a scale anchor | | `--free-flags ` | Take only the R-free test set of this MTZ or structure-factor mmCIF - e.g. the deposited reflections of the `--model` - for the validation, the refinement and the merged files; nothing else of the file is used, so unlike `-z` it fixes no space group, cell or frame. Taken on the model's axes where the merge matches the file's intensities (`R_FREE_FLAGS=`, see [Free set and model bias](RUGNUX_MODEL_AND_REFERENCE.md#free-set-and-model-bias)) | | `--reference-column