From 7782e304ed2e05eb41ddf3ece234719abb319be2 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 27 Oct 2026 04:20:21 +0100 Subject: [PATCH] RESULT-CHANGING: Refinement: atoms gridded out to a density of 1e-4 e/A^3, not 1e-5 The refinement's density calculators (the CPU engine's, the GPU engine's and the map gradient's) cut every atom's density at an absolute 1e-4 e/A^3 of its blurred density instead of gemmi's default 1e-5. The radius, the gather's box and the gradient's box all follow from it, so the structure factors, the gradients and with them the refined model change in the last digits. Molecular replacement's and the validation's own calculators keep gemmi's default. Where this sits against other programs' defaults, which are relative to the atom's own peak density: cctbx resolves phenix.refine's wing_cutoff to 1e-3 of the peak below 5 A (1e-4 above), X-PLOR's ELIM 7 is e^-7 of the peak and SFALL's VDWR 2.5 about 2e-3 of it. For carbon at B + blur of 20-120 A^2 an absolute 1e-4 is 6e-5 to 6e-4 of the peak - still stricter than any of them. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu --- image_analysis/structure_refinement/RefinementGPU.cpp | 1 + image_analysis/structure_refinement/RefinementXray.cpp | 1 + image_analysis/structure_refinement/RefinementXray.h | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/image_analysis/structure_refinement/RefinementGPU.cpp b/image_analysis/structure_refinement/RefinementGPU.cpp index 9dd72df01..dc886f577 100644 --- a/image_analysis/structure_refinement/RefinementGPU.cpp +++ b/image_analysis/structure_refinement/RefinementGPU.cpp @@ -287,6 +287,7 @@ private: dc.grid.unit_cell = cell_; dc.grid.spacegroup = &sg_; dc.blur = blur; + dc.cutoff = REFINEMENT_DENSITY_CUTOFF; return dc; } diff --git a/image_analysis/structure_refinement/RefinementXray.cpp b/image_analysis/structure_refinement/RefinementXray.cpp index b3a014843..faba0a11d 100644 --- a/image_analysis/structure_refinement/RefinementXray.cpp +++ b/image_analysis/structure_refinement/RefinementXray.cpp @@ -38,6 +38,7 @@ gemmi::DensityCalculator Calculator(const gemmi::UnitCell &cell, c dc.grid.unit_cell = cell; dc.grid.spacegroup = &sg; dc.blur = blur; + dc.cutoff = REFINEMENT_DENSITY_CUTOFF; return dc; } diff --git a/image_analysis/structure_refinement/RefinementXray.h b/image_analysis/structure_refinement/RefinementXray.h index 642a54fe0..d7062afbf 100644 --- a/image_analysis/structure_refinement/RefinementXray.h +++ b/image_analysis/structure_refinement/RefinementXray.h @@ -159,6 +159,10 @@ private: uint64_t nvtx_; }; +// The density an atom is gridded out to, in e/A^3 of its blurred density (DensityCalculator::cutoff, 1e-5 by +// default): the radius of every atom, and with it the gather and the gradient, follow from it. +constexpr float REFINEMENT_DENSITY_CUTOFF = 1e-4f; + // The blur for a model whose smallest B may go as low as b_floor: DensityCalculator's // set_refmac_compatible_blur() for that B, on the refinement grid of d_min. double RefinementBlur(const gemmi::UnitCell &cell, const gemmi::SpaceGroup &sg, double d_min, double b_floor);