WIP: doubled-cell pass only where the class rises; no model validation in it

A class that does not rise keeps the half cell whatever the doubled merge shows, so the doubled pass
is no longer run for it - on a ci-tier crystal (R-centred, class at 1-2% of the lattice) that pass ran
the card out of memory and failed the run. The doubled pass also runs without --model: placing the
model in a doubled cubic crystal's 776 A R-centred cell took twenty minutes.

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:
leonarski_fandClaude Opus 5.5 committed 2026-10-10 14:00:39 +02:00
1 parent 48201d35ec
commit 57543845c0
2 files changed
+28 -16

No files matched your search

+13 -11
View File
@@ -618,19 +618,21 @@ spots of further lattice domains can land on the half-integer positions too. A `
under the `SUPERCELL_POSSIBLE` flag, and the summary's `Supercell` line carries the same advice.
**Both cells merged.** Where the class stands clear of the six empty ones out to the limit (in at least
three shells measured above its noise, at more than twice the strongest of them in standard errors), the
run integrates and merges the doubled cell as well, on the same orientation and geometry, and writes one
of the two as its answer and the other's merged files beside it. Which one is the answer is a policy,
because nothing measured in the intensities separates a crystal deposited in the doubled cell from one
deposited in the half cell: the doubled cell is adopted where the class reaches a quarter of the lattice's
intensity in the finest shell both are measured in - where the half cell no longer approximates the
crystal - and a class that stays a small fraction of the lattice at every resolution keeps the half cell.
three shells measured above its noise, at more than twice the strongest of them in standard errors) and
grows significantly with resolution - the half cell holds at low resolution and not at high, the shape of
a pseudo-translation breaking down - the run integrates and merges the doubled cell as well, on the same
orientation and geometry, and decides with both merges in hand. The size of the class does not decide
it - crystals deposited in the half cell carry classes as strong as one deposited in the doubled cell.
The doubled cell is the answer only where, in the doubled merge, one translation - half a cell plus a
small offset, fitted over the class - modulates at least half of the added class in every resolution
shell, so the two halves of the cell are one content displaced. The doubled pass runs without `--model`. A class that is there whatever the
direction (copies that differ in content, twin domains, neighbouring reflections) keeps the half cell.
**`DOUBLED_CELL_ADOPTED=`** says which was written as the answer and **`DOUBLED_CELL_DECISION=`** why;
**`DOUBLED_CELL_OTHER_FILE=`** names the other hypothesis's merged file (`<prefix>_doubled.mtz`, or
`<prefix>_halfcell.mtz` where the doubled cell was adopted, with its `.cif` and `.hkl`), and
**`DOUBLED_CELL_OTHER_CELL=`**, **`DOUBLED_CELL_OTHER_SPACE_GROUP=`**, **`DOUBLED_CELL_OTHER_D_MIN=`**,
**`DOUBLED_CELL_OTHER_CC_HALF=`** and, with `--model`, **`DOUBLED_CELL_OTHER_R_FREE=`** describe it.
Compare the two in refinement.
`<prefix>_halfcell.mtz` where the doubled cell was adopted, with the rest of its files under the same
prefix), and **`DOUBLED_CELL_OTHER_CELL=`**, **`DOUBLED_CELL_OTHER_SPACE_GROUP=`**,
**`DOUBLED_CELL_OTHER_D_MIN=`**, **`DOUBLED_CELL_OTHER_CC_HALF=`** and, where it is the probed cell and
`--model` was given, **`DOUBLED_CELL_OTHER_R_FREE=`** describe it. Compare the two in refinement.
## Further lattices
+15 -5
View File
@@ -1610,6 +1610,16 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
return half;
Logger logger("Rugnux");
const auto &sc = *half.supercell;
// Only a class that could be adopted is worth the pass: one that does not rise with resolution keeps
// the half cell whatever the doubled merge shows, and a doubled merge of a large crystal is not free
// (measured: an R-centred 531 A cell ran the card out of memory).
const std::string rises = DoubledCellRises(sc);
if (rises.empty()) {
logger.Info("Doubled-cell hypothesis: the half-integer class {} {} {} stands clear of the other classes but "
"does not grow significantly with resolution, so the half cell describes the crystal as well "
"at high resolution as at low - not merged", sc.h, sc.k, sc.l);
return half;
}
// The lattice the probed cell was integrated on, doubled along the class, with everything else of
// that indexing - orientation, geometry, axis - kept, so the two merges differ by the cell alone.
@@ -1636,6 +1646,9 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
config_.output_prefix = base_prefix.empty() ? base_prefix : doubled_prefix;
force_rotation_result_ = doubled;
keep_merged_reflections_ = true;
// No model validation in this pass: a model is placed in a cell, and on a doubled cubic crystal
// (an R-centred 776 A cell) placing it took twenty minutes for a pass that decides nothing by it.
const std::string model_path = std::exchange(config_.model_path, std::string());
// The quality guard compares a refined pass against the header pass in the same cell; this pass is
// in another cell and is judged here instead.
quality_guard_pass1_.reset();
@@ -1648,6 +1661,7 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
}
force_rotation_result_.reset();
keep_merged_reflections_ = false;
config_.model_path = model_path;
config_.output_prefix = base_prefix;
if (!d.has_merge_statistics || !d.consensus_cell) {
logger.Warning("Doubled-cell hypothesis: the doubled cell merged nothing - the probed cell stays the answer");
@@ -1660,7 +1674,6 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
// pseudo-translation breaking down - it grows with resolution (DoubledCellRises) - and where, in the
// 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 std::string rises = DoubledCellRises(sc);
const DoubledClassTranslation tr = FitDoubledClassTranslation(d.merged_reflections, *d.consensus_cell,
*half.consensus_cell);
d.merged_reflections.clear();
@@ -1677,15 +1690,12 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
"modulates, by shell:{}", tr.parity[0], tr.parity[1], tr.parity[2], tr.eps[0], tr.eps[1],
tr.eps[2], table);
const bool one_translation = tr.tested && weakest->modulated_share >= 0.5;
const bool adopt = !rises.empty() && one_translation;
const bool adopt = one_translation;
ProcessResult::DoubledCell h;
h.adopted = adopt;
h.decision = adopt
? fmt::format("{}; and one pseudo-translation accounts for most of it in every shell (at least {:.2f}, "
"at {:.1f}-{:.1f} A)", rises, weakest->modulated_share, weakest->d_low_A, weakest->d_high_A)
: rises.empty()
? std::string("the probed cell stands: the added class does not grow significantly with resolution, "
"so the half cell describes the crystal as well at high resolution as at low")
: !tr.tested
? std::string("the probed cell stands: the added class could not be read in the doubled merge")
: fmt::format("the probed cell stands: one pseudo-translation accounts for only {:.2f} of the added class "