--model: the bulk-solvent b_sol ceiling follows the model's atomic B

The model scale searched b_sol only over 10-80 A^2. That is the range
Fokine & Urzhumtsev report for models at ordinary B, but on low-resolution
entries whose deposited B is 200-400 A^2 the fit sat on the 80 A^2 ceiling
(and k_sol on its 0.1 floor): a solvent edge far sharper than the atoms it
lies against, reaching too deep in resolution. R-free came out 0.05-0.10
above REFMAC (0 cycles) and phenix.model_vs_data on the same MTZ, model
and flags.

The ceiling is now max(80, 2 x the model's mean atomic B) (SolventBMax),
for the reported fit and for the rigid-body placement's per-zone solvent
(CPU, GPU and the host fallback alike). The grid keeps eight b_sol values
across a wider box, so it costs no more points; the default box, and so
every model with mean B <= 40 A^2, is bit-identical to before.

Measured (10 open-arm sets with --model, GPU build, vs the same base):
  high-B set, 7.0 A:  R-free 0.462 -> 0.364, b_sol 80 -> 379 (REFMAC 0.366,
                      REFMAC's own b_sol ~371; model_vs_data 0.291);
                      the rigid-body step now commits
  high-B set, 3.9 A:  0.410 -> 0.331, b_sol 80 -> 388, k_sol 0.10 -> 0.225
                      (REFMAC 0.328, model_vs_data 0.314); null 10.1 -> 14.2 sigma
  B~200 set, 3.2 A:   0.408 -> 0.402, b_sol 80 -> 120; enantiomorph label
                      decision unchanged (27.2 -> 25.8 sigma)
  7 other sets (mean B 16-57): bit-identical R, k_sol, b_sol, placement.
p.hkl md5 and the MTZ reflection data are identical to the base on all 10.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-10 20:47:04 +02:00
1 parent e39e40f955
commit 1420908885
11 files changed
+92 -25

No files matched your search

@@ -376,18 +376,21 @@ ModelScaleReport FitModelScale(gemmi::Scaling<float> &scaling, ModelScaleBox box
fitted.insert(fitted.end(), pts.begin(), pts.end());
};
// Coarse pass over the whole box, then one refinement pass around the winner.
// Coarse pass over the whole box, then one refinement pass around the winner. b_sol is stepped by
// 10 A^2, or in eight values where the box is wider than the default, so a raised ceiling costs
// no more grid points.
const double b_step = std::max(10.0, (box.b_hi - box.b_lo) / 7.0);
std::vector<PointFit> coarse;
for (double ks = box.k_lo; ks <= box.k_hi + 1e-9; ks += 0.05)
for (double bs = box.b_lo; bs <= box.b_hi + 1e-9; bs += 10.0)
for (double bs = box.b_lo; bs <= box.b_hi + 1e-9; bs += b_step)
coarse.push_back(PointFit{ks, bs});
try_points(coarse);
const double k0 = best_k_sol, b0 = best_b_sol;
const double k_hi2 = std::min(box.k_hi, k0 + 0.05);
const double b_hi2 = std::min(box.b_hi, b0 + 10.0);
const double b_hi2 = std::min(box.b_hi, b0 + b_step);
std::vector<PointFit> fine;
for (double ks = std::max(box.k_lo, k0 - 0.05); ks <= k_hi2 + 1e-9; ks += 0.025)
for (double bs = std::max(box.b_lo, b0 - 10.0); bs <= b_hi2 + 1e-9; bs += 5.0)
for (double bs = std::max(box.b_lo, b0 - b_step); bs <= b_hi2 + 1e-9; bs += b_step / 2.0)
fine.push_back(PointFit{ks, bs});
try_points(fine);
@@ -399,3 +402,16 @@ ModelScaleReport FitModelScale(gemmi::Scaling<float> &scaling, ModelScaleBox box
report.r_work_fit = best_r;
return report;
}
double SolventBMax(const gemmi::Model &model) {
double sum = 0;
size_t n = 0;
for (const gemmi::Chain &chain : model.chains)
for (const gemmi::Residue &residue : chain.residues)
for (const gemmi::Atom &atom : residue.atoms) {
sum += atom.b_iso;
++n;
}
const double b_max = ModelScaleBox{}.b_hi;
return n > 0 ? std::max(b_max, 2.0 * sum / static_cast<double>(n)) : b_max;
}