From df2ee77e50994820feff7d1d3ee43d27a52cd4e3 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 4 Oct 2026 16:21:42 +0200 Subject: [PATCH] Battery: SHELXL's K row may start negative The top-group K was parsed with a pattern that stopped at a minus sign, so a weak first group (K -4.6) raised IndexError and lost the set's SHELXL numbers. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01K5K8jvPPbmCrbqnWkddTuB --- tools/battery/shelx_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/battery/shelx_check.py b/tools/battery/shelx_check.py index fc38c29d9..b84b8a8a9 100644 --- a/tools/battery/shelx_check.py +++ b/tools/battery/shelx_check.py @@ -181,7 +181,7 @@ def run_shelxl(shelxl, name, cwd): k_top = None i = lst.rfind("Analysis of variance for reflections employed in refinement") if i >= 0: - m = re.search(r"\n\s+K\s+([\d. ]+)", lst[i:i + 3000]) + m = re.search(r"\n\s+K\s+([-\d. ]+)", lst[i:i + 3000]) k_top = num(m.group(1).split()[-1]) if m else None n4 = last(r"R1 =\s*[\d.]+ for\s+(\d+) Fo > 4sig") return {"shx_r1": num(last(r"R1 =\s*([\d.]+) for\s+\d+ Fo > 4sig")),