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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-16 07:48:55 +01:00
1 parent d3f537aac6
commit 5d95974f37
1 file changed
+8 -1
@@ -569,8 +569,15 @@ std::optional<LatticeSearchResult> LatticeSearchForGroup(const CrystalLattice &L
std::optional<LatticeSearchResult> 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<LatticeSearchResult> 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)))