ModelScaleGPUTest: on a model's 6 A zone the GPU and gemmi fits are held to the same R

The 6 A zone of ModelScaleGPU_MatchesGemmiOnAModelsPoints holds few points, so its B minimum is flat:
since the model density's walk moved to single precision (the Metal density series) the last bits of the
structure factors move where gemmi's Levenberg-Marquardt stops by about twice the parameters' tolerance
(b_star 1.2e-6 against 6.4e-7 on the C 1 2 1 and P 21 21 21 cells). There the two fits are compared on
their R, as ModelScaleGPU_FitMatchesGemmi does; the 3.5 A zone keeps the parameter comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-18 17:58:01 +02:00
1 parent 7b293bade7
commit 4f8d135c2a
1 file changed
+11 -2
+11 -2
View File
@@ -315,7 +315,11 @@ TEST_CASE("ModelScaleGPU_MatchesGemmiOnAModelsPoints", "[ModelValidation][gpu]")
// As above: the same grid point, or a near-tie's neighbour at the CPU winner's R.
const bool same_point = solvent.k_sol == cpu.k_sol && solvent.b_sol == cpu.b_sol;
CHECK(std::fabs(solvent.r - report.r_work_fit) < R_TOLERANCE);
if (same_point)
// The 6 A zone holds few points, so its B minimum is flat and the last bit of the model's
// structure factors moves where gemmi's fit stops by more than the parameters' tolerance: there
// the two fits are held to the same R, as in ModelScaleGPU_FitMatchesGemmi, not the same B.
const bool flat = zone >= 6.0;
if (same_point && !flat)
CheckSameScale(solvent.scale, cpu);
gemmi::Scaling<float> ref = cpu;
@@ -326,7 +330,12 @@ TEST_CASE("ModelScaleGPU_MatchesGemmiOnAModelsPoints", "[ModelValidation][gpu]")
ref.fit_isotropic_b_approximately();
ref.fit_parameters();
const ModelScaleParams p = gpu.scale.Fit(gpu.fcmol, gpu.fmask, cpu.k_sol, cpu.b_sol);
CheckSameScale(p, ref);
if (!flat)
CheckSameScale(p, ref);
gemmi::Scaling<float> with_gpu = ref;
with_gpu.k_overall = p.k_overall;
with_gpu.b_star = {p.b_star[0], p.b_star[1], p.b_star[2], p.b_star[3], p.b_star[4], p.b_star[5]};
CHECK(std::fabs(with_gpu.calculate_r_factor() - ref.calculate_r_factor()) < R_TOLERANCE);
}
}