Tests: close the .hkl before removing it; floor the GPU model-scale B tolerance
The SHELX .hkl test removed its file while its own ifstream still held it open, which Windows refuses. The GPU-vs-gemmi model-scale check held b_star to 1e-4 of its largest element alone, which on an F4132 case fitted at B 0.6 A^2 failed on a 1e-4 A^2 difference; it now also allows 0.001 A^2 of B. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K5K8jvPPbmCrbqnWkddTuB
This commit is contained in:
@@ -212,8 +212,12 @@ void CheckSameScale(const ModelScaleParams &gpu, const gemmi::Scaling<float> &cp
|
||||
const double b_cpu[6] = {cpu.b_star.u11, cpu.b_star.u22, cpu.b_star.u33,
|
||||
cpu.b_star.u12, cpu.b_star.u13, cpu.b_star.u23};
|
||||
CHECK(std::fabs(gpu.k_overall - cpu.k_overall) <= 1e-4 * std::fabs(cpu.k_overall));
|
||||
// b_star = F B_cart F^T, so a B of 0.001 A^2 is 0.001 / a^2 in it for the longest edge a. Without that
|
||||
// floor a fit whose B comes out near zero is held to 1e-4 of almost nothing (a cubic case at B 0.6 A^2
|
||||
// differed by 1e-4 A^2).
|
||||
const double edge = std::max({cpu.cell.a, cpu.cell.b, cpu.cell.c});
|
||||
for (int i = 0; i < 6; i++)
|
||||
CHECK(std::fabs(gpu.b_star[i] - b_cpu[i]) <= 1e-4 * MaxAbs(b_cpu) + 1e-12);
|
||||
CHECK(std::fabs(gpu.b_star[i] - b_cpu[i]) <= 1e-4 * MaxAbs(b_cpu) + 1e-3 / (edge * edge));
|
||||
}
|
||||
|
||||
struct Case {
|
||||
|
||||
Reference in New Issue
Block a user