From 48bf9ebe3a86579ba6720e3d9212d9d9f4eeb366 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 26 Oct 2026 15:21:31 +0100 Subject: [PATCH] CellEsd: PI from JFJochMath.h instead of M_PI, and the Herbstein (2000) credit at the block e.s.d.s M_PI is not defined by MSVC without _USE_MATH_DEFINES, and CellEsd.cpp is reachable from the viewer build. The citation, so far only in CellEsd.h, now also sits at the algorithm it credits. The other files new in rc180 under common/, image_analysis/, reader/, writer/, rugnux/ and viewer/ use no M_* constants or POSIX-only calls (grep of the rc180 diff). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu (cherry picked from commit a019bc5fd2084907af9379068af3265ffe6c9ef5) --- image_analysis/geom_refinement/CellEsd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/image_analysis/geom_refinement/CellEsd.cpp b/image_analysis/geom_refinement/CellEsd.cpp index 23340f18b..1c7924d9b 100644 --- a/image_analysis/geom_refinement/CellEsd.cpp +++ b/image_analysis/geom_refinement/CellEsd.cpp @@ -6,6 +6,7 @@ #include #include +#include "../../common/JFJochMath.h" #include "../../common/ParallelFor.h" namespace { @@ -37,7 +38,7 @@ namespace { return v; } - double ToDeg(double rad) { return rad * 180.0 / M_PI; } + double ToDeg(double rad) { return rad * 180.0 / PI; } } std::vector MetricBasis(const gemmi::SpaceGroup &sg) { @@ -206,6 +207,7 @@ std::optional EstimateCellEsd(std::span obs, con out.theta_max_deg = ToDeg(std::asin(std::min(1.0, wavelength_A * q_max / 2.0))); // The same fit on blocks of consecutive frames: the scatter of their cells, over sqrt(blocks). + // Least-squares cell e.s.d.s alone are too small: following Herbstein (2000) Acta Cryst. B56, 547-557 std::vector> block_cells; const int64_t span = static_cast(frame_max) - frame_min + 1; std::vector> block_obs(nblocks);