From 5d95974f37e4aec09f0764a43a1016476285b3ea Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 16 Nov 2026 07:48:55 +0100 Subject: [PATCH] LatticeSearchForSystem: ask only for the system's own Bravais centrings The table has no character of an A/B-centred class, nor of a C/F/R one outside its systems, so 6 of the 7 searches were empty on a triclinic -C cell and 3-5 elsewhere. Same result: a randomized probe over P/C/I/F/R lattices of every system (3000 cells, rotated, near-equal lengths) never found a class outside the new lists. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK --- image_analysis/lattice_search/LatticeSearch.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/image_analysis/lattice_search/LatticeSearch.cpp b/image_analysis/lattice_search/LatticeSearch.cpp index dd22b9fc8..f51e3e22d 100644 --- a/image_analysis/lattice_search/LatticeSearch.cpp +++ b/image_analysis/lattice_search/LatticeSearch.cpp @@ -569,8 +569,15 @@ std::optional LatticeSearchForGroup(const CrystalLattice &L std::optional LatticeSearchForSystem(const CrystalLattice &L, gemmi::CrystalSystem system) { const bool hexagonal_family = system == gemmi::CrystalSystem::Hexagonal || system == gemmi::CrystalSystem::Trigonal; + // The system's Bravais lattices: the table above has characters of no other centring. + const std::string centrings = system == gemmi::CrystalSystem::Triclinic ? "P" + : system == gemmi::CrystalSystem::Monoclinic ? "PCI" + : system == gemmi::CrystalSystem::Orthorhombic ? "PCIF" + : system == gemmi::CrystalSystem::Tetragonal ? "PI" + : system == gemmi::CrystalSystem::Cubic ? "PIF" + : "PR"; std::optional best; - for (const char c : {'P', 'C', 'A', 'B', 'I', 'F', 'R'}) { + for (const char c : centrings) { const auto s = !hexagonal_family ? system : c == 'R' ? gemmi::CrystalSystem::Trigonal : gemmi::CrystalSystem::Hexagonal; if (auto r = LatticeSearchForClass(L, s, c); r && (!best || MetricDeviation(*r) < MetricDeviation(*best)))