From 89b37f9bc45a3828e99b83f4644a05bfbe3eb8b2 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 27 Oct 2026 20:27:52 +0100 Subject: [PATCH] RESULT-CHANGING: Refinement: a displacement model is kept only where it displaces where the weights ended The displacement hypotheses were compared with the first of them (the B factors refined on), and the one chosen was taken whatever the state the weights ended at; only that first one had to displace it. Where the trajectory held B and refining B is worse (a 3.6 A set with twelve copies: B held R-free 0.2797, B refined 0.3103), a per-atom U at 0.2939 was then adopted although it is worse than holding B. Now the chosen hypothesis must displace the state as any step must, else the B factors stay as the weights left them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQqN9qRD57vnShzTC37 --- image_analysis/structure_refinement/Refinement.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/image_analysis/structure_refinement/Refinement.cpp b/image_analysis/structure_refinement/Refinement.cpp index 331dce601..2b95f9dd7 100644 --- a/image_analysis/structure_refinement/Refinement.cpp +++ b/image_analysis/structure_refinement/Refinement.cpp @@ -2717,14 +2717,14 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector(k); } - // The B factors refined on are a step further on the same weights: kept where they displace where the - // weights ended, as any step. - if (best >= 0) { + // Each is a step further on the same weights: the one chosen is kept where it displaces where the weights + // ended, as any step (at low resolution the B factors refined on may all be worse than B held). + result.adp_model = iso.name; + if (best >= 0 && displaces(outcomes[best].trial, state.trial)) { result.adp_model = outcomes[best].trial.adp; - logger.Info("Refinement: displacement model {}", result.adp_model); - } - if (best > 0 || (best == 0 && displaces(outcomes[0].trial, state.trial))) state = std::move(outcomes[best]); + } + logger.Info("Refinement: displacement model {}", result.adp_model); } for (size_t s = 1; s < trial_slots.size(); s++) ctx.evaluations += trial_slots[s].ctx->evaluations;