From 7bf906e4a2870e24d2cde518b6522b0ea002ed49 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 25 Oct 2026 17:33:46 +0100 Subject: [PATCH] rugnux: a placed model is refined by default - giving a model is the opt-in Refinement (Refinement.h) now runs whenever --model or --mr places the model (rigid body fits, or molecular replacement placed it), on the GPU or the CPU: a run that should not spend the time is given no model. --no-refine skips it (for debugging); --refine is still accepted and ignored. A model that was not placed (rejected by the rigid body, not placed by MR - e.g. the battery's wrong-model null) is no longer refined. Processing-inert as before: it runs after every decision; R_WORK/R_FREE and every key outside REFINE_ (section 5), and .mtz / _model.cif / _maps.mtz, are unchanged. The block moved after the placement notes so they stay on the step that placed the model. The viewer's processing jobs refine too. The equivalent command line gives --no-refine back where refinement was off. Battery: score.py reads keys exactly, so REFINE_R_FREE cannot alias R_FREE; new report-only fields rfree_refined, rwork_refined, refine_s (part of rugnux_wall_s), shown in the per-set table. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu (cherry picked from commit b0bb741831f517b553e59152b3b482a3f75d953a) --- docs/ACKNOWLEDGEMENT.md | 4 +- docs/CPU_DATA_ANALYSIS.md | 2 +- docs/RUGNUX_ADVANCED.md | 2 + docs/RUGNUX_MODEL_AND_REFERENCE.md | 22 +++++--- rugnux/ResultReport.cpp | 6 +-- rugnux/Rugnux.h | 13 ++--- rugnux/RugnuxCommandLine.cpp | 4 +- rugnux/RugnuxScaleMerge.cpp | 53 ++++++++++--------- rugnux/rugnux_cli.cpp | 21 ++++---- tests/RugnuxTest.cpp | 4 ++ tools/battery/README.md | 1 + tools/battery/report.py | 4 +- tools/battery/score.py | 4 ++ viewer/windows/JFJochProcessingJobsWindow.cpp | 1 + 14 files changed, 86 insertions(+), 55 deletions(-) diff --git a/docs/ACKNOWLEDGEMENT.md b/docs/ACKNOWLEDGEMENT.md index 29a2474ab..c33ca9378 100644 --- a/docs/ACKNOWLEDGEMENT.md +++ b/docs/ACKNOWLEDGEMENT.md @@ -518,7 +518,7 @@ molecular replacement; the error itself is AlphaFold's: J. Jumper, R. Evans, A. accurate protein structure prediction with AlphaFold" (2021), Nature 596, 583-589 [doi:10.1038/s41586-021-03819-2](https://doi.org/10.1038/s41586-021-03819-2). -**Structure refinement** (`--refine`) — the placed model is refined against the maximum-likelihood +**Structure refinement** (of a placed model) — the placed model is refined against the maximum-likelihood amplitude target, the Rice distribution of an observed amplitude given the model's (its centric counterpart for a centric reflection): N. S. Pannu and R. J. Read, "Improved structure refinement through maximum likelihood" (1996), Acta Cryst. A52, 659-668 @@ -577,7 +577,7 @@ predicted distances around metal sites in proteins" (2006), Acta Cryst. D62, 678 nucleic acids, F. Leonarski, L. D'Ascenzo and P. Auffinger, "Mg2+ ions: do they bind to nucleobase nitrogens?" (2017), Nucleic Acids Res. 45, 987-1004 [doi:10.1093/nar/gkw1175](https://doi.org/10.1093/nar/gkw1175). -**Unmodelled density** — the blobs `--refine` lists are the connected regions of the difference map above +**Unmodelled density** — the blobs the refinement lists are the connected regions of the difference map above a cutoff, found by flood fill as Coot's "unmodelled blobs" finds them, in GEMMI's implementation (`find_blobs_by_flood_fill`): P. Emsley, B. Lohkamp, W. G. Scott and K. Cowtan, "Features and development of Coot" (2010), Acta Cryst. D66, 486-501 [doi:10.1107/S0907444910007493](https://doi.org/10.1107/S0907444910007493). diff --git a/docs/CPU_DATA_ANALYSIS.md b/docs/CPU_DATA_ANALYSIS.md index 5f7b77f60..5aa0e067b 100644 --- a/docs/CPU_DATA_ANALYSIS.md +++ b/docs/CPU_DATA_ANALYSIS.md @@ -18,7 +18,7 @@ This document describes the crystallographic algorithms implemented in Jungfrauj 12. auxiliary statistics (Wilson plot, ⟨I/σ(I)⟩, CC1/2, CCref), 13. amplitude estimation (French–Wilson) and R-free test-set flagging, 14. optional model-based validation: rigid-body placement of a supplied model (molecular replacement where the rigid body does not place it, or for a predicted model), R-free against it, sigma_A-weighted 2mFo−DFc / mFo−DFc electron-density maps, and an anomalous difference map with the strongest anomalous sites named. -15. optional restrained refinement of the placed model (`--refine`): rigid bodies and group B, then positions and B against a maximum-likelihood amplitude target with the dictionary's geometry, the X-ray weight chosen by R-free within geometry bounds, and the unexplained blobs of the refined difference map. +15. restrained refinement of the placed model (wherever a model is placed): rigid bodies and group B, then positions and B against a maximum-likelihood amplitude target with the dictionary's geometry, the X-ray weight chosen by R-free within geometry bounds, and the unexplained blobs of the refined difference map. The reference is split into four parts, in pipeline order; the section numbers run continuously diff --git a/docs/RUGNUX_ADVANCED.md b/docs/RUGNUX_ADVANCED.md index 698c3255e..466f093f6 100644 --- a/docs/RUGNUX_ADVANCED.md +++ b/docs/RUGNUX_ADVANCED.md @@ -472,6 +472,8 @@ Scaling and merging: | `--reference-column