Doubled cell: a pass the probe has already refused merges and writes the other answer only

The doubled-cell pass runs the whole output pass - analyses, model validation, molecular replacement -
in the doubled cell, also where the decision was settled before it ran: the probe read no rise and
there is none to read on the merge, so the doubled cell cannot be adopted and the pass exists to write
<prefix>_doubled.mtz beside the answer. On the battery that was 41 of 44 doubled passes, each spending
3-20 s on a molecular replacement and analyses whose results go into a report that is never written.

Such a pass now carries one setting (other_answer_pass_): it merges and writes the doubled cell and
leaves out the analyses (tNCS, twinning, anisotropy), the model validation and the molecular
replacement; the model's twin-sibling choice goes with them. A pass that can still be adopted - a rise
read on the probe or to be read on the merge - runs exactly as before. The report says which with
DOUBLED_CELL_OTHER_ANALYSED (FALSE: the other cell's files are the reflection files alone, and it has
no R-free), and the log says so where the pass starts.

Measured back to back on 15 rotation sets (--model, --no-refine; 12 settled, 2 adopted, 1 with the rise
read): every main answer identical (space group, cell, d_min, R_meas, CC1/2, ISa, R-free, verdict;
battery compare: nothing changed beyond noise), the three unsettled passes unchanged step for step,
the settled passes 3-20 s shorter each (doubled pass 62.5 -> 42.0 s, 37.0 -> 28.2 s, 8.8 -> 3.6 s),
928.7 -> 846.7 s of wall over the 15.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQpv3w9JdZswRqKUW2H
This commit is contained in:
leonarski_fandClaude Fable 5.1 committed 2026-11-22 22:55:59 +01:00
1 parent 79d95b13b8
commit 1824c721fb
5 files changed
+30 -8

No files matched your search

+4
View File
@@ -941,6 +941,10 @@ and taken at its lower bound: it has to be at least half two standard errors dow
prefix), 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.
**`DOUBLED_CELL_OTHER_ANALYSED=`** is `FALSE` where the probe had already refused the doubled cell (no
rise read on it, and none to be read on the merge): that cell is merged and written as the other answer
only - its pass makes no analyses and no model validation or molecular replacement, so its `_doubled`
files are the reflection files alone and it has no R-free.
## Further lattices
+1
View File
@@ -2235,6 +2235,7 @@ ReportDocument BuildReportDocument(const std::string &output_prefix,
Add(s, KeyText("DOUBLED_CELL_OTHER_SPACE_GROUP", h.other_space_group));
Add(s, KeyReal("DOUBLED_CELL_OTHER_D_MIN", h.other_d_min_A, "{:.2f}"));
Add(s, KeyReal("DOUBLED_CELL_OTHER_CC_HALF", h.other_cc_half, "{:.4f}"));
Add(s, KeyBool("DOUBLED_CELL_OTHER_ANALYSED", h.other_analysed));
if (std::isfinite(h.other_r_free))
Add(s, KeyReal("DOUBLED_CELL_OTHER_R_FREE", h.other_r_free, "{:.4f}"));
}
+5
View File
@@ -949,6 +949,7 @@ struct ProcessResult {
UnitCell other_cell{};
std::string other_space_group;
double other_d_min_A = NAN, other_cc_half = NAN, other_r_free = NAN;
bool other_analysed = true; // false: the other cell was merged and written only, not analysed or validated
};
std::optional<DoubledCell> doubled_cell;
// The merged reflections as written, kept only where the run asks for them (the doubled-cell pass,
@@ -1360,6 +1361,10 @@ class Rugnux {
std::optional<RotationIndexerResult> last_rotation_result_;
// Keep the merged reflections on the result (ProcessResult::merged_reflections).
bool keep_merged_reflections_ = false;
// The doubled cell's pass is the other answer only - the probe had already refused the doubled cell
// before it ran - so it merges and writes the cell and leaves out what serves a report it never makes:
// the analyses, the model validation and the molecular replacement.
bool other_answer_pass_ = false;
// What the image sink is told the output pass is (RugnuxImageSink::Start): "_doubled" for the doubled
// cell's pass, empty otherwise.
std::string output_label_;
+10
View File
@@ -2402,6 +2402,14 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
output_label_ = "_doubled";
force_rotation_result_ = doubled;
keep_merged_reflections_ = true;
// Where the probe has already refused the doubled cell (no rise read on it and none to be read on the
// merge), the pass can only be the other answer: it is merged and written, not analysed or validated.
const bool settled = !on_merge && rises.empty() && lattice_class.empty();
other_answer_pass_ = settled;
if (settled)
logger.Info("Doubled-cell hypothesis: the probe has refused the doubled cell already, so its pass merges "
"and writes it as the other answer only - no analyses, no model validation, no molecular "
"replacement");
// 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.
@@ -2415,6 +2423,7 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
}
force_rotation_result_.reset();
keep_merged_reflections_ = false;
other_answer_pass_ = false;
output_label_.clear();
if (!d.has_merge_statistics || !d.consensus_cell) {
logger.Warning("Doubled-cell hypothesis: the doubled cell merged nothing - the probed cell stays the answer");
@@ -2532,6 +2541,7 @@ ProcessResult Rugnux::DoubledCellHypothesis(RugnuxObserver *observer, ProcessRes
ProcessResult &answer = adopt ? d : half;
const ProcessResult &other = adopt ? half : d;
h.other_suffix = adopt ? "_halfcell" : "_doubled";
h.other_analysed = !settled;
h.other_outputs = other.outputs;
h.other_cell = *other.consensus_cell;
h.other_space_group = other.space_group ? other.space_group->xhm() : std::string();
+10 -8
View File
@@ -2329,7 +2329,9 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
size_t model_rotations = 0;
std::optional<gemmi::SpaceGroup> model_group;
gemmi::UnitCell model_cell;
if (config_.model && write_output && !geometry_prepass) {
// The doubled cell's other-answer pass runs without the model (Rugnux::other_answer_pass_).
const bool with_model = config_.model && !other_answer_pass_;
if (with_model && write_output && !geometry_prepass) {
const SearchModel m = PrepareSearchModel(*config_.model);
model_predicted = m.failure_reason.empty() && m.predicted;
if (const gemmi::SpaceGroup *sg = m.st.find_spacegroup(); sg != nullptr && m.st.cell.is_crystal()) {
@@ -3987,7 +3989,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
if (!geometry_prepass && result.space_group && result.consensus_cell)
sibling_choices = SiblingTwinChoices(*result.space_group, sg_search);
std::optional<TwinSubgroupChoice> model_sibling;
if (!sibling_choices.empty() && config_.model && !model_predicted && model_group) {
if (!sibling_choices.empty() && with_model && !model_predicted && model_group) {
const auto siblings = SiblingTwinChoices(
*result.space_group, sg_search,
ModelRotationsOnDataAxes(*model_group, model_cell, gemmi::UnitCell(*result.consensus_cell)));
@@ -3995,7 +3997,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
model_sibling = siblings.front();
}
const bool model_tests_twin =
config_.model
with_model
&& (twin_metric_subgroup.has_value() || model_sibling.has_value()
|| (!model_predicted && model_rotations > 0
&& model_rotations < result.space_group->operations().sym_ops.size()));
@@ -4312,7 +4314,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
// crystal cell) is searched for by molecular replacement in every sibling's merge, beside the answer's. Each
// stays in the scaler's frame here; std::list, as the files made from them point into them.
std::list<std::pair<TwinSubgroupChoice, RotationScaleMerge::Result>> sibling_merges;
const bool model_run_search_siblings = config_.model && write_output && !geometry_prepass && !superseded
const bool model_run_search_siblings = with_model && write_output && !geometry_prepass && !superseded
&& (model_predicted || (config_.force_mr && !model_group));
if (model_run_search_siblings)
for (const auto &c : sibling_choices)
@@ -4351,7 +4353,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
// beside the molecular replacement too (finish_analyses), so it takes its own copy of the group: the
// enantiomorph relabelling there changes the experiment's.
std::future<decltype(sm.statistics.anisotropy)> anisotropy;
if (!geometry_prepass && !superseded && result.consensus_cell) {
if (!geometry_prepass && !superseded && !other_answer_pass_ && result.consensus_cell) {
AnisotropyRunInfo aniso_run;
if (sm.statistics.sweep_quality.measured && sm.statistics.sweep_quality.sweep_deg > 0.0f)
aniso_run.observed_rotation_deg = sm.statistics.sweep_quality.sweep_deg;
@@ -4381,7 +4383,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
// run, and spent on a merge the walk replaces it is spent twice (GeometryWalkProbePending). Where the answer
// waits on the probe, what the model stage would let go of the card first goes now - the indexers, and the
// merge engine where the ledger's merge does not keep it - so that the probe can run.
if (result.consensus_cell && write_output && config_.model && !geometry_prepass && !superseded
if (result.consensus_cell && write_output && with_model && !geometry_prepass && !superseded
&& GeometryWalkProbePending(result, p.postrefine_ahead)) {
if (census_future.valid())
census_future.wait();
@@ -4396,7 +4398,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
Note("this pass is to be re-run (see the log); it writes nothing");
}
}
const bool model_run = result.consensus_cell && write_output && config_.model && !geometry_prepass
const bool model_run = result.consensus_cell && write_output && with_model && !geometry_prepass
&& !superseded && !model_cut();
// The merge's own shell bounds, so CC(model, data) is reported on the shells CC1/2 was.
std::vector<float> report_shell_d_min;
@@ -4567,7 +4569,7 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
// statistics text and its written reflections, and neither survives the run. The promotion flag
// below is a different thing - it is what the SEARCH did, the second pass reads it, and it is
// set either way.
if (!geometry_prepass && !superseded) {
if (!geometry_prepass && !superseded && !other_answer_pass_) {
// Translational pseudo-symmetry first: its verdict is an input to the twinning analysis,
// which must not read its own L-test when a non-half-integer pseudo-translation has biased
// it. Reporting only - no reflection and no merge depends on the outcome, so a sweep of a joint