WIP: doubled-cell class identified against the half cell's primitive lattice

A centred half cell (I-centred orthorhombic, its centring class the added one) was compared to the
doubled cell's sub-lattices as if primitive, so its class was never read.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EizBKhTqrAYago9KJG3dA3
This commit is contained in:
2026-10-10 14:16:33 +02:00
co-authored by Claude Opus 5.5
parent 7580256ac7
commit 757ca02dbf
2 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -678,7 +678,8 @@ struct DoubledClassTranslation {
std::vector<Shell> shells;
};
DoubledClassTranslation FitDoubledClassTranslation(const std::vector<MergedReflection> &merged,
const UnitCell &doubled_cell, const UnitCell &half_cell);
const UnitCell &doubled_cell, const UnitCell &half_cell,
char half_centering = 'P');
// Whether two passes hold the same lattice: the same Bravais class and primitive volumes within 2 %.
bool ArmsHoldSameLattice(const ProcessResult &a, const ProcessResult &b);
+5 -3
View File
@@ -1470,14 +1470,15 @@ std::string DoubledCellRises(const ProcessResult::SupercellClass &sc) {
}
DoubledClassTranslation FitDoubledClassTranslation(const std::vector<MergedReflection> &merged,
const UnitCell &doubled_cell, const UnitCell &half_cell) {
const UnitCell &doubled_cell, const UnitCell &half_cell,
char half_centering) {
DoubledClassTranslation out;
// The added class in the written cell: the parity whose sub-lattice is the half cell. Its real lattice
// is the doubled one plus half of (p0 a + p1 b + p2 c), so one vector the class is odd on is replaced
// by that half-vector.
const CrystalLattice dl(doubled_cell);
const Coord v[3] = {dl.Vec0(), dl.Vec1(), dl.Vec2()};
const UnitCell want = CrystalLattice(half_cell).NiggliReduce().GetUnitCell();
const UnitCell want = CrystalLattice(half_cell).ToPrimitive(half_centering).NiggliReduce().GetUnitCell();
double best_mismatch = INFINITY;
for (int c = 1; c < 8; c++) {
const std::array<int, 3> p = {(c >> 2) & 1, (c >> 1) & 1, c & 1};
@@ -1681,7 +1682,8 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
// doubled merge, that one translation accounts for most of the class in every shell: the two halves
// of the cell are then one content displaced, out to the limit (FitDoubledClassTranslation).
const DoubledClassTranslation tr = FitDoubledClassTranslation(d.merged_reflections, *d.consensus_cell,
*half.consensus_cell);
*half.consensus_cell,
half.consensus_centering.value_or('P'));
d.merged_reflections.clear();
const DoubledClassTranslation::Shell *weakest = nullptr;
std::string table;