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)))