diff --git a/image_analysis/geom_refinement/PostRefine.cpp b/image_analysis/geom_refinement/PostRefine.cpp index 6bf0dc2cc..a2fc800f0 100644 --- a/image_analysis/geom_refinement/PostRefine.cpp +++ b/image_analysis/geom_refinement/PostRefine.cpp @@ -666,7 +666,8 @@ PostRefineResult PostRefineRotationGeometry(PostRefineObservations observations, for (int j = 0; j < 3; ++j) { rv_f[j] = ax0[j]; q0_f[j] = p0_0[j]; q1_f[j] = p1_0[j]; q2_f[j] = p2_0[j]; } - double distance_corr[4]; + // Only written when the joint solve is usable, and read unconditionally below. + double distance_corr[4] = {NAN, NAN, NAN, NAN}; bool convJ = solve_joint(FIT, /*wide=*/true, /*fix_distance=*/false, bm_f, ds_f, rv_f, q0_f, q1_f, q2_f, distance_corr); double exc_ref_se = NAN; diff --git a/image_analysis/scale_merge/SearchSpaceGroup.cpp b/image_analysis/scale_merge/SearchSpaceGroup.cpp index f180daa6c..df62dfde0 100644 --- a/image_analysis/scale_merge/SearchSpaceGroup.cpp +++ b/image_analysis/scale_merge/SearchSpaceGroup.cpp @@ -1645,9 +1645,11 @@ SearchSpaceGroupResult SearchSpaceGroup( // the crystal itself defines: the best-agreeing operator anywhere at one end, unrelated // reflections (random_pairing_r) at the other. A genuine operator sits at the clean end, // a false one at the random end (see min_operator_r_contrast). - // - The first step out of P1, where only one operator is confirmed at all, has no other - // operator to be the clean end - fall back to the merge's own random-noise R floor - // (max_operator_r_over_floor). + // - Where there is no clean end to measure from - the first step out of P1, where only one + // operator is confirmed at all, and the merge whose best operator is itself close to the + // random end - fall back to the merge's own random-noise R floor + // (max_operator_r_over_floor). The contrast has no scale to read on those, but leaving + // the candidate ungated would promote it on no merge-degradation evidence at all. bool r_refused = false; double r_gate_value = std::numeric_limits::quiet_NaN(); if (std::isfinite(c.r_added)) { @@ -1657,8 +1659,7 @@ SearchSpaceGroupResult SearchSpaceGroup( r_gate_value = (result.random_pairing_r - c.r_added) / (result.random_pairing_r - global_best_r); r_refused = r_gate_value < opt.min_operator_r_contrast; - } else if (n_confirmed_ops < 2 - && std::isfinite(result.merge_r_floor) && result.merge_r_floor > 0.0) { + } else if (std::isfinite(result.merge_r_floor) && result.merge_r_floor > 0.0) { r_gate_value = c.r_added / result.merge_r_floor; r_refused = r_gate_value > opt.max_operator_r_over_floor; } diff --git a/rugnux/Rugnux.cpp b/rugnux/Rugnux.cpp index 0efca9fa0..10a46f362 100644 --- a/rugnux/Rugnux.cpp +++ b/rugnux/Rugnux.cpp @@ -6922,7 +6922,8 @@ ProcessResult Rugnux::RunPipeline(RugnuxObserver *observer, bool write_output, b result.twinning.laue_class_was_chosen_by_promotion = promoted_point_group; // A refusal that stood on the twin-immune zone names the law: the first operator the // refused group adds, at the fraction its own disagreement implies (a lower bound). - if (result.space_group_search && result.space_group_search->refused_point_group_representative + if (twin_sg && result.space_group_search + && result.space_group_search->refused_point_group_representative && result.twin_zone_decision.find("acentric, the added") != std::string::npos) { const auto &sgs = *result.space_group_search; const gemmi::GroupOps hi = sgs.refused_point_group_representative->operations();