Three defects of the stills global geometry/cell fit, each moving the detector distance:
- The cell angles were held at the start cell (InitCellAngles, "constant in v1") while the lengths and the
distance were free, so a wrong angle went into the lengths and the distance: a monoclinic cell given with
beta 4 degrees off refined to lengths and a distance both ~4% long, and a cell given with beta held at 90
on a crystal at ~90.9 left the distance 1.3% short. The angles the crystal system leaves free (monoclinic
beta, triclinic all three) are now a refined block. The cell given is a Gaussian prior (1% on a length, 1
degree on an angle) weighed against the spots' ~1 px scatter, replacing the unused length regularizer;
the refined-vs-start deviation (scale, lengths, angles) and the distance move are logged. A cell move, not
only a distance move, now triggers the re-indexing refit.
- The module placement started from the file's geometry: on a run whose header distance was 3% short and
centre 6 px off, the module scan absorbed the centre into every module and the placement pushed two
second-ring modules 13 px outwards - a radius-dependent push the gauge does not hold, which trades with
the distance/cell-scale curvature - and the distance settled 0.8% long. The placement now starts from a
fit of the same frames with the modules held, each frame's lattice taken from it
(GeometryRefinerResult::lattices). Same data, right cell: the distance went from 1.0% long to
the value a reference model's R-free puts it at, the modules moved < 1.4 px.
- A cell given with the wrong shape still indexes the frames at a distance of its own and the fit
cannot leave it. With -C on stills the geometry refinement is now run both with the cell given and de
novo, from the file's geometry, and each is indexed on the same 96-frame sample with its own refined
cell and geometry. The cell given is kept where it puts >= 0.9x as many spots on the lattice, or where its
fit puts the detector within 2% of the de novo fit (a crystal form of the sample, possibly a minority one
the user asked for); otherwise the run is processed as without -C, with a warning. `rugnux -C <wrong
cell> file` now gives the result of `rugnux file`. Costs one more geometry-refinement sample on -C stills
runs (~+30-50 s on a 4000-frame run).
Docs: RUGNUX_CLI (-C, --refine-geometry), CPU_DATA_ANALYSIS_INDEXING 7.7, RUGNUX_MODEL_AND_REFERENCE.
Test: RefineGlobalGeometry_MonoclinicBeta.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK
(cherry picked from commit fe442ff33aeec7569de1fdf90076dba6b39a8e8f)