From b44b0a56fbaa15d154db5ca1f2fb243199530b99 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Fri, 29 May 2026 12:01:58 +0200 Subject: [PATCH] RotationIndexer: For fixed space group, set explicitly lattice type and centering for refinement --- image_analysis/RotationIndexer.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/image_analysis/RotationIndexer.cpp b/image_analysis/RotationIndexer.cpp index cd7a04ea..8ed00d83 100644 --- a/image_analysis/RotationIndexer.cpp +++ b/image_analysis/RotationIndexer.cpp @@ -73,9 +73,19 @@ void RotationIndexer::TryIndex() { } auto indexer_result = indexer_.Run(experiment, coords_sel); - if (!indexer_result.lattice.empty()) { - // Find lattice type - search_result_ = LatticeSearch(indexer_result.lattice[0]); + if (!indexer_result.lattice.empty() && indexer_result.lattice[0].CalcVolume() > 1.0) { + auto sg = experiment.GetGemmiSpaceGroup(); + if (sg) { + search_result_ = LatticeSearchResult{ + .niggli_class = 0, // Since Niggli class was not searched for, we don't know which one + .conventional = indexer_result.lattice[0], // If lattice provided, it is for now primitive == conventional + .system = sg->crystal_system(), + .centering = sg->centring_type(), + }; + } else { + // Find lattice type based on cell + search_result_ = LatticeSearch(indexer_result.lattice[0]); + } // Run refinement DiffractionExperiment experiment_copy(experiment); @@ -97,6 +107,7 @@ void RotationIndexer::TryIndex() { if (data.crystal_system == gemmi::CrystalSystem::Monoclinic) data.latt.ReorderMonoclinic(); + if (XtalOptimizer(data, v_sel)) { indexed_lattice = data.latt; updated_geom_ = data.geom;