Stills -C hypothesis: decide on the sampled spots on the lattice alone

Started from the de novo fit's detector, a cell 5% too long with its beta 4 degrees off settled within 0.3%
of the de novo distance while putting 6% as many sampled spots on the lattice, so "same detector" did not
tell a minority crystal form from a cell of the wrong shape and kept the wrong one. The cell given is now
kept where it puts at least 0.9x as many sampled spots on the lattice as the de novo cell, and otherwise the
run is processed as without -C. Docs say that a minority form given with -C is dropped too where the de novo
cell describes the majority well enough to index materially more spots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK
(cherry picked from commit 6e3e18cca5965481e032e09e2d956bb9d9766619)
This commit is contained in:
leonarski_f committed 2026-11-09 17:34:26 +01:00
1 parent c0a486bf99
commit 344e569500
4 files changed
+12 -18

No files matched your search

+5 -5
View File
@@ -432,11 +432,11 @@ from the detector distance, centre and module placement that fit found: from a s
can settle as far off as it started, and the de novo fit, whose cell takes up the start's error, is the nearer
start for any cell of the sample. Each, with its refined cell and geometry, then indexes the same sample of
frames. The cell given is kept where
it puts at least 0.9 times as many of the sample's spots on the lattice, and also where it does not but
its fit puts the detector within 2 % of where the de novo fit puts it: the detector is the same for every
crystal of the run, so such a cell is a crystal form of the sample (possibly a minority one, which the
user may be after). A cell that fits only with a detector of its own describes no crystal of the sample,
and the run is then processed as without `-C`, with a warning.
it puts at least 0.9 times as many of the sample's spots on the lattice as the de novo cell does. A cell given
that does not describe the frames - the same lattice in a shape they do not have, which the fit cannot leave
because the frames were indexed on it - fails this, and the run is then processed as without `-C`, with a warning. So does a minority crystal form
given with `-C` where the frames' de novo cell describes the majority well enough to index materially more of
the sample's spots.
**One crystal form.** A sample can hold two crystal forms, and a known-cell indexer fits both to the
given cell's orientation search; their refined cells then fall into two volume populations, and
+1 -1
View File
@@ -264,7 +264,7 @@ For very long axes the direction grid's angular resolution binds well below 500
| `--force-still` | Treat a rotation (goniometer) dataset as independent stills instead of rotation |
| `-X, --indexing-algorithm <txt>` | `Auto` (default) \| `FFT` \| `cuFFT` \| `FFTW` \| `FFBIDX` \| `None`, case-insensitive. `FFT` is the de-novo FFT search, on the GPU (cuFFT) where there is one and `--no-gpu` is not given, otherwise on the CPU (FFTW); `cuFFT` and `FFTW` name one implementation each; `cuFFT` needs a GPU and is refused without one. `FFBIDX` (known cell, `-C`) runs on the GPU where there is one and otherwise on the CPU. `Auto` takes `FFBIDX` on stills with a known cell, and `FFT` otherwise; rotation data always use the FFT search |
| `-F` | Short for `-X FFT`, kept for old command lines |
| `-C, --unit-cell <cell>` | Reference unit cell `"a,b,c,alpha,beta,gamma"` (required by `ffbidx`). On rotation data it also widens the FFT search to cover the cell given, at both ends: the longest axis looked for is raised to reach it, and `--fft-min-unit-cell` is lowered to admit it. A candidate that is an integer supercell of the cell given (a twin's coincidence lattice, a row taken at a multiple of its length) is stepped down to it. On stills the geometry refinement takes it as a prior (1 % on the lengths, 1° on the angles the crystal system leaves free) and tests it against the cell the frames index to de novo: a cell that fits the frames only with a detector distance of its own (more than 2 % from the de novo fit's) and puts fewer than 0.9 times as many sampled spots on the lattice is dropped with a warning, and the run is processed as without `-C` ([§7.7](CPU_DATA_ANALYSIS_INDEXING.md#77-stills-a-given-cell-and-the-detector-modules)) |
| `-C, --unit-cell <cell>` | Reference unit cell `"a,b,c,alpha,beta,gamma"` (required by `ffbidx`). On rotation data it also widens the FFT search to cover the cell given, at both ends: the longest axis looked for is raised to reach it, and `--fft-min-unit-cell` is lowered to admit it. A candidate that is an integer supercell of the cell given (a twin's coincidence lattice, a row taken at a multiple of its length) is stepped down to it. On stills the geometry refinement takes it as a prior (1 % on the lengths, 1° on the angles the crystal system leaves free) and tests it against the cell the frames index to de novo: a cell that, refined from the geometry the de novo fit found, puts fewer than 0.9 times as many sampled spots on the lattice as the de novo cell is dropped with a warning, and the run is processed as without `-C` ([§7.7](CPU_DATA_ANALYSIS_INDEXING.md#77-stills-a-given-cell-and-the-detector-modules)) |
| `--fft-min-unit-cell <num>` | Shortest cell axis the FFT search accepts, Å (default: 10). A candidate with a shorter axis is discarded — but on rotation data a row shorter than the floor, down to 3 Å, is recognised under the multiple of it the search reports past the floor, so a small-molecule cell is indexed without this flag. `-C` lowers the floor on its own to cover the cell given. On stills a crystal below the floor cannot be indexed unless this is lowered |
| `--min-indexed-spots <num>` | Spots a frame must have on the lattice before it counts as indexed (default: 6, minimum 4). It sets the reported indexing rate and the count the rotation first pass ranks candidate lattices by; whether the run has a lattice at all is decided on the pooled spots instead ([§4.1](CPU_DATA_ANALYSIS_INDEXING.md#41-indexed-spot-decision-inlier-test)), and integration is not gated by it |
| `-S, --space-group <num\|symbol>` | Space group number (`96`) or Hermann-Mauguin symbol (`P43212`) — for indexing and scaling. On serial stills whose group admits two indexings, it also lets the crystals be put on one from the data ([the indexing ambiguity](RUGNUX_ADVANCED.md#the-indexing-ambiguity)) |
+1 -1
View File
@@ -58,7 +58,7 @@ the rest walks through a run step by step.
| `--reference-column <label>` | An MTZ column label | Which column of the reference is read | Through `-z` only |
| `--free-flags <file>` | Merged data carrying an R-free set: an MTZ, or a structure-factor mmCIF - typically the deposited reflections of the `--model` | Its R-free set and nothing else: the model is validated and refined against it, on the model's axes, where the merge matches the file's intensities (`R_FREE_FLAGS= FILE`) | The free flags only |
| `-S, --space-group` | A space group | Fixes it: no space-group search | **Yes**: the group is yours (a fitting model may still relabel its hand) |
| `-C, --unit-cell` | A cell | Indexing looks for this cell (within tolerance); the FFT search range is widened to cover it; on stills the shared-geometry refinement anchors on it as a prior (without it, on the cell the frames index to), and drops it, as without `-C`, where it fits the frames only with a detector distance of its own and, with `-S` and `--model`, the per-image use of the model | **Yes**: the cell, and the axis order the files are written in |
| `-C, --unit-cell` | A cell | Indexing looks for this cell (within tolerance); the FFT search range is widened to cover it; on stills the shared-geometry refinement anchors on it as a prior (without it, on the cell the frames index to), and drops it, as without `-C`, where it puts materially fewer of a sample's spots on the lattice than the cell the frames index to de novo and, with `-S` and `--model`, the per-image use of the model | **Yes**: the cell, and the axis order the files are written in |
| `--force-rotation-lattice` | Nine numbers: a lattice | Skips the first-pass indexing and uses this lattice | **Yes**: the lattice |
| `--report-resolution <dmin>[,<dmax>]` | Another program's resolution range | A second statistics table at that range (`REFRES_*`) | No — report only |
+5 -11
View File
@@ -722,18 +722,15 @@ void Rugnux::RefineStillsGeometry(int start_image, int end_image, int images_to_
// and the de novo fit, whose cell takes up the start's error, is the nearer start for any cell of the sample. Each
// is then indexed with its refined cell and geometry on the same sample of frames, as DecideStillsGeometry tries
// its centres and distances. The cell given is kept where it puts as many of the sample's spots on the lattice,
// or nearly (GIVEN_KEPT_ABOVE, as a file's centre is kept), and also where it does not but its fit puts the
// detector where the de novo fit puts it: the detector is the same for every crystal of the run, so a cell that
// fits at the same distance is a crystal form of the sample - a minority one, which the user may ask for - and
// only a cell that needs a detector of its own describes no crystal of it. Otherwise the run goes on as it would
// without -C, from the de novo hypothesis, and says so. Where nothing indexes de novo, the cell given is fitted
// or nearly (GIVEN_KEPT_ABOVE, as a file's centre is kept); otherwise the run goes on as it would without -C,
// from the de novo hypothesis, and says so. Whether the two fits put the detector at the same distance does not
// tell a minority crystal form from a cell of the wrong shape: started from the de novo fit's detector, a cell
// 5% too long with its beta 4 degrees off settled within 0.3% of it while putting 6% as many spots on the lattice. Where nothing indexes de novo, the cell given is fitted
// from the file's geometry, as without this test.
void Rugnux::RefineStillsGeometryOrDeNovo(int start_image, int end_image, int images_to_process,
RugnuxObserver *observer) {
Logger logger("Rugnux");
constexpr double GIVEN_KEPT_ABOVE = 0.9;
// The fits' distances of one detector, from different cells and frames, agree within about a percent.
constexpr double SAME_DETECTOR = 0.02;
constexpr int SAMPLE_FRAMES = 96;
struct State {
@@ -768,11 +765,9 @@ void Rugnux::RefineStillsGeometryOrDeNovo(int start_image, int end_image, int im
}
// The cell given, from the detector (and the modules) the de novo fit left.
stills_geometry_frames_ = 0;
experiment_.SetUnitCell(given_cell);
RefineStillsGeometry(start_image, end_image, images_to_process, observer);
const State given = save();
const bool given_fitted = stills_geometry_frames_ > 0;
if (cancelled_)
return;
@@ -792,8 +787,7 @@ void Rugnux::RefineStillsGeometryOrDeNovo(int start_image, int end_image, int im
"{} sampled spots on the lattice; the cell indexed de novo, {:.2f} {:.2f} {:.2f} {:.2f} {:.2f} {:.2f} at "
"{:.2f} mm, {}", g.a, g.b, g.c, g.alpha, g.beta, g.gamma, distance_g, trials[0].on_lattice,
d.a, d.b, d.c, d.alpha, d.beta, d.gamma, distance_d, trials[1].on_lattice);
const bool same_detector = given_fitted && std::abs(distance_g / distance_d - 1.0) < SAME_DETECTOR;
if (trials[0].on_lattice >= GIVEN_KEPT_ABOVE * trials[1].on_lattice || same_detector) {
if (trials[0].on_lattice >= GIVEN_KEPT_ABOVE * trials[1].on_lattice) {
restore(given);
return;
}