Refinement on the CPU: the arms take half of the threads each only where the lattice admits a twin law

Without one the twinned arm ends at once and its half sat idle (found by lane t: about 6 of 12 threads
busy through the whole refinement). Identical R-free and evaluations; at 12 threads thau 125 -> 92 s,
9zlo 143 -> 90 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-16 19:18:12 +01:00
1 parent b3d26b2c87
commit dc88610e0d
1 file changed
+4 -1
@@ -4645,7 +4645,10 @@ RefinementResult RefineModel(const gemmi::Structure &placed, const std::vector<M
if (!settings.twin)
result = RefineOnce(placed, data, cell, sg, wavelength_A, logger, settings);
else {
const bool halves = on_cpu && settings.population <= 1 && settings.nthreads > 1;
// on the CPU each arm on half of the threads - where the lattice admits a twin law, without which the twinned
// arm ends at once and its half would sit idle
const bool halves = on_cpu && settings.population <= 1 && settings.nthreads > 1 &&
!RefinementTwinLaws(cell, sg).empty();
RefinementSettings untwinned_settings = settings, twin_settings = settings;
if (halves) {
twin_settings.nthreads = settings.nthreads / 2;