Refinement rounds: no placement in rounds 2-3, no maps for a round not kept

A further round starts from the model the round before refined, so the
rigid-body and per-residue-B placement is skipped there; and a round whose
R-free does not beat the one before is returned before its maps, twin null
and blobs (it is discarded anyway).

The placement skip changes the path of the later rounds, not the rule: on
22 battery merges with their placed models R-free equal to the rounds
without it except lyso_x06da_ref 0.2413 -> 0.2430 and cytc_x06da_1
0.3143 -> 0.3128; from the timing benchmark's AlphaFold models (MR, mx):
cytc_x10sa 0.410 -> 0.399, 9zlo 0.283 -> 0.284, myob_x10sa 0.312 -> 0.312,
9s02/9gjx equal; cytochrome C live merge, MR model 0.405 -> 0.400. Saves
about 1-2 s of the 7-8 s the rounds add on cytochrome C (wall 15.5 -> 13.6 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-14 03:24:01 +01:00
1 parent fabcb0e4d3
commit a64d3e3c4c
2 files changed
+14 -1

No files matched your search

@@ -2563,7 +2563,8 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector<Me
}
});
RefinePlacement(ctx, settings.group_b, result);
if (settings.placement)
RefinePlacement(ctx, settings.group_b, result);
if (restrained)
PlaceRiders(ctx, topo);
r = ctx.Refit();
@@ -3314,6 +3315,12 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector<Me
result.cancelled = ctx.Cancelled();
if (result.cancelled)
logger.Warning("Refinement: cancelled, {} weight trials ran", result.trials.size());
// a round the caller keeps only below keep_below, and that does not reach it, needs no maps (RefineRounds)
if (std::isfinite(settings.keep_below) &&
!(result.restrained && !result.as_given && result.r_free < settings.keep_below)) {
result.seconds = std::chrono::duration<double>(std::chrono::steady_clock::now() - start).count();
return result;
}
finish();
logger.Info("Refinement: done in {:.1f} s, {} target evaluations{}", result.seconds, ctx.evaluations,
@@ -3350,12 +3357,14 @@ RefinementResult RefineRounds(const gemmi::Structure &placed, const std::vector<
null_first, held);
RefinementSettings again = settings;
again.solvent = false;
again.placement = false; // the chains and the B per residue were placed by the first round
for (int round = 2; round <= REFINEMENT_ROUNDS; round++) {
if (!result.ok || !result.restrained || result.as_given || result.cancelled || settings.score_only ||
result.model == nullptr)
break;
logger.Info("Refinement, round {}: from the model the round before ended with (R-free {:.4f})", round,
result.r_free);
again.keep_below = result.r_free - R_FREE_TIE;
RefinementResult next = RefineOnce(*result.model, merged, cell, sg, wavelength_A, logger, again, twin_laws,
null_first);
if (!next.ok || !next.restrained || next.as_given || !(next.r_free < result.r_free - R_FREE_TIE)) {
@@ -84,6 +84,10 @@ struct RefinementSettings {
// statistic - false where the model has most likely been refined against the free reflections too (a deposited
// model of this crystal scored on a free set drawn here).
bool as_given_competes = true;
// For a further round of the refinement (RefineRounds): the placement stage skipped, and the maps, the twin null
// and the blobs made only where R-free ends below keep_below - the round is not kept otherwise.
bool placement = true;
double keep_below = INFINITY;
bool gpu = true;
size_t nthreads = 1;
size_t gpu_resident_bytes = 0; // held on the card by what runs beside