diff --git a/image_analysis/IndexAndRefine.cpp b/image_analysis/IndexAndRefine.cpp index ebe85b0c..7b9563f8 100644 --- a/image_analysis/IndexAndRefine.cpp +++ b/image_analysis/IndexAndRefine.cpp @@ -101,16 +101,27 @@ IndexAndRefine::IndexingOutcome IndexAndRefine::DetermineLatticeAndSymmetry(Data auto latt = indexer_result.lattice[0]; if (latt.CalcVolume() > 1.0) { auto sg = experiment.GetGemmiSpaceGroup(); + const auto algorithm = experiment.GetIndexingAlgorithm(); + const bool de_novo = (algorithm == IndexingAlgorithmEnum::FFT + || algorithm == IndexingAlgorithmEnum::FFTW); - // If space group and cell provided => always enforce symmetry in refinement - // If space group not provided => guess symmetry + // If space group and cell provided => enforce that symmetry in refinement. + // If not => detect the symmetry from the lattice. if (sg && experiment.GetUnitCell()) { + // FFBIDX returns the lattice already in the reference setting, so use it + // as-is. De-novo indexers (FFT/FFTW) return an arbitrarily-oriented primitive + // cell that must first be reduced to the conventional setting, else enforcing + // the crystal system on mis-assigned axes rejects every frame. Centering is + // taken from the user's space group; niggli_class is left unassigned (0) - it + // is a property of the primitive cell incl. centering, which LatticeSearch + // cannot recover from a cell the user may have given centered (e.g. C2). A + // proper primitive-cell indexing path (CrystFEL-style) is deferred. outcome.symmetry = LatticeMessage{ .centering = sg->centring_type(), .niggli_class = 0, .crystal_system = sg->crystal_system() }; - outcome.lattice_candidate = latt; + outcome.lattice_candidate = de_novo ? LatticeSearch(latt).conventional : latt; } else { auto sym_result = LatticeSearch(latt); outcome.symmetry = LatticeMessage{