Refinement: REFINE_ADP_MODEL keeps a round's displacement model where its U are held

After a second round whose weight trials held the U the first round's TLS or
U-per-atom choice made, the label was reset to "isotropic" (or "the model's U
held") because the kept trial carried no hypothesis name. It now keeps the
first round's model with ", U held"; and a model whose per-atom U are held
also drops the input's TLS groups, as one that refined them does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdHHZ4cogS1mrGUtfN7
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-18 10:32:50 +01:00
1 parent adde6d5a5c
commit cb4240767e
1 file changed
+6 -3
@@ -3291,7 +3291,7 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector<Me
ctx.st.meta.refinement[0].tls_groups = TlsBodiesToGroups(ctx.Model(), ctx.tls);
for (size_t k = 1; k < ctx.st.meta.refinement.size(); k++)
ctx.st.meta.refinement[k].tls_groups.clear();
} else if (result.adp_model == "anisotropic")
} else if (result.adp_model.starts_with("anisotropic"))
for (gemmi::RefinementInfo &ref : ctx.st.meta.refinement)
ref.tls_groups.clear();
if (const std::vector<gemmi::TlsGroup> *groups = ctx.st.meta.get_tls_groups())
@@ -4380,9 +4380,12 @@ RefinementResult RefineOnce(const gemmi::Structure &placed, const std::vector<Me
if (displaces(t, trial(best)))
best = static_cast<int>(k);
}
// (the model where the weights ended keeps the displacement model a round before chose for it)
if (result.adp_model.empty() || state.trial.adp.empty())
// (the model where the weights ended keeps the displacement model a round before chose for it, its U held by
// the weight trials since)
if (result.adp_model.empty())
result.adp_model = result.adp_input == "isotropic" ? "isotropic" : "the model's U held";
else if (state.trial.adp.empty() && result.adp_model != "isotropic" && !result.adp_model.ends_with("held"))
result.adp_model += ", U held";
if (best >= 0) {
result.adp_model = outcomes[best].trial.adp;
state = std::move(outcomes[best]);