rugnux: leave the twin overlap out of integration where the twin-composite step adopted a domain

Where the first pass recognises two twin domains on their coincidence lattice (reticular
merohedry, index n = 2 or 3) and adopts the stronger domain's cell, the 1/n of that domain's
reflections that lie on the other domain's lattice too carry both domains' intensity. The step
now records the overlap as a lattice vector t of the standing cell (h . t divisible by n), the
rotation result carries it, and the per-image integration drops those reflections. t is a
real-space vector, so it holds through every later change of basis; it is read in sixths so a
centred conventional cell (F, I, C, R) is exact. Each unique reflection keeps its equivalents
that the other domain does not overlap; only those whose every equivalent is overlapped are lost.

The two-pass quality guard compared signal counts between a header pass that integrated
everything and a refined pass that left the overlap out, and sent the run back to the
composite lattice. A pass that left an overlap of index n out now has its counts taken up by
n/(n-1), and its axial rows are not compared with a pass that did not.

Nothing changes where the step does not fire: the field stays empty, the factor is 1.

Measured (merging the existing outputs with and without the class H.(111) = 0 mod 3, against
removing a random third): spinel-twinned F-cubic private set R_meas 25.5 -> 14.3% (random
26.7%), insu_I_x06da_low_isa 24.1 -> 16.6% (random 24.2%). With this change, end to end:
- insu_I_x06da_low_isa: I23, R_meas 24.0 -> 12.7%, ISa 5.2 -> 28.8, CC1/2 0.997 -> 1.000,
  completeness 99.8 -> 95.7%, d 1.45 -> 1.47 A, model R-free 0.260 -> 0.246.
- private F-cubic twin: F432, R_meas 25.5 -> 6.3%, ISa 3.9 -> 20.4, completeness 100 -> 93%,
  d 3.23 -> 3.77 A (XDS reference 4.0). 432 now passes the added-operator gate on the
  all-observation merge (contrast 0.75, bound 0.72) instead of being refused there (0.62) and
  rescued by the twin-immune zone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-10 11:22:58 +02:00
1 parent b530c2d326
commit e2b0e7dfb3
9 files changed
+72 -8

No files matched your search

+16 -1
View File
@@ -134,6 +134,15 @@ IndexAndRefine::IndexingOutcome IndexAndRefine::DetermineLatticeAndSymmetryRotat
outcome.symmetry.centering = result->search_result.centering;
outcome.symmetry.niggli_class = result->search_result.niggli_class;
outcome.symmetry.crystal_system = result->search_result.system;
if (const auto &tw = result->twin_overlap) {
// t is a vector of the lattice, so in a centred cell's basis its coordinates are multiples
// of 1/2 or 1/3: in sixths they are integers, and the test is then modulo 6n.
const auto &l = result->lattice;
outcome.twin_overlap_w = {static_cast<int>(std::lround(6.0f * (tw->t * l.Astar()))),
static_cast<int>(std::lround(6.0f * (tw->t * l.Bstar()))),
static_cast<int>(std::lround(6.0f * (tw->t * l.Cstar())))};
outcome.twin_overlap_n = 6 * tw->n;
}
}
return outcome;
}
@@ -587,7 +596,13 @@ void IndexAndRefine::QuickPredictAndIntegrate(DataMessage &msg,
// caller's callback binds it to the right image (GPU-resident buffer, host buffer, or the assembled
// FPGA image read straight on the CPU).
auto integration_start_time = std::chrono::steady_clock::now();
const std::vector<Reflection> integrated = integrate(prediction.GetReflections(), nrefl, msg.number);
std::vector<Reflection> integrated = integrate(prediction.GetReflections(), nrefl, msg.number);
if (const int n = outcome.twin_overlap_n; n > 0) {
const auto &w = outcome.twin_overlap_w;
std::erase_if(integrated, [&](const Reflection &r) {
return (r.h * w[0] + r.k * w[1] + r.l * w[2]) % n == 0;
});
}
msg.integrated_reflections = integrated.size();
auto integration_end_time = std::chrono::steady_clock::now();
msg.integration_time_s = std::chrono::duration<float>(integration_end_time - integration_start_time).count();