Skip to content

Continuous Cartesian pose refinement (refine=cont): refactoring plan

  • Status: completed by the delegated run (section 14.1), Phases 0 to 10 done (section 15), awaiting the maintainer's review of the raw diff; O4-O8 taken as recorded under "Delegation", each open to reversal at review; doc/code_overview/fortran-indexes to be regenerated by the maintainer (Phase 10 row)
  • Scope: five-parameter Cartesian pose refinement and its integration in refine3D and refine3D_auto
  • Source baseline: the inventory was taken at master 712b4d86 and still holds at 30d23bc62 (line counts, the matcher line numbers of section 8.1 and the parameter lines cited in Phase 1 are unchanged). Phase 0 records its numbers at the commit the refactoring branches from, not at 712b4d86 (Phase 0)
  • Last updated: 2026-10-01

This document is self-contained. It holds the contract, the current-state inventory, the target architecture, the phased refactoring, and the test plan. Per repository policy the maintainer compiles and runs; the delegated run of section 14.1 compiles and runs on the Dell under the maintainer's request.

1. Goal

Give continuous Cartesian pose refinement the same boundaries as the rest of SIMPLE:

  • refine=cont is a refinement mode of refine3D that runs with no polar object alive, and refine3D_auto accepts it;
  • the matcher references exactly one continuous-pose symbol, strategy3D_cont;
  • the numerics sit in two encapsulated classes, a calculator owned by builder and an optimizer owned by the strategy, as in the polar path;
  • both objectives follow objfun with the polar definitions, and the reference follows the polar branch;
  • a pose polish after discrete search is available as a scheduled Cartesian pass;
  • there is no separate refine3D_pose_cont program.

Two rules hold for the whole sequence. Ownership moves and scientific changes are separate commits; Phase 3 is the only phase that changes numerics. Existing tests are reused and moved with the code they test; every new behavior lands with its test in the same phase (section 10).

2. Current state

Production code (3,147 lines in eight modules):

Module Lines Holds
volume/simple_cartesian_pose_refiner.f90 1,182 Cartesian reference, particle preparation, objective and gradient, shift and joint Levenberg-Marquardt (LM)
interp/simple_cartesian_fourier.f90 138 Stateless embedding, extraction and KB gathers; also used by reconstructor_pcg and flex PCA
strategies/search/simple_pose_cont_refine3D_adapter.f90 745 Policy records, reference and particle workspaces, reference file I/O, observation preparation, coordinate conversion, transaction control
strategies/search/simple_strategy3D_pose_cont.f90 276 Standalone refine=pose_cont strategy
strategies/search/simple_pose_cont_run_stats.f90 377 Per-thread accounting and per-iteration report files
commanders/simple/simple_commander_refine3D_pose_cont.f90 82 Program refine3D_pose_cont, extending commander_refine3D_auto
strategies/parallelization/simple_refine3D_pose_cont_workflow.f90 196 Stage sequencing for that program
ui/simple/simple_ui_refine3D_pose_cont.f90 151 Its UI

Shared files touched: simple_strategy3D_matcher, simple_matcher_refvol_utils, simple_matcher_ptcl_batch, simple_refine3D_strategy, simple_strategy3D_prob, simple_euclid_sigma2, simple_parameters*, simple_ui_refine3D, simple_exec_refine3D, simple_commanders_refine3D, simple_convergence, simple_defs_ori, simple_binoris, simple_refine3D_fnames.

What is wrong with it:

  1. The matcher hosts two continuous-pose pipelines (pose_cont=yes after a discrete winner, refine=pose_cont instead of the search). 124 of its 717 lines mention continuous-pose state; it holds the only three select type downcasts in non-test strategy code and a 55-line numerical routine (section 8.1).
  2. The adapter exports eleven public types and nine free procedures and has no type named after the module. Most procedures forward to the refiner or wrap one or two image/ori calls (section 8.2).
  3. strategy3D_pose_cont cannot satisfy the strategy3D contract: the base embeds the PFTC search object s, which it never initialises, and it needs a seven-argument bind_context and a get_result that are not in the abstract interface.
  4. The objective ignores objfun: both euclid and cc runs optimize a normalized correlation on sigma-whitened data. corr is never written.
  5. Shared helpers import the adapter and take optional feature flags (cartesian_only, pose_cont_particles); euclid_sigma2 gained a second constructor and a setter that lets an outside module write sigma2_part.
  6. Parameters: four switches, string comparisons in four modules, validation keyed on a program name, cc_emit_sigma silently forced on, LM policy hard-coded in adapter type defaults.
  7. The particle record grew from 50 to 52 reals for two telemetry flags.
  8. Reporting exists three times: per-particle fields, a stats module with its own per-partition files, and system_clock timers in the particle loop.
  9. commander_refine3D_auto was given four override hooks so that a second commander could inherit from it.
  10. 28 error stop statements in the continuous-pose code (24 in the refiner, 4 in the adapter), several reachable from the OpenMP particle loop; four of them sit in pure procedures (sample_fourier_with_grad, shift_native_to_crop, shift_crop_to_native). The four in simple_cartesian_fourier (shape checks in center_embed_real3d and center_crop_real3d) belong to the shared layer and are out of scope.

What is sound and is kept: rollback to the input pose after a failed solve; explicit shift and rotation bounds anchored at the seed; explicit even/odd reference selection; the KB derivative in simple_kbinterpol; the stateless simple_cartesian_fourier layer; the numerical tests.

3. Contract

Accepted by the maintainer on 2026-09-30.

Id Ruling
C1 The matcher uses one strategy object, strategy3D_cont, and no other continuous-pose symbol.
C2 simple_pose_cont_refine3D_adapter is dissolved; each piece moves to its owner.
C3 The feature is restructured as encapsulated classes: private components, new/kill, type-bound behavior, one type per module named after it.
C4 Both objectives are supported and follow objfun, mirroring the polar implementation.
C5 sigma2 is never part of a correlation calculation. A Cartesian cc pass neither reads, requires nor writes sigma2, as in the polar branch, where sigma2 is not produced under objfun=cc (ruling 2026-09-30). The internal cc_emit_sigma of the polar CC pose initialization does not apply to Cartesian passes.
C6 Cartesian euclid is the polar loss, normalized by the particle's weighted power, with exp(-L) as the stored score.
C7 refine=cont is a refinement mode of refine3D, testable on its own and independent of the polar machinery.
C8 Pose polishing after discrete search is supported. It is scheduled per pass: a refine=cont pass follows a discrete pass. A per-particle second stage inside one pass is not part of this plan; it can be added later on the same objects.
C9 The Cartesian and polar objectives are not directly comparable. No decision compares a value from one with a value from the other.
C10 The reference follows the polar branch of refine3D, including how deapodization is handled.
C11 refine3D_auto supports refine=cont. In that mode it bypasses all polar machinery, including the discrete greedy initialization, and runs a purely Cartesian refinement. It is therefore a continuation mode: the project must already hold 3D poses from a discrete workflow.
C12 refine=cont in refine3D_auto follows the nsample policy.
C13 refine3D_pose_cont is not a separate program.
C14 Each representation persists its own objective value: polar passes write corr, Cartesian passes write corr_cart. A Cartesian pass never writes corr. Stored scores are read, not recalculated by the code that needs them (ruling 2026-09-30; replaces "the refined Cartesian score is persisted in corr").
C15 The particle record carries corr_cart and the improved flag; "attempted" equals "sampled in a Cartesian pass" and needs no field. The layout is O8 (the 50-real target accepted earlier cannot hold the extra field and is superseded).
C16 One LM route is kept, chosen from the Phase 0 baseline; pose_cont_route is removed and LM policy becomes private constants of the optimizer.
C17 Names: folder src/main/cftc, classes cartft_calc and cartft_pose_opt, builder field cftc, and an abstract strategy3D_pftc parent for the polar strategies. New identifiers use the short form cart for Cartesian (modules, types, procedures, variables, files, suite= selectors); prose keeps "Cartesian" (2026-09-30).
C18 The end-to-end gate gets its own high-level CTest entry, cont_refine3D_1jxy; SIMPLE_CTEST_BUDGET goes from 29 to 30.
C19 The polish switch is pose_cont=yes\|no. When on, a Cartesian pass follows every discrete iteration, in refine3D and in refine3D_auto.
C20 refine3D_auto keeps objfun=euclid; objfun=cc with refine=cont is available through refine3D only.
C21 objfun_den with refine=cont is rejected in parameter validation for now.
C22 The Cartesian references reach the matcher as a file of prepared real-space volumes, written once per iteration by the reference materializer and read by every matcher, shared-memory or distributed. The matcher pads and transforms them and gathers central sections on the fly; it does not prepare references itself (accepted 2026-09-30; section 6.6).

Facts verified in the source that the contract relies on:

  • C10. The polar branch prepares the reference in read_mask_filter_refvols, pads it by 2 in real space (pad_fft), expands it (expand_cmat) and gathers with normalized KB weights scaled by pf^3 (interp_fcomp_oversamp). It applies no inverse KB envelope at the gather; deapodization happens when the volume is reconstructed (reconstructor%invenv1d). The Cartesian production path (new_physical_reference) already does the same on the same prepared volume, and test_matched_projector_boundary pins its gather against interp_fcomp_oversamp. The unused new_inverse_envelope_reference is removed unless O5 is ruled (b). The polar branch also passes the particle through the same stencil (polarize_oversamp); the Cartesian particle side is O5.
  • C14. With corr_cart beside corr, the two representations never share a field: a Cartesian pass writes corr_cart for every particle it processes, accepted or not, and leaves corr as the last polar pass left it. Under pose_cont=yes, corr therefore refers to the discrete pose before the polish and corr_cart to the polished pose; under refine=cont, corr keeps the value of the discrete workflow the poses came from. Within corr, scores from different iterations and band limits still sit side by side under fractional updates, as they always have. The readers of corr, all of which now see polar values only:
  • The one routine that sorts the stored ptcl3D score is make_projdir_class_samples in refine3D_states (balance=yes with fractional updates); it orders each projection bin by corr. sample4update_class reads that order only to cut a bin to its best frac_best fraction, or to take its top nsample under greedy_sampling=yes. exec_refine3D_states sets frac_best=1.0 and greedy_sampling=no unconditionally, so the whole bin is eligible and the sample is drawn by lowest updatecnt with a shuffle: the order is never read. The final missing-update pass runs with balance=no.
  • The class-biased sampling of abinitio3D, classify3D_refs, sample_classes and bootstrap_cavgs ranks ptcl2D scores, which a Cartesian pass does not write.
  • The even/odd choice in abinitio3D_cavgs compares two polar scores of one run. gen_ptcl_mask (with frac_best), extremal_bound and get_proj_sample_stats rank corr but have no production caller.
  • Every other reader is a report (convergence statistics, the class document of cavger_gen2Dclassdoc, the abinitio3D_addon report) or tests corr against zero (has_been_searched).

The reader of corr_cart is the per-iteration report of a Cartesian pass (simple_convergence, over the particles that pass sampled). No consumer recalculates a stored score. - C15. simple_binoris%read_particle_record reads records narrower than the current width and is pinned by test_legacy_narrow_particle_records. It rejects wider ones. The record is 52 reals since 2026-09-21: slot 51 holds pose_cont_attempted, slot 52 pose_cont_improved, both 0/1, cleared by the matcher on every run, so only particles of a pose_cont run carry a 1. Slot 42 (cc_nonpeak) is unused today but carried a correlation statistic in earlier versions (its reporting was removed in e45fd1aa2, 2024-03-19), so older projects can hold values there. - C10, the reference handoff. No central section is precomputed on the Cartesian path. materialize_reprojection_model_from_volumes, in the iteration strategy, runs the reference preparation the polar branch runs (read_mask_filter_refvols: volume choice, masking, filtering, envelope; the low-resolution even/odd blend; centering, with its shift mapped into the project) and writes the prepared real-space volumes, one MRC file per state and half (pose_cont_reference_stateNN_{even,odd}.mrc). Under refine=pose_cont (cartesian_only) it skips the reprojection; under pose_cont=yes it reprojects as well. The matcher reads them (load_reference_slot), pads each by 2, Fourier transforms it once (load_pose_reference) and extracts every Fourier sample it needs at the continuous rotation by a KB gather with derivatives (sample_fourier_with_grad). What crosses the boundary is the prepared volume, not a reprojection model. The handoff stays because the preparation and the band limit are decided once, by the strategy (refine3D_policy.md, section 6), for every matcher of the iteration (section 6.6); its ownership moves (section 6.4).

4. Open decisions

Id Decision Recommendation Blocks
O2 The convergence rule for refine=cont (section 7.2). Until a rule has been chosen and tested, early convergence is disabled for refine=cont: a run goes to maxits. The candidate statistics are logged every iteration so the rule can be chosen from data. Enabling an early stop; no phase

| O4 | Particle preparation (section 5, "Particle preparation" and "CTF"). The polar path centres the particle on its stored shift and phase-flips it (CTFFLAG_YES) before the soft mask; the Cartesian path masks the unshifted, unflipped particle and applies the full shift and the signed CTF to the model. The mask then cuts CTF-delocalized signal that the model still carries (at 300 kV and 1.5 um defocus the displacement lambda*df/d is 37 A at 8 A, 74 A at 4 A, 98 A at 3 A, against a 60 A mask radius in E25), and it sits off the particle centre by the stored shift. | Prepare the observation as prepimg4align does up to the mask (shift by minus the seed shift, flip for CTFFLAG_YES, soft mask at msk_crop), without the padding. The model uses abs(CTF) for CTFFLAG_YES and CTFFLAG_FLIP; the optimizer solves for the shift increment from the seed and commits seed plus increment, as assign_ori does. | Phase 3 | | O5 | Particle-side interpolation (section 5, "Particle preparation"). The polar path passes particle and reference through the same normalized KB stencil on a 2x padded grid, so both carry the same real-space taper; the Cartesian path gathers the reference that way but uses the particle on its native grid. Relative to the particle, the Cartesian reference is attenuated by the stencil's taper, per axis 0.91, 0.83 and 0.74 at 0.25, 0.35 and 0.45 box from the centre (the same within 1% off grid). It biases euclid amplitudes and makes the sigma2 of the two representations differ by the taper's noise-power factor. Options: (a) multiply the masked observation by the separable taper of the stencil before its transform, which reproduces the polar particle for on-grid samples; (b) keep the inverse-envelope reference constructor that Phase 4 deletes, which deapodizes the reference instead. | (a): it mirrors the polar branch and keeps one reference for the discrete and the Cartesian pass (C10, C22). | Phase 3; the deletion in Phase 4 | | O6 | Search bounds (section 5, "Search bounds"). The Cartesian bounds are hard-coded (5 native pixels total shift, 1 pixel per step, 15 degrees total rotation); the polar refine=neigh search is bounded by trs (shift around the stored shift) and athres (neighbourhood around the subspace peaks). | The total shift bound is trs and the total rotation bound is athres, both from parameters; C16 then covers damping, step sizes and iteration caps only. | Phase 3 |

| O7 | How refine3D_auto is switched to continuous-only refinement (C11). Today refine3D_auto hard-sets refine=prob_neigh and exposes no refine; no automated 3D workflow exposes refine. refine3D_states is the precedent: it exposes a workflow-level pose_policy, derives multivol_mode and prob_neigh_mode from it, and rejects those keys on its command line. Options: (a) expose refine=prob_neigh\|cont, as Phase 8 now says; (b) one workflow-level key for all continuous pose refinement, pose_cont=no\|yes\|only, where yes is the polish of C19 and only the continuation mode of C11. | (b). One key answers "how much continuous refinement", yes means the same in refine3D and refine3D_auto, refine stays internal, and only reads as what it is: no discrete search at all. refine3D_auto derives refine from pose_cont, rejects refine on its command line as refine3D_states rejects multivol_mode, and rejects pose_cont=only with ref_pose_init=cc or regpass=yes given explicitly. refine3D keeps refine=cont and pose_cont=yes\|no. The existing continue key (resume a previous run) is not reused. | Phase 8 | | O8 | Record layout for corr_cart and the improved flag (C15). The record is 52 reals today (slot 51 attempted, 52 improved); slot 42 is unused but holds old cc_nonpeak values in pre-2024 projects. | Keep the width at 52. Slot 51 becomes corr_cart (I_CORR_CART, flag corr_cart); slot 52 stays the improved flag with its meaning; slot 42 stays unused. No reader change is needed: 52-real projects read as they are and narrower records still read with both fields zero. The one artefact: a particle that ran the experimental pose_cont between 2026-09-21 and the cut-over shows corr_cart = 1 until its first Cartesian pass, which only a report could see, since reports read the particles the pass sampled. The alternatives each need a reader special case or reuse slot 42. | Phase 7 |

Delegation, 2026-09-30: the maintainer delegated the run and reviews the result at the end (section 14.1). The run adopts the recommendations of O4, O5 (option a), O6, O7 (option b) and O8, and the layout of section 6.6, and records each adoption in section 15 in the phase that implements it. Each remains open to reversal at the final review. O2 keeps its interim rule.

Ruling on O6, 2026-10-02 (maintainer): the total rotation bound is a parameter of its own, athres_cont, default 10 degrees, the halfwidth of the total rotation from the seed: wide enough to capture wrongly assigned orientations, and independent of athres (the polar neighbourhood radius) and prob_athres (the probabilistic threshold, which narrows to the mean angular motion). The shift bound stays trs. E25 and N20 set athres_cont 15, the Phase 0 bound.

Ruling on C16, 2026-10-02 (maintainer): production runs the joint LM stage alone (30-40 % faster on beta-gal at equal objective; refinement applies it in many rounds, so what one pass misses a later one finds). shift_then_joint stays: cartft_pose_opt%new(..., shift_first=.true.), reached from a pass through the internal parameter cont_route=joint|shift_then_joint (default joint, not in the UI). The single-pass capture gates measured on it keep it and their floors: E25 and N20 stages a-c.

O3 (ranking of stored scores of mixed origin) was withdrawn on 2026-09-30: the one ranking of stored ptcl3D scores is never read under the sampling defaults refine3D_states fixes, and C14 now keeps the Cartesian score out of corr altogether. The rescoring pass it recommended and its test (N24) are dropped.

5. Conventions to mirror from the polar branch

The reference for "mirror" is refine3D refine=neigh (strategy3D_greedy_sub), the mode refine3D_nano runs with objfun=cc for high-resolution nanoparticle refinement. Reviewed against its source on 2026-09-30. It scans a 500-direction subspace and athres neighbourhoods of its peaks on the discrete grid, searches the shift on the previous reference first (inpl_srch_first), refines shift and in-plane angle continuously on the winners, and with the default inpl_cont=yes polishes the committed assignment jointly (refine_selected_continuously). The Cartesian pass corresponds to those continuous stages, extended to the two out-of-plane angles. Verified to match, or to match once the target is implemented: the euclid measure, the cc weighting of the continuous stages, the reference and its gather, even/odd selection, the band limit, the sigma2 definition (mean squared residual over two per sample, per shell), and shift-first staging (the shift_then_joint route, which the capture experiment also found safe where rotation-first was not). Not matching: particle preparation (O4, O5), search bounds (O6) and shell membership.

Aspect Polar branch Cartesian today Target
Objective selection params%cc_objfun in gen_objfun_vals Fixed in pose_cont_config (always the whitened correlation), independent of objfun Dispatch on params%cc_objfun
objfun=cc Normalized correlation, no sigma2 weighting, in two weightings. The discrete scan (gen_corrs) sums rings unweighted; a ring has pftsz samples whatever its radius, so per Cartesian pixel that is a 1/k weight. The continuous stages that commit the pose and corr weight ring k by k (gen_corr_cc_for_rot_8 in the shift search, gen_normalized_corr_grad_at_angle in the inpl_cont polish), which per Cartesian pixel is uniform 1 - cc on sigma-whitened data (per-pixel weight 1/sigma2); needs sigma2, hence the forced cc_emit_sigma Uniform per pixel, no sigma2 read or required (C5): the weighting of the polar continuous stages
objfun=euclid L = sum_k (k/sigma2_k) sum_p abs(X - CTF R)^2 / wsqsum(X); score exp(-L) 0.5 sum abs(r)^2 / sigma2; not normalized; no score Same loss and score (C6)
Shell weight euclid: k/sigma2_k, polar Jacobian times inverse variance; cc: as above 1/sigma2 per Cartesian pixel for both euclid: 1/sigma2 per pixel, the same measure; cc: uniform. Pinned by N4, N6
Shell membership Rings at integer k, kfrom..kto Pixels with kfrom <= r <= kto, binned by nint(r): the two edge shells are half width Pixels with nint(r) in [kfrom, kto]
Stored score corr holds cc or exp(-L) Not written corr_cart, written by every Cartesian pass; corr is never written by one (C14)
sigma2 esig%calc_sigma2(pftc, ...) after assignment, under euclid; not produced under cc Own residual routine plus an outside setter; read and written under both objectives euclid only: the sigma owner, from the Cartesian calculator. A cc pass reads and writes none (C5)
Particle preparation prepimg4align: shift by minus the stored shift, flip (CTFFLAG_YES), soft mask at msk_crop, pad by 2; polar samples by the normalized KB stencil from the padded transform, times pf^2 Noise normalization, soft mask at msk_crop with no shift and no flip, no padding; samples on the native grid; the full shift is a phase on the model O4 and O5
CTF Particle phase-flipped before the mask for CTFFLAG_YES; reference times abs(CTF) Unflipped particle, signed CTF (abs for CTFFLAG_FLIP) Equivalent only without a mask; with the mask, O4
Search bounds Shift within trs of the stored shift; directions within athres of the subspace peaks and the previous direction 5 native pixels and 15 degrees from the seed, hard-coded O6
Reference Prepared volume, pad by 2, KB gather times pf^3, no inverse envelope at the gather The same Unchanged (C10); the particle side is O5
Band limit kfromto adopted from the reprojection-model header Standalone route skips the adoption Travels in the header of the prepared reference volumes (section 6.6)

As built in Phase 3, where the target column needed a decision:

  • Shell membership: a pixel belongs to shell nint(r) and is used when that shell lies in [kfrom, kto] and the pixel lies inside the Nyquist circle, r <= box/2. The outer half of shell box/2 is beyond the band of the padded reference transform (and beyond the gather's wrap table); the polar ring of radius box/2 does not sample it either. Below the Nyquist shell the membership is exactly nint(r).
  • euclid is L = sum |X - C M|^2/sigma2 / sum |X|^2/sigma2 over that membership, the per-pixel form of the polar k/sigma2_k ring weight (a ring of the polar grid has pftsz samples at radius k; per Cartesian pixel the Jacobian k cancels); both objectives are normalized by the particle's power, so an observation without power is an invalid preparation (a per-particle status), not an undefined objective.
  • O4 is prepimg4align's fused routines in its order (norm_noise_fft_clip_shift or _ctf_flip with the shift by minus the stored shift on the cropped grid and the CTF at smpd_crop, then ifft_mask_fft, the unpadded sibling of its ifft_mask_pad_fft). The fused flip reads the memoized Fourier maps of the cropped box, so a Cartesian pass memoizes them per batch as the polar batch preparation does; the observation stops when they are absent.
  • O5 (a) is the stencil's response at period OSMPL_PAD_FAC*box, cropped to the box and unit at the centre (kb_stencil_envelope_1d), applied as taper(i)*taper(j) to the masked image before its transform. It equals the polar particle's on-grid samples of a zero-padded masked image exactly (N28). prepimg4align pads with the post-mask edge mean instead of zero; that background adds edge_mean times the aliased taper to the polar samples, which the Cartesian observation does not carry. After noise normalization the edge mean is the mean of the noise outside the mask and close to zero; the difference is recorded, not modelled.

6. Target architecture

6.1 Dependency direction

refine3D / refine3D_auto commander
    -> refine3D iteration strategy (shared-memory or distributed)
        -> matcher
            -> strategy3D_cont                       (one particle)
                -> builder%cftc   : cartft_calc (references, particles, objective)
                -> cartft_pose_opt              (LM, bounds, accept or reject)
                    -> simple_kbinterpol, simple_cartesian_fourier

The calculator and optimizer import no commander, matcher, UI, project I/O or parallelization module.

6.2 Classes

src/main/cftc/simple_cartft_calc.f90, type cartft_calc, owned by builder as cftc (the role pftc has):

  • state-by-half Cartesian references and their read/write. A reference is the prepared volume, padded by 2 and Fourier transformed once when it is read. No section is stored: the objective, gradient and prediction gather each Fourier sample at the continuous rotation, so there is no projection grid. In memory a reference is the padded transform, (2 box_crop)^3 / 2 complex values (0.54 GB per state and half at box_crop 256), held for the whole matcher pass;
  • the prepared particles of the current batch and per-thread scratch;
  • objective and gradient for cc and euclid, dispatched on cc_objfun; the cc methods take no sigma2 argument, so none can enter (C5);
  • the residual used by the sigma owner.

Built from these routines of the refiner: load_pose_reference, prepare_pose_particle, sample_fourier_with_grad, predict_unweighted_pose, shift_normal_terms, pose_normal_terms, finalize_cc_normal_terms, pose_objective_gradient, prepared_pose_sigma_contribution, pose_cont_ctf_value; and from the adapter: pose_cont_reference_workspace, load_reference_slot, write_pose_cont_reference_artifact.

src/main/cftc/simple_cartft_pose_opt.f90, type cartft_pose_opt (the role pftc_shsrch_grad has):

  • the LM solve, damping, cumulative bounds, accept or reject;
  • takes and returns ori; rotation matrices, cropped-grid shifts, normal equations and stage records are private.

Built from refine_shift_lm, refine_pose_lm, refine_prepared_pose_lm, right_increment_rotation, build_pose_lm_system, solve_pose_cholesky, increase_lm_damping, rejection_terminal_status, apply_pose_parameter_mask; and from the adapter: run_pose_cont_transaction with its helpers, the pose, config, limits and result records, and the ori conversions.

simple_cartesian_fourier stays in src/main/interp. Sources under src/main are globbed recursively, so the new folder needs only cftc.inf.

Ownership, lifetime and thread-safety:

Object Owner Lifetime Written when Read when
Calculator references (state by half) builder%cftc One matcher pass read, before the particle loop, serial Particle loop, concurrently
Calculator prepared particles builder%cftc One batch prepare_batch, in its own parallel loop, one particle per iteration Particle loop, concurrently
Calculator work images and residual buffers builder%cftc, indexed by thread One matcher pass By the thread that owns the index By that thread only
Optimizer A component of strategy3D_cont One particle: built in new, released in kill By the one thread running that particle's srch By that thread only
  • The objective, gradient and prediction methods take the calculator as intent(in), so concurrent evaluation on different particles cannot write shared state. The refiner's evaluation routines already have this form.
  • The residual method writes only the thread-indexed buffers. Today the sigma routine allocates four per-shell arrays on every call; those become the thread-indexed buffers.
  • The optimizer holds fixed-size state only (the 5x5 system, bounds, status); it allocates nothing during a solve and nothing is shared between optimizers. This mirrors strategy3D_srch owning its pftc_shsrch_grad objects.

As built in Phase 2 (review checkpoint 1; interfaces in section 15, "Phase 2 interfaces"). Calculator: new(nstates, box, nptcls), kill, set_ref(state, iseven, volume) from a prepared volume in memory (the file read/write of 6.6 call it in Phase 4), set_ptcl(iptcl, ...) per batch slot (prepare_batch fills the slots in Phase 6), and the evaluation methods predict, objective_gradient, shift_normal_terms, pose_normal_terms and sigma_contribution, all on (state, iseven, iptcl) with the calculator intent(in). The objective is an argument of the evaluation methods, OBJFUN_CC or OBJFUN_EUCLID, which in Phase 2 select the two existing objectives unchanged (the whitened NCC and the whitened half squared residual); Phase 3 gives them the definitions of section 5 and decides whether the objective becomes a property set in new. The particle record of the refiner (cartesian_pose_data) is a private type of the calculator. Optimizer: new(box, box_crop, objfun, ...) with the current policy as defaults and optional overrides (both routes through shift_first; C16 reduces them in Phase 8), refine(calc, iptcl, o) on an ori, and refine_pose on a rotation matrix and a cropped shift, which the forwarders and the 1JYX fixture need to stay bit-identical (an ori stores single precision Euler angles); the stage solvers refine_shift and refine_joint are public because E12 tests them alone; get_status, get_objectives, get_motion, get_stage read the last solve; right_increment_rotation is exported as the rotation convention the fixtures share. Phase 7 decides whether refine_pose and the stage solvers become private once the forwarders are gone. Per-particle failures are typed statuses (CARTFT_INVALID_PREPARATION, CARTFT_NO_RELIABLE_UPDATE, CARTFT_BOUND_REJECTED, CARTFT_INVALID_NUMERICS, ...); caller-contract violations are THROW_HARD; the gather is pure and returns an inside flag that its non-pure callers turn into a stop.

As built in Phase 3 (review checkpoint 2). The objective is a property of the particle slot, not of the calculator or of a call: set_ptcl is generic, set_ptcl(iptcl, observed, ctfparms, kfromto) prepares an OBJFUN_CC slot and takes no sigma2 (C5: none can enter), set_ptcl(iptcl, observed, ctfparms, sigma2, kfromto) an OBJFUN_EUCLID slot; get_ptcl_objfun reports it, and the evaluation methods lose their objective argument and dispatch on the slot. The pass chooses the preparation from params%cc_objfun, so the objective follows objfun where the particle is prepared (the batch preparation of Phase 6), and a slot cannot be evaluated under an objective it was not prepared for. The optimizer lost its objective argument with it. score(iptcl, objective) gives the stored score of the polar branch (cc, or exp(-L)), which Phase 7 writes to corr_cart; get_ptcl_taper gives the particle-side taper of O5 (a). The optimizer's new(box, box_crop, trs, athres, ...) takes the total bounds of O6 in the units of parameters (native pixels, degrees; trs = 0 freezes the shifts), and refine on an ori solves for the shift increment of an observation centred on the stored shift and commits stored shift plus increment (O4); refine_pose keeps calculator coordinates, where the shift is the model shift relative to the slot's observation.

6.3 Strategy hierarchy

strategy3D                 abstract; spec and the four deferred methods only
  strategy3D_pftc          abstract; owns s (strategy3D_srch)
    greedy, greedy_inpl, greedy_smpl, greedy_sub, shc, shc_smpl,
    snhc_smpl, eval, prob              (nine files change their parent)
  strategy3D_cont          Cartesian transaction for one particle

The matcher dereferences ptr%s in exactly two places (lines 595 and 602). Both move: the shift increment is taken from the project orientation before and after srch (s%prev_shvec is that stored shift), and the cont_inpl_* fields are written by the search object that produced them.

strategy3D_cont exposes new(params, spec, build), srch(os, ithr), oris_assign() and kill() and nothing else.

As built in Phase 5. simple_strategy3D_pftc holds the abstract strategy3D_pftc, which extends strategy3D by the one component s; the nine polar strategies extend it, strategy3D keeps spec and the four deferred methods. The matcher takes the shift increment for the sigma2 update as the stored shift after srch minus the stored shift before it: s%prev_shvec was that stored shift (prep4srch and prep4prob set it from the project record, and every polar strategy calls one of them for a particle of positive state). For a rejected particle the old increment was the shift itself and the new one is zero; its only reader, calc_sigma2, skips state-zero particles. strategy3D_srch writes cont_inpl_attempted and cont_inpl_improved at the end of its two continuous routes (refine_selected_continuously, refine_assignment_continuously) under inpl_cont=yes, where the matcher clears both fields for every particle before the loop, so a particle whose search runs no route keeps zeros as before.

As built in Phase 7. simple_strategy3D_cont holds strategy3D_cont, which extends strategy3D directly and has the four methods only; the module also exports the pure cont_seed_is_valid (positive state, eo 0 or 1, a projection direction, finite Euler angles and shift; the identity is valid), which srch turns into a stop. new validates the policy (oritype=ptcl3D, objfun euclid or cc, inpl_cont=no, projrec not yes) and builds one cartft_pose_opt from box, box_crop, trs, athres and pose_cont_route. srch rejects a state-zero particle, finds the particle's slot in build%cftc by particle index (get_ptcl_slot; the matcher calls set_ptcl_inds after each batch build, the polar calculator's pinds), runs one refine transaction, takes corr_cart as the calculator's score of the final objective (the seed objective after a rejection), records the residual at the committed pose through the sigma owner under euclid, and calls oris_assign. oris_assign commits the pose only on acceptance, always writes corr_cart and the improved flag, and writes dist, dist_inpl, shincarg, mi_proj, mi_state (1) and frac (100) from the seed-to-result motion; it never writes corr.

6.4 Shared owners

Concern Owner after the refactor
Reference handoff materialize_reprojection_model_from_volumes, read_reprojection_model, remove_ref_section_files produce, read and remove the prepared Cartesian reference volumes beside the polar reprojection model; the file contract is section 6.6
Particle preparation A Cartesian sibling of prepimg4align in simple_matcher_2Dprep; build_batch_particles3D fills the active calculator from the single read
Per-thread storage prep_strategy3D / clean_strategy3D
sigma2 euclid_sigma2 gains a Cartesian calc_sigma2 variant taking cartft_calc, called under euclid only; set_particle_contribution is removed
Representation switch One derived logical in parameters (l_cart_refine), set once from refine; no string comparisons downstream
Reporting Per-particle fields read by simple_convergence; no stats module, no stats files, no timers in the particle loop

As built in Phase 6. One read prepares a batch for the representation(s) of the pass: build_batch_particles3D(params, build, n, pinds, imgs, imgs_pad) fills the Cartesian slots of build%cftc (a Cartesian pass, or the in-matcher polish until Phase 9) and the polar particles unless l_cart_refine; the Cartesian slots come first, from thread copies, because the polar preparation normalizes the images in place. The Cartesian sibling of prepimg4align is prepimg4align_cart in simple_matcher_2Dprep (the image steps, explicit inputs); the parallel loop, one slot per iteration, is prep_cart_batch in simple_matcher_ptcl_batch, low level (calculator and arrays, so N11, N12 test it without a project), fed by the project's shifts, CTF parameters, noise mask and, under euclid only, sigma2. The calculator cannot run it itself: it would import the matcher layer. build%cftc holds the slots of one batch (new_ptcls). The raw-particle workspace, the _cartesian batch builder and the optional pad-image arguments are gone. euclid_sigma2 has one generic new (the polar constructor shares the table with pftc, a Cartesian pass builds it alone) and one generic calc_sigma2 (polar orientation, or a Cartesian slot at the committed pose); the setter is removed and prep_sigmas_objfun takes no flag; a Cartesian cc pass builds no sigma2 state (C5, N13). prep_strategy3D allocates nothing and the strategy3D toolbox no in-plane table under l_cart_refine. The in-matcher polish evaluates the slot prepared with the batch, centred on the shift stored before the discrete search, as prepimg4align centres the polar particle; its seed is the winner's shift relative to that centring. Before Phase 6 it prepared a second observation centred on the winner's shift, so the polish's mask and taper sit at the pre-search position now (a sub-pixel difference; the scheduled polish of Phase 9 prepares at the winner).

6.5 User-facing surface

  • refine=cont in refine3D (replaces refine=pose_cont); in refine3D_auto the switch O7 settles (recommended: pose_cont=only).
  • pose_cont=yes|no schedules a Cartesian pass after every discrete iteration (C19).
  • Removed: pose_cont_mode, pose_cont_route, the program refine3D_pose_cont, the forced cc_emit_sigma=yes.

As built in Phase 8 (O7 (b) adopted). refine3D offers refine=cont (and refine3D_nano, whose refine list is its own) and pose_cont=yes|no; refine3D_auto offers pose_cont=no|yes|only and no refine. parameters holds pose_cont as no|yes|only, only accepted on refine3D_auto alone; l_cart_refine is refine=cont. Validation under refine=cont (validate_parameter_consistency): oritype=ptcl3D on refine3D itself (its children, assembly and postprocessing on other segments, inherit refine with the command line, and the strategy's new checks the segment of the pass), objfun_den=yes rejected (C21), pose_cont=yes rejected (the polish schedules a refine=cont pass; cont is that pass), and inpl_cont overridden to no: the polar in-plane polish is part of the five-parameter solve, and rejecting the default yes would make every refine=cont command line name inpl_cont=no. Initialized poses are a project property, not a parameter: check_cont_seeds (simple_strategy3D_cont) runs at the entry of both refine3D strategies, before the random-orientation fallback for an unsearched field, and at the entry of refine3D_auto pose_cont=only. objfun=cc with refine=cont stays available through refine3D (C20); refine3D_auto sets objfun=euclid as before. Until Phase 9 pose_cont=yes stopped with a message in refine3D (reject_matcher_polish) and in refine3D_auto; from Phase 9 it schedules the polish (checkpoint 7).

6.6 Prepared reference volumes: the handoff file contract

The Cartesian path hands the matcher volumes, not projections. For each state and half the file holds the prepared real-space volume, the one the polar branch pads and reprojects over its grid. The calculator pads and transforms it once when it reads it and gathers each Fourier sample at the continuous rotation during the solve (section 6.2).

Why a file at all: the preparation (volume choice, masking, filtering, envelope, low-resolution even/odd blend, centering with its shift mapped into the project) and the band limit (set_bp_range3D, estimate_lp_from_refs) are decided once, by the iteration strategy, before any matcher runs (refine3D_policy.md, section 6). Every matcher of the iteration, shared-memory or distributed, then reads the same references and the same band. With pose_cont=yes the discrete and the Cartesian passes of one iteration see one preparation by construction.

Alternative not taken (C22): each matcher prepares its references from the state volumes. The preparation and the band-limit decision would then run once per partition; the band limit and the centering shift would need another channel to the workers (the project mutation of centering must stay on the master); and the polar and Cartesian references of one iteration would come from two preparations. It saves a file of nstates * box_crop^3 * 4 bytes per half, written once and read once per partition, far less than the particle images each partition reads.

The layout follows the polar reprojection model (reprojection_model_even.bin and _odd.bin: a four-integer header, then the payload, validated by reprojection_model_header_compatible). The handoff itself is settled (C22); the layout below is confirmed before Phase 4 starts (review checkpoint 3).

Item Contract
Files cart_refvols_even.bin, cart_refvols_odd.bin, named by refine3D_cart_refvols_fname(half) in simple_refine3D_fnames. They replace the per-state pose_cont_reference_stateNN_*.mrc files.
Layout Stream binary. Header: five default integers [format_version, box_crop, nstates, kfrom, kto] and one default real smpd_crop. Payload: nstates real-space volumes of box_crop^3 default reals, state 1 first, each the prepared reference that the polar branch pads and reprojects.
Version format_version = 1. A reader rejects any other value.
Compatibility on read box_crop and nstates equal the run's; smpd_crop equal within single-precision tolerance; 1 <= kfrom <= kto <= fdim(box_crop) - 1; the even and odd headers are identical. The checks are a logical function, cart_refvols_header_compatible, which the reader calls; on a mismatch the reader stops the run and names the file and the field.
Band limit The reader sets params%kfromto and params%lp from the header, as adopt_reprojection_model_range does for the polar model. No other source of kfromto exists in a Cartesian pass.
Producer materialize_reprojection_model_from_volumes, through cartft_calc%write, from the volumes it has just prepared in memory. It writes after preparation has succeeded, replacing the previous files, as it does for the polar model. With pose_cont=yes the same call writes the polar reprojection model and these volumes from one preparation.
Reader read_reprojection_model, through cartft_calc%read, in the matcher. Shared-memory and distributed runs read the same files.
Removal remove_ref_section_files. Nothing else deletes them.
Size On disk nstates * box_crop^3 * 4 bytes per half (67 MB per state at box_crop 256). In the matcher each volume becomes its padded transform, about eight times that (section 6.2).

The alternative layout keeps one MRC volume per state and half, which can be opened in a viewer, with a small header file beside them for the band limit. It needs a completeness check across several files where the single file needs none.

As built in Phase 4 (the layout above, as written; review checkpoint 3 in section 15). The calculator owns the format: set_refvol(state, iseven, volume) stages a prepared volume without a transform (the materializer needs no padded reference), write(fname_even, fname_odd, kfromto, smpd) writes both files and refuses a header the reader would reject, read(fname_even, fname_odd, nstates, box, nptcls, smpd, kfromto) builds the calculator, checks both headers with cart_refvols_header_compatible (type-bound, against the calculator's box and state count; it names the first failing field, which the reader prints with both file names before it stops) and returns the header's band. The file names come from the caller (refine3D_cart_refvols_fname), so the calculator knows no workflow naming. builder%cftc holds the calculator. In simple_matcher_refvol_utils, read_mask_filter_reproject_refvols stages the volumes of every state in build%cftc when a Cartesian pass reads them (l_cart_refine, or the in-matcher polish pose_cont=yes until Phase 7) and skips the polar model under l_cart_refine (its cartesian_only argument is gone); materialize_reprojection_model_from_volumes removes the previous files after the preparation has succeeded and writes the polar model unless l_cart_refine and the reference volumes when they are read; read_reprojection_model dispatches to read_cart_refvols under l_cart_refine, which reads build%cftc with one particle slot per thread (the forwarders' slots until Phase 6) and adopts kfromto and lp as adopt_reprojection_model_range does. The matcher of a Cartesian pass reads at entry, where the polar pass adopts its band, because an empty partition's sigma2 output needs the band before any reference is used; the polish reads the volumes after the polar model. l_cart_refine is derived once in parameters (refine=pose_cont until Phase 8 renames the value).

7. refine3D_auto with refine=cont

7.1 Stages

Stage of exec_refine3D_auto Today With refine=cont
Hard default refine=prob_neigh Always set Derived from the switch of O7: refine=cont (recommended: from pose_cont=only)
Sampling (nsample, update_frac, trail_rec) Set from the active particle count Unchanged (C12)
ref_pose_init=cc Optional polar CC pose initialization Bypassed; the combination is rejected
Sigma bootstrap (calc_pspec) and startup reconstruct3D Run Run; neither is polar
NU low-pass seeding Run Run
Registration pass (refine=greedy, polar) On by default (regpass) Bypassed
Main loop refine=prob_neigh, nspace, nspace_sub, prob_align, polar reprojection model refine=cont; no projection grid, no probability tables, no polar model
Final reconstruction (calc_final_rec) Run Run

This is a continuation mode (C11). It does not produce poses; it refines the ones a discrete workflow left in the project (abinitio3D, or a polar refine3D_auto or refine3D run). The commander checks this at entry, before the sigma bootstrap, with the existing seed check (positive state, half-set assignment, finite Euler angles and shifts for every active particle), and stops with a message that names the requirement. The UI text of the switch (O7) on refine3D_auto says the same.

set_refine3D_auto_sampling stays as it is. Because refine=cont is not a probabilistic mode, the matcher draws the sample itself through sample_ptcls4update3D (update-count sampling under balance=no).

As built in Phase 8. exec_refine3D_auto rejects refine on its command line, reads pose_cont (default no) and, for only, rejects an explicit ref_pose_init=cc or regpass=yes, sets regpass=no and refine=cont, runs check_cont_seeds on ptcl3D right after params%new (before the sampling, the startup volume and the sigma bootstrap), removes pose_cont from the command line its children receive, and runs the main loop with refine=cont and no nspace/nspace_sub. The iteration strategy needs no branch of its own: refine=cont is not a probabilistic mode, so no prob_align child runs, and materialize_reprojection_model_from_volumes writes only the Cartesian reference volumes under l_cart_refine (Phase 4). The final reconstruction (calc_final_rec) is unchanged as the table says: when it must rebuild sigma2 at native sampling (box changed, or no valid committed state), bootstrap_rec3D runs its residual pass with refine=sigma through the polar matcher. That is reconstruction-side sigma estimation after the refinement, not a search; the exit's "no polar model" is checked on the refinement iterations (N20 stage e).

7.2 Convergence (open, O2)

  • The single-state rule in check_conv3D is frac_srch%avg > 99 .and. mi_proj > overlap, gated by minits. refine3D_auto sets overlap=0.99.
  • Per particle, mi_proj is 1 when the symmetry-aware angular distance between the previous and the new orientation is at most angthres_mi_proj (default 2 degrees). It is not tied to the discrete grid.
  • A local optimizer reports frac=100, as deterministic neighbourhood refinement already does, so the frac gate is always met.
  • Under refine=cont the rule therefore reduces to "99% of the updated particles moved less than 2 degrees", which a pass that only removes grid error could meet at once, and it ignores shifts.
  • Precedent for a motion-based rule: 2D refine=inpl converges on dist_inpl%avg < 0.5.

Interim rule until O2 is decided: check_conv3D does not declare convergence under refine=cont. A run goes to maxits, which refine3D_auto derives from the target number of updates per particle. minits would only delay the faulty decision. With pose_cont=yes in a discrete mode the rule is unchanged, because the polish leaves the discrete search's convergence fields in place (Phase 9).

Candidates to evaluate on the logged statistics: an angular threshold derived from the current resolution and mask diameter (the registration pass already computes res / (mskdiam/2)); a rule on mean orientation and shift motion (dist, shincarg); the fraction of improved particles falling below a floor (an FSC plateau was listed here; ruling R5 removes the FSC from validation).

8. Code inventory

8.1 Continuous-pose code in simple_strategy3D_matcher.f90

Line numbers at 712b4d86.

Lines What Disposition
23-24, 31-38 Imports from strategy, stats and adapter modules Keep only strategy3D_cont
55-56, 713-714 do_pose_cont_polish, do_pose_cont_strategy Remove
83-88 Six declarations of adapter and stats types Remove
115-116, 389-412 Skip model adoption; seed validation Model read; strategy or parameters
136, 139-140 Empty-partition sigma and stats Generic sigma prep; stats removed
164, 170, 242 Skip memoize_refs, prep_strategy3D, clean_strategy3D Behind prep_strategy3D and builder
182-183, 226-231, 240 Per-thread stats allocate, merge, report Remove
188-191 Clear pose_cont_* fields on every run Remove; the strategy writes corr_cart and the improved flag of the particles it processes (C15, O8)
211 Skip PFTC calc_sigma2 Sigma owner
221 frac_greedy guard Strategy-neutral counting
246-251, 270 Teardown variants Generic teardown
345-371 Mode validation in init_ctrl parameters validation
447-468 Reference and image allocation branch read_reprojection_model, alloc_ptcl_imgs
477-486 Batch-build branch build_batch_particles3D
494-501, 555-593 Downcasts, bind_context, get_result, timers, field writes Remove; the strategy writes its own fields
595, 602 ptr%s dereferences Section 6.3
610-669 run_pose_cont_after_pftc Remove; the polish is a scheduled pass (C8)
671-678 wall_time_seconds Remove

8.2 Exports of simple_pose_cont_refine3D_adapter.f90

"Users" are production modules outside the adapter.

Export What it is Users New owner
pose_cont_reference_workspace State-by-half array of refiners; methods choose even or odd and forward matcher, strategy cartft_calc
cartesian_pose_data Re-export of the refiner's prepared-particle type matcher, strategy cartft_calc, private
pose_cont_particle_workspace Raw-particle copies kept across PFTC preparation matcher, ptcl_batch Removed; a pass has one representation
prepare_pose_cont_observation Noise-normalise, clip, mask, expand strategy simple_matcher_2Dprep
pose_cont_observation_spec, pose_cont_observation, pose_cont_particle_spec Argument bundles matcher, strategy Removed with the wrappers
pose_cont_pose Rotation matrix and shift matcher, strategy cartft_pose_opt, private
pose_cont_seed_from_orientation, pose_cont_pose_to_orientation ori to matrix and crop-scaled shift, and back matcher, strategy cartft_pose_opt, private
shift_native_to_crop, shift_crop_to_native Multiply by the crop factor none Folded into the conversion
pose_cont_config, pose_cont_limits, their constructors, POSE_CONT_ROUTE_* LM policy matcher, strategy, stats, refine3D_strategy Private constants of the optimizer (C16)
POSE_CONT_OBJECTIVE_* Objective selector independent of objfun stats Removed (C4)
pose_cont_transaction_result, pose_cont_stage_result, status codes Result and accounting of one solve matcher, strategy, stats cartft_pose_opt, private
run_pose_cont_transaction (private) Staged route, cumulative bounds, accept or reject through the workspace cartft_pose_opt
write_pose_cont_reference_artifact Validated image%write refvol_utils cartft_calc%write, called by the reference materializer
remove_pose_cont_reference_artifacts Delete the files none remove_ref_section_files
load_reference_slot (private) Read, check dimensions and sampling, build refiner through the workspace cartft_calc%read

8.3 File disposition

Paths are under src/main/ unless they start with src/ or doc/.

File Disposition Phase
commanders/simple/simple_commander_refine3D_pose_cont.f90 Delete 1
strategies/parallelization/simple_refine3D_pose_cont_workflow.f90 and tester Delete 1
ui/simple/simple_ui_refine3D_pose_cont.f90 Delete 1
doc/policies/3D/refine3D_pose_cont_policy.md Delete 1
doc/policies/3D/refine3D_auto_policy.md Drop the paragraph and link that point to the deleted policy (lines 16-18) (1); continuous-pose section (10) 1, 10
ui/simple_ui_visibility_tester.f90 Retire E26 (1); add N21 (8) 1, 8
commanders/simple/simple_commanders_refine3D.f90 Remove the four hooks (1); the continuous-only switch of O7 in exec_refine3D_auto (8); pose_cont=yes to the main loop of refine3D_auto (9, added in Phase 9) 1, 8, 9
volume/simple_cartesian_pose_refiner.f90 and tester Split into the two cftc classes, kept as forwarders (2); old copies of the rewritten tests follow the new definitions (3); inverse-envelope constructor (4); delete after parity (7) 2, 3, 4, 7
new cftc/simple_cartft_calc.f90, cftc/simple_cartft_pose_opt.f90, testers, cftc.inf Create (2); objectives, preparation and bounds (3); reference read and write (4); batch preparation and residual (6); strategy use (7); the kept LM route becomes private and E16 is reduced to it (C16; 8, added in Phase 8) 2, 3, 4, 6, 7, 8
simple_builder.f90 Add cftc (4); the toolbox allocates only what the active representation needs (6) 4, 6
strategies/search/simple_matcher_refvol_utils.f90 Write, read and remove the prepared Cartesian reference volumes beside the polar model; drop adapter import and cartesian_only 4
src/defs/simple_refine3D_fnames.f90 refine3D_cart_refvols_fname(half) replaces refine3D_pose_cont_ref_fname (section 6.6) 4
strategies/search/simple_strategy3D.f90 Representation-neutral 5
new strategies/search/simple_strategy3D_pftc.f90 Owns s 5
the nine polar strategy files: strategies/search/simple_strategy3D_greedy.f90, strategies/search/simple_strategy3D_greedy_inpl.f90, strategies/search/simple_strategy3D_greedy_smpl.f90, strategies/search/simple_strategy3D_greedy_sub.f90, strategies/search/simple_strategy3D_shc.f90, strategies/search/simple_strategy3D_shc_smpl.f90, strategies/search/simple_strategy3D_snhc_smpl.f90, strategies/search/simple_strategy3D_eval.f90, strategies/search/probabilistic/simple_strategy3D_prob.f90 extends(strategy3D_pftc) 5
strategies/search/simple_strategy3D_srch.f90 Writes the cont_inpl_* fields it produces 5
strategies/search/simple_matcher_ptcl_batch.f90, simple_matcher_2Dprep.f90 Cartesian preparation sibling; drop adapter import and optional flags 6
sigma2/simple_euclid_sigma2.f90 Cartesian calc_sigma2; remove the setter 6
strategies/search/simple_strategy3D_alloc.f90 Skip PFTC allocations when l_cart_refine 6
strategies/search/simple_strategy3D_pose_cont.f90 and tester Calls into the forwarders (2); the sigma predicate and E20 go with the objective change (3); evaluates the particle slot the batch preparation filled and writes sigma2 through the sigma owner (6; added in Phase 6: it prepared its own observation and wrote sigma2 through the removed setter); replace with simple_strategy3D_cont.f90 and tester (7); the route argument goes with pose_cont_route (8, added in Phase 8: strategy3D_cont and its tester read the removed key); the polish pass keeps the discrete search's convergence fields, N22 and N23 (9, added in Phase 9) 2, 3, 6, 7, 8, 9
strategies/search/simple_strategy3D_matcher.f90 Objective, bounds and observation of the in-matcher polish follow Phase 3 (objfun, O4-O6), the forced sigma predicate replaced by the generic rule (3; added in Phase 3, the polish path must follow the new definitions); reference read through the calculator (4); ptr%s dereferences (5); batch preparation and sigma calls (6); remove every entry of section 8.1 (7); a polish pass reproduces the discrete pass's sample (9, added in Phase 9) 3, 4, 5, 6, 7, 9
strategies/search/simple_pose_cont_refine3D_adapter.f90 and tester Forwarders (2); observation preparation under O4 and O5 until it moves (3); the reference workspace wraps builder%cftc and the per-state MRC artifacts with their I/O go (4; added in Phase 4: the adapter names the file the phase replaces); observation part moves out (6); delete (7) 2, 3, 4, 6, 7
strategies/search/simple_pose_cont_run_stats.f90 and tester Objective label from objfun once POSE_CONT_OBJECTIVE_* is removed (3; added in Phase 3); delete (7) 3, 7
strategies/parallelization/simple_refine3D_strategy.f90 The stats aggregation builds its policy record from parameters, as the workers do (3; added in Phase 3); remove stats aggregation (7); bypass prob_align and the polar model for refine=cont (8); schedule the polish (9) 3, 7, 8, 9
src/defs/simple_defs_ori.f90, src/fileio/simple_binoris.f90 Record layout of O8 (recommended: width 52, slot 51 corr_cart, slot 52 the improved flag; no reader change) 7
simple_convergence.f90 Attempted from sampled, improved flag and corr_cart per O8 (7); no early stop under refine=cont, motion statistics logged (8); the polish's improved fraction reported in a discrete pass with pose_cont=yes (9, added in Phase 9) 7, 8, 9
new simple_convergence_tester.f90 pose statistics sub-suite: N19 (7), N25 (8); the polish statistics (9, added in Phase 9) 7, 8, 9
strategies/search/simple_strategy3D_inplane_tester.f90, project/simple_binoris_tester.f90, ori/simple_ori_tester.f90 N10 (5); N17 (7); N18 (7) 5, 7
params/simple_parameters*.f90 pose_cont_mode and the program-name checks removed (1; the row lacked the phase that section 9 assigns, added in Phase 1); objective override removed (3); derived flag (4); surface (8); the derived flag of the polish pass (9, added in Phase 9) 1, 3, 4, 8, 9
ui/simple/simple_ui_refine3D.f90, exec/simple_exec_refine3D.f90 Remove the program (1); refine=cont and pose_cont on refine3D, the switch of O7 on refine3D_auto (8) 1, 8
commanders/test/simple_commanders_test_class.f90, ui/simple_test/simple_test_ui_class.f90 Suite table and suite= list follow every tester move each
strategies/search/simple_pose_cont_1jyx_tester.f90 Print the E25 metrics it computes without printing (0); port to the new classes (2); high-resolution case (3); port to strategy3D_cont (7) 0, 2, 3, 7
new strategies/search/simple_strategy3D_cont_1jyx_tester.f90 The E25 tester under the name of 10.4, moved from simple_pose_cont_1jyx_tester.f90 when it is ported to strategy3D_cont (7; added in Phase 7); its fixture stops setting the removed pose_cont_route (8, added in Phase 8) 7, 8
commanders/test/simple_commanders_test_single.f90 N29 stages in single_workflow 8, 9
ui/single/single_ui_nano3D.f90 refine3D_nano offers refine=cont (8; added in Phase 8: N29 runs refine3D_nano refine=cont, and the program lists its own refine values) 8
commanders/test/simple_commanders_test_highlevel.f90 Commander of the N20 gate: stages a-e and h (8), f and g (9) 8, 9
production/CMakeLists.txt The cont_refine3D_1jxy entry; SIMPLE_CTEST_BUDGET 29 -> 30 (C18). No other change 8
ui/simple_test/simple_test_ui_highlevel.f90, exec/simple_test_exec_highlevel.f90 Register the cont_refine3D_1jxy test program and route it to its commander (8; added in Phase 8: check_test_registry requires every CTest test= to be a test UI program with one router case) 8
doc/policies/3D/refine3D_policy.md, doc/policies/test_environment_policy.md, doc/code_overview/fortran-indexes/ Phase 10 10
doc/implementation_notes/rejected/continuous_3D_pose_cont_refine3D.md, doc/implementation_notes/rejected/continuous_3D_pose_end_polishing.md, doc/implementation_notes/completed/continuous_3D_refinement_on_pcg_operator.md A superseded-by note at the top of the two that describe the replaced implementation; the third is the completed design record for the landed continuous-refinement outcome (10; added in Phase 10) 10

Besides this document, the table is the complete list of files the refactoring edits. A phase edits only the files whose row names that phase; a file missing from the table is added here, with its phase, before it is edited.

9. Phases

Each phase is one reviewable change that compiles and passes the fast gate. Stop for maintainer review at every phase boundary. The tests named in each phase are defined in section 10.

Phase 0. Baseline

  • Everything is recorded at the branch point, the commit the refactoring branches from, not at 712b4d86. 30d23bc62 changed padding handling in read, the backward transform and the normalizations, all on the particle and reference preparation path; whether the Cartesian numbers moved is not known, and a baseline at the branch point makes the question moot.
  • Recorded from the test entries (needs no user data): results and per-sub-suite times of unit_cart_align3D and lib_cart_align3D; the fast-gate timing table (ctest_fast.log.timing.txt); the truth metrics of simulated_workflow_1jxy, simulated_workflow_6vxx and abinitio3D_addon, which section 10.5 compares against (metrics.tsv where the entry writes one, today abinitio3D_addon; otherwise the volume-correlation and FSC lines of its log).
  • Recorded by the maintainer on the beta-gal set: one refine3D refine=pose_cont iteration and one pose_cont=yes iteration (FSC, mean motion, accept fraction, peak RSS, wall time) for both LM routes; one ordinary refine3D_auto run with continuous refinement off.
  • From the lib_cart_align3D run (E25), record the metrics that later serve as pre-refactor floors: rotation and shift error before and after, accept fraction, mean objective before and after, and the truth-map correlation of the perturbed and refined reconstructions. Where the tester computes a metric without printing it, a print line is added; no assertion changes.
  • Record the files each run leaves in its directory.

Exit: numbers and file inventories pasted into section 15.

Phase 1. Remove the separate program (C13)

  • Delete the commander, the workflow module and its tester, the UI file, the exec case and the policy file; drop the paragraph of refine3D_auto_policy.md that links to that policy file.
  • Remove pose_cont_mode from parameters, the parser and validation, including the program-name checks in parameters_phases (lines 853-863) and the prg case at line 821.
  • Remove the four hooks from commander_refine3D_auto and restore the inline defaults, registration-pass setup and main-stage call.
  • Tests: retire E22-E24 and E26 (section 10.2).

Exit: exec_refine3D_auto differs from e86286f2^ only by unrelated later commits; the ordinary refine3D_auto baseline reproduces; registry check clean.

Phase 2. Numerical owners (C3, C17)

  • The first commit is the two public interfaces: type definitions, public procedure signatures and their doc comments, no bodies. Review checkpoint 1 is held on that commit, before code moves behind it.
  • Create cartft_calc and cartft_pose_opt by moving code without changing formulas, defaults or the current objective. Both LM routes stay.
  • Private components, new/kill, type-bound methods. Replace error stop with THROW_HARD for caller-contract violations and typed statuses for per-particle failures. THROW_HARD is not callable from a pure procedure: the checks in sample_fourier_with_grad and the two shift conversions become a status returned to the non-pure caller, or move to that caller.
  • Keep simple_cartesian_pose_refiner and the adapter compiling as thin forwarders so production is untouched; they gain no behavior.
  • Tests: the refiner and adapter testers keep running unchanged against the forwarders, which is the parity proof. Their checks (E4-E19) are copied to the calculator and optimizer testers and run against the new interfaces; port E25; add N1 and N2.

Exit: every Phase 0 numerical result reproduces within the existing tolerances through both the old and the new testers; neither class imports matcher, commander, UI or project modules.

Phase 3. Objectives follow objfun (C4, C5, C6)

The scientific change, reviewed on its own.

  • Dispatch on params%cc_objfun; implement the cc and euclid definitions of section 5; remove POSE_CONT_OBJECTIVE_* and the cc_emit_sigma override in parameters_phases. Particle preparation under cc no longer requires valid sigma2 shells: sigma2 enters the euclid path only (C5).
  • Shell membership by nint(r) (section 5).
  • Apply the rulings on O4 (particle preparation), O5 (particle-side interpolation) and O6 (search bounds). Under the recommendations the observation is centred, flipped and masked as prepimg4align prepares it, carries the stencil's taper, and is solved for a shift increment within trs and a rotation within athres.
  • Tests: rewrite E8 and E15 for the new definitions; retire E20; add N3-N7 and N28; run E25 under each objective, with floors from the injected error and the Phase 0 values (section 10.1), not from its own first run, and add its high-resolution case (section 10.3).

Exit: both objectives pass formula, gradient and recovery tests; N6 shows the Cartesian and polar objectives select the same grid pose; the high-resolution E25 case meets its floors.

Phase 4. Builder and reference handoff (C10, C22)

  • Add builder%cftc; derive l_cart_refine once in parameters.
  • Implement the file contract of section 6.6: write/read on the calculator, a logical header-compatibility function, the calls from the reference materializer and reader, the filename function, and removal in remove_ref_section_files.
  • Delete new_inverse_envelope_reference (kept instead if O5 is ruled (b)).
  • Tests: retire E6; keep E10 as the guard on the gather; add N8 and N9.

Exit: one owner produces, validates, reads and removes the references; a distributed worker builds the calculator from declared files only; no file I/O in the optimizer.

Phase 5. Representation-neutral strategy base (C17)

  • Move s from strategy3D to a new abstract strategy3D_pftc; change the parent of the nine polar strategies.
  • Matcher: shift increment from the project orientation before and after srch; cont_inpl_* written by strategy3D_srch.
  • Tests: unit_pftc_align2D3D unchanged; add N10; rerun the Phase 0 polar guards (section 10.5).

Exit: ordinary refine3D and refine3D_auto baselines reproduce; the matcher contains no ptr%s.

Phase 6. Shared helpers select the representation

  • build_batch_particles3D prepares the active calculator's particles from the single read; remove build_batch_particles3D_cartesian, the particle workspace argument and the optional pad-image arguments.
  • prep_sigmas_objfun and euclid_sigma2: Cartesian calc_sigma2, under euclid only; a cc pass allocates, reads and writes no sigma2 (C5); remove cartesian_only.
  • prep_strategy3D / clean_strategy3D and the builder toolbox allocate only what the active representation needs.
  • Tests: move E13 (observation part) and E18 to their new owners; add N11-N14 and N26.

Exit: no shared helper imports a continuous-pose module or takes a feature flag; one sigma path; N14 passes.

Phase 7. strategy3D_cont and matcher cut-over (C1, C2, C14, C15)

  • Implement strategy3D_cont on the Phase 2-6 objects: seed from the project field, one solve against the particle's state and half reference, commit pose and corr_cart together, write corr_cart at the seed when the solve is rejected, leave corr untouched (C14), sigma through the sigma owner under euclid only (C5), convergence fields (dist, dist_inpl, shincarg, mi_proj, frac).
  • Matcher: the strategy case and nothing else; remove every entry of section 8.1. The in-matcher polish is unavailable from here until Phase 9.
  • Delete the adapter, the old strategy, the stats module, the forwarders of Phase 2, the master-side stats aggregation, and their testers.
  • Record layout of O8: under the recommendation the width stays 52, slot 51 becomes corr_cart and slot 52 stays the improved flag; simple_convergence derives attempted from sampled and reports the score of a Cartesian pass from corr_cart, of a polar pass from corr.
  • Tests: delete the old refiner and adapter testers with the forwarders (their checks already run in the calculator and optimizer testers); retire E21; move the seed-validity check of E19 to the strategy3D_cont tester; port E25 to strategy3D_cont; add N15-N19 and N27.

Exit: the matcher's only continuous-pose symbol is strategy3D_cont; no select type; ordinary refinement baselines reproduce.

Phase 8. refine=cont surface and refine3D_auto (C7, C11, C12, C16, C18, C20, C21)

  • UI and parameters: the refine value becomes cont; refine3D_auto gets the switch O7 settles (recommended: pose_cont=no|yes|only, refine derived and rejected on its command line); pose_cont_route is removed and the kept LM route becomes private; validation in validate_parameter_consistency (oritype=ptcl3D, initialized poses, inpl_cont interaction, C20, C21).
  • simple_refine3D_strategy: for refine=cont, no prob_align child and no polar model.
  • exec_refine3D_auto: section 7.1, including the entry check that makes it a continuation mode.
  • Convergence: no early stop under refine=cont (section 7.2); mean orientation motion, mean shift motion, improved fraction and resolution are logged every iteration.
  • Tests: reduce the route tests E16 and E17 to the kept route; add N20 (stages a-e and h), N21, N25 and the refine=cont stage of N29.

Exit: refine3D_auto in continuous-only mode (O7) completes from a project whose poses came from a polar run, runs to maxits, updates nsample particles per iteration, and creates no polar model, probability table or registration pass; shared-memory and distributed runs agree.

Phase 9. Polish as a scheduled pass (C8, C9, C19)

  • pose_cont=yes makes the iteration strategy follow every discrete pass with a refine=cont pass over the same particle sample (sample4update_reprod), in refine3D and in the main loop of refine3D_auto.
  • One reconstruction per iteration, from the polished poses: the discrete pass writes no partial reconstructions when a polish follows.
  • The polish pass writes pose, corr_cart, the improved flag and, under euclid, sigma; corr keeps the discrete pass's value. It leaves the convergence fields of the discrete search (dist, dist_inpl, mi_proj, frac) in place, so the main-loop convergence rule keeps measuring the discrete search and is not met trivially by the small polish motion.
  • Tests: add N22 and N23; extend N20 with stages f and g; add the pose_cont=yes stage of N29.

Exit: with pose_cont=no every baseline reproduces; with pose_cont=yes the pose error against the simulation truth is no worse than without it, and a discrete iteration that follows a polish runs unaffected.

Phase 10. Documentation and closing checks

  • Add the continuous-pose section to doc/policies/3D/refine3D_policy.md and refine3D_auto_policy.md.
  • Update doc/policies/test_environment_policy.md: the sub-suite table of section 1.1, the long-running table of 1.2, the process budget, and the "Where is my test now?" table.
  • Regenerate doc/code_overview/fortran-indexes once, here.
  • SIMPLE_UNIT_ORDER=reverse simple_test_exec test=unit_cart_align3D.

Exit: stale-symbol scan empty for pose_cont_refine3D_adapter, pose_cont_run_stats, strategy3D_pose_cont, cartesian_pose_refiner, pose_cont_mode, pose_cont_route, refine3D_pose_cont; this file moves to doc/refactoring_notes/completed/.

10. Test plan

10.1 Principles

From doc/policies/test_environment_policy.md:

  • A test asserts through simple_test_utils, derives its expected value independently of the code under test, names its tolerances, fixes its seeds, and pins sign, handedness and index conventions.
  • A unit test is a routine in simple_<thing>_tester.f90 beside the code it tests, exporting one run_all_<thing>_tests, registered as a sub-suite in simple_commanders_test_class.f90 and listed in the suite= help of simple_test_ui_class.f90.
  • Fast tier: hermetic, in-process, one thread, each sub-suite well under a second, whole gate under 30 s. Library tier: the same rules at realistic size. High-level tier: a pipeline on simulated data, gated against the simulation truth with declared floors and a metrics.tsv.
  • A new CTest entry is an owner decision; the one new entry of this plan is accepted (C18).

Specific to this refactoring:

  • An existing test is moved, not rewritten, when its guarantee still holds. It moves in the same commit as the code it tests.
  • While a forwarder exists (Phases 2-6), the old tester keeps running against it. That is the parity proof for the move.
  • A test is retired only when its subject is deleted or its guarantee is replaced by a decision in section 3. The commit names the reason and the replacing test.
  • A new behavior is not complete until its test is in the same phase. No phase exits on manual inspection alone.
  • Cross-representation tests compare optima and physical quantities, never raw objective values (C9).
  • A floor is never taken from the first run of the code being accepted. It comes from the simulation truth (the error must fall by a stated factor relative to the injected error), from an analytic bound (the rotation error must end below the basin width at the band limit, lp / (mskdiam/2) radians), or from the pre-refactor implementation measured at Phase 0 on the same fixture, with a stated margin.
  • Ruling R5 (2026-10-01, recorded in Phase 8; amended the same day, recorded in Phase 10): the FSC counts only at a scale where it means something. For small tests on noisy particles (2 000 particles or fewer, E25 at 1 000, the N20 gate, N29) the FSC is no criterion; correctness is verified against the ground-truth orientations (rotation and shift error, RMS and median, before and after; fraction within the basin width; accept fraction), and every FSC floor, FSC comparison with Phase 0 and FSC-triggered rerun is dropped for them, including the FSC entries of E25's floors and of any polar guard of 2 000 particles or fewer. At larger scale (more than 2 000 particles) the FSC may serve as a criterion where the plan uses one: to the truth on simulated data, the half-map FSC on the beta-gal set (5 513 particles). Existing CTest entries keep their own built-in checks. E25 keeps its map-correlation floors and its check that the FSC curves are finite; it has no FSC floor. Phases 8 and 9 applied the first wording, which drops the FSC everywhere; their beta-gal FSC values are in their logs and are compared with Phase 0 in the Phase 10 row.
  • A guarantee that ends in THROW_HARD cannot be asserted in-process. Such checks are written as logical functions that the caller turns into a stop, and the function is what the test asserts.
  • Fixtures stay at the sizes already in use (box 16 and 24 in the fast tier) and any file is named tmp_<tester>_* and removed, also on failure.

10.2 Existing tests and their disposition

Fast tier, unit_cart_align3D, unless noted.

Id Tester and routine Pins Disposition Phase
E1 cartesian_fourier: KB derivative (fast polynomial, normalized stencil, stencil switch) KB kernel and its derivative Keep in place -
E2 cartesian_fourier: packed gather derivative Gather gradient against finite differences Keep in place -
E3 cartesian_fourier: neutral extract (embed/crop, crop envelope, packed gathers, plane extraction) Parity with the pre-extraction operations Keep in place -
E4 pose_refiner: test_particle_preparation_contract Prepared-particle validity, shell capping Move to the calculator tester 2
E5 pose_refiner: test_sigma_shell_contract Shell whitening inputs Move to the calculator tester 2
E6 pose_refiner: test_reference_envelope_contract Inverse-envelope constructor Retire with the constructor; E10 guards the gather. Kept and moved to the calculator tester if O5 is ruled (b) 4
E7 pose_refiner: test_shift_phase_sign Shift sign on the native pixel scale Move to the calculator tester 2
E8 pose_refiner: test_ncc_objective_formula 1-NCC formula, gain invariance Move (2); rewrite for unweighted cc as N3 (3) 2, 3
E9 pose_refiner: test_five_parameter_gradient Gradients of both objectives Move (2); extend as N5 (3) 2, 3
E10 pose_refiner: test_matched_projector_boundary Gather equals interp_fcomp_oversamp Move to the calculator tester; permanent guard for C10 2
E11 pose_refiner: test_rotation_increment Right increment keeps orthogonality Move to the optimizer tester 2
E12 pose_refiner: test_shift_solver, test_joint_solver, test_tiny_accepted_reduction_stop Recovery, masks, guards, stopping Move to the optimizer tester 2
E13 pose_adapter: test_observation_and_coordinate_adapters Observation equals the established particle path; crop scaling Observation part to the calculator tester (6); scaling part to the optimizer tester (2) 2, 6
E14 pose_refiner: test_invalid_and_unobservable_inputs Invalid input leaves the pose untouched Move to the optimizer tester 2
E15 pose_refiner: test_ncc_solver NCC solve on a gain-scaled particle Move (2); rerun under the new cc (3) 2, 3
E16 pose_adapter: test_route_transaction_contracts Stage accounting of both routes Move to the optimizer tester (2); reduce to the kept route (8) 2, 8
E17 pose_adapter: test_rollback_transaction_contracts Bound rejection, no-improvement, invalid preparation preserve the pose Move to the optimizer tester 2
E18 pose_adapter: test_sigma_endpoint_contracts Sigma contribution on accept and rollback Calculator tester (2); sigma-owner test N13 (6); euclid only (C5) 2, 6
E19 pose_adapter: test_reference_workspace_lifecycle, test_inpl_pose_cont_handoff; pose_strategy: test_seed_contract Even/odd reference lifecycle; seed round trip with metadata intact; seed validity Lifecycle to the calculator tester (2); round trip to the optimizer tester (2); seed validity to the strategy3D_cont tester (7) 2, 7
E20 pose_strategy: test_outer_objective_sigma_policy The predicate behind the forced cc_emit_sigma Retire with the predicate; replaced by N3 and N13 3
E21 pose_statistics: test_partition_aggregation Stats-file aggregation Retire with the module; replaced by N19 7
E22-E24 pose_workflow: test_registration_stage_policy, test_post_matcher_stage_policy, test_standalone_final_stage_policy Child command lines of the removed program Retire with the module; replaced by N20 and N21 1
E25 lib_cart_align3D: pose_cont_1jyx (library tier) 1,000 simulated 1JYX particles (5,000 until ruling R2 of 2026-10-01) perturbed by 15 degrees and 2 pixels: objective, rotation error and shift error fall; refined map beats the perturbed one Keep; port to the new classes (2), both objectives with declared floors (3), through strategy3D_cont (7). At lp 8 A the CTF displacement (37 A) stays inside the 60 A mask, so the case cannot see O4: add a high-resolution case at lp 4 A on the same recipe, where it is 74 A, with floors from the injected error (3). Ruling R1 (2026-10-01): the 4 A case starts from the poses the same objective refined at 8 A (coarse to fine, as the workflows march frequency); its floors are the basin fraction (>= 0.90 within 3.82 deg), the map floor and 4 A finer than 8 A, and the injected-error floor stated against the 8 A start. R2: the Phase 0 floors of E25 are re-measured at 1,000 particles on the pre-refactor code (section 15, Phase 0 baseline) 2, 3, 7
E26 unit_ui, UI visibility: test_refine3D_pose_cont_policy Surface of the removed program Retire; replaced by N21 1
E27 unit_project, binoris: test_legacy_narrow_particle_records, test_particle_segment_roundtrip Narrow legacy records; record is N_PTCL_ORIPARAMS reals Keep; joined by N17 -
E28 unit_numerics, KB kernel: test_apod_mat_3d_fast_grad The stencil derivative Keep in place -

10.3 New tests

Each is implemented in the phase shown, in the tester named, with the expected value from the source named.

Id Phase Tier and tester Pins Expected value from
N1 2 fast, cartft_calc new/kill repeated; even and odd references built from different volumes give different predictions for the same pose The two volumes, gathered in the test
N2 2 fast, cartft_pose_opt ori in, ori out: state, half, proj and every non-pose field unchanged by a solve The input record
N3 3 fast, calculator cc formula with a uniform per-pixel weight; invariant to particle gain; prepared and evaluated with no sigma2 allocated, and the cc interface takes none (C5) Closed form over the test arrays
N4 3 fast, calculator euclid loss and exp(-L) score; invariant to a uniform scaling of sigma2; changes under a shell-dependent scaling Brute-force sum in the test
N5 3 fast, calculator Analytic gradients of both objectives, without CTF, with CTF and with phase flip Central differences
N6 3 fast, calculator with a small polarft_calc For a noise-free particle placed on a grid pose, the Cartesian objective evaluated over the grid poses peaks at the pose where the polar objective peaks, for both objectives (gen_objfun_vals; for cc also gen_corr_for_rot_8, the weighting of the continuous polar stages) The placed pose
N7 3 fast, optimizer Recovery of injected shift and rotation under each objective The injected pose
N8 4 fast, calculator Reference-volume file of section 6.6: write, read, identical prediction for every state and half; header carries version, box, state count, kfrom, kto and sampling; the reader adopts kfromto; the compatibility function is false for a wrong version, box, state count, sampling, an out-of-range band, and even and odd headers that differ The written arrays; hand-built headers
N9 4 fast, calculator remove_ref_section_files removes the Cartesian reference-volume files; no file survives the test Directory listing
N10 5 fast, unit_pftc_align2D3D, refine3D in-plane state The search object's previous shift equals the shift stored in the project before the search, so the matcher's increment from the project orientation is the one formerly read from s%prev_shvec The stored shift
N11 6 fast, calculator Batch preparation equals, particle by particle, the preparation O4 and O5 settle (under the recommendations: prepimg4align's shift, flip and mask without the padding, then the stencil's taper) That path, called in the test
N12 6 fast, calculator Threaded batch preparation (team of three) equals the serial result The serial result
N13 6 fast, calculator with euclid_sigma2 Under euclid, Cartesian calc_sigma2 at a committed pose equals the per-shell residual; an exact match gives zero. Under cc a pass leaves the sigma2 state untouched Brute-force per-shell sum; the state before the pass
N14 6 fast, calculator with a small polarft_calc Per-shell sigma2 from the Cartesian residual and from the polar residual agree for a noise-only particle at a grid pose Agreement within the standard error of a shell with the particle-side taper of O5 (a); without it, a ratio constant across shells equal to the taper's noise-power factor
N15 7 fast, strategy3D_cont Lifecycle through a class(strategy3D) pointer: new, srch, kill, repeated; identity seed accepted; state-zero particle rejected; runs with build%pftc never constructed Construction of the fixture
N16 7 fast, strategy3D_cont Accepted solve commits pose, corr_cart, dist, shincarg, mi_proj; rejected solve leaves the pose bit-identical and writes corr_cart at the seed; corr is unchanged in both Seed record; objective evaluated in the test
N17 7 fast, unit_project, binoris Under O8's recommendation: a 52-real record round-trips corr_cart in slot 51 and the improved flag in slot 52; a 50-real record reads with both zero Hand-written payload
N18 7 fast, unit_ori corr_cart and the improved flag: set, get, record round trip, flag names, in the slots O8 settles The values set
N19 7 fast, pose statistics sub-suite on simple_convergence Attempts equal the sampled count; improved percentage from the improved flag; the reported score of a Cartesian pass is the mean corr_cart of the sampled particles, of a polar pass the mean corr Hand count over a small oris
N20 8, 9 high-level, new entry cont_refine3D_1jxy (C18) Stages below Simulation truth
N21 8 fast, unit_ui, UI visibility refine3D offers refine=cont and pose_cont=yes\|no; refine3D_auto offers the switch of O7 (recommended: pose_cont with no, yes, only, and no refine); pose_cont_route, pose_cont_mode and the program refine3D_pose_cont are absent The contract of section 6.5
N22 9 fast, strategy3D_cont A particle not in the pass sample is untouched: pose, corr, corr_cart and flags unchanged The input record
N23 9 fast, strategy3D_cont In a polish pass the convergence fields written by the discrete search are unchanged; in a refine=cont pass they are written from the seed-to-result motion The input record; motion computed in the test
N24 - Withdrawn with O3 (section 4) - -
N25 8 fast, pose statistics sub-suite on simple_convergence Under refine=cont, convergence is not declared for any overlap and search fraction, and the motion statistics are still computed; in a discrete mode the rule is unchanged The rule of section 7.2
N26 6 fast, calculator Objective, gradient and residual evaluated concurrently on different particles by a team of three equal the serial results bit for bit The serial results
N27 7 fast, strategy3D_cont A batch run through srch by a team of three gives the same poses, scores and flags as the serial run The serial run
N28 3 fast, calculator One particle with a stored shift and CTFFLAG_YES: the prepared observation equals prepimg4align's image before its padding (O4); with O5 (a) it equals that image times the stencil's taper, and the taper equals the response of polarize_oversamp's stencil at an on-grid sample prepimg4align and the stencil, called in the test
N29 8, 9 high-level, single_workflow (existing entry; no budget change) The mode refine=neigh is known to work in: after autorefine3D_nano, refine3D_nano refine=cont continues from its project (8), and one refine3D_nano pose_cont=yes run is compared with pose_cont=no (9), objfun=cc, inpl_cont as Phase 8 validation settles Map against the simulated nanoparticle (volume correlation, FSC 0.143) no worse than the polar result within a declared margin. Under R5 (Phase 8): the poses against the trajectory truth (pair metric, 20 000 pairs) no worse than autorefine3D_nano's within 0.5 deg; the existing map check of the workflow stays as it is. Phase 9: refine3D_nano (two iterations from the autorefine3D_nano project) with pose_cont=yes no worse than with pose_cont=no within the same 0.5 deg
N30 review fast, calculator with euclid_sigma2 and the canonical state A polish pass (l_cont_polish) starts from the range the discrete pass wrote into the open sigma2 transaction, overlays the residual of a particle whose Cartesian slot is valid and keeps the discrete row of one whose slot is invalid The discrete range and the Cartesian residual, row by row; no committed row in the candidate
N31 review fast, calculator with polarft_calc Model amplitude and CTF handling, polar against Cartesian: one volume through both production reference projections, a noise-free particle with an astigmatic CTF (no zero in the band) through both production preparations, both evaluated at the same grid pose (true pose 1.4 polar grid steps in-plane and a fractional shift away) Per-shell power of the CTF-modulated model, ring at radius k against the pixels with nint(r) = k: pixel-count weighted band total within 5 %, every shell within [0.75, 1.3] (a model of the fixture over 300 random poses: band within 3.6 %, shells 0.80-1.25). The observation power and the residual are printed only: the residual of a noise-free particle is all structure, which the two samplings need not agree on, and the 14 px mask of this fixture cuts the particle. History: the first gate was on the residual (band 4 %, shells [0.6, 1.5]); the first run failed (band 0.72) because the phase flip moved background noise above the first CTF zero into the mask (defocus now 0.15/0.18 um); the second failed at k 3-4 on the structured residual of the cut particle, which led to N33
N32 review fast, calculator with euclid_sigma2 and the canonical state The canonical round trip of a generation a Cartesian pass writes (write, merge, reduce, commit) and a polar sigma owner reloads; a record with exactly zero shells stays in the particle rows, the reducer excludes it, and its particle reloads its half's positive group The written rows, the means of the valid records per half
N33 review fast, calculator with polarft_calc Group sigma2 under realistic conditions, the quantity mixed polar/Cartesian generations reduce: 16 particles at spread projection directions, in-plane angles 0.3-1.5 polar grid steps off the grid (true shift zero), astigmatic CTFs (0.15-0.30 um), unit white noise over the whole image at a per-pixel SNR of 0.1 over the box, an 18 px mask clear of the particle in a 48 px box; both production preparations, both evaluated at the nearest-below grid pose Per shell, d = (polar - Cartesian)/Cartesian of the group means, SE = sqrt(2/(n_s 16)); mean

Stages of the high-level gate N20. Fixture: the recipe of E25 (the embedded 1JYX model, the same box, sampling, CTF spread, noise level and seeds, and since ruling R2 its 1,000 particles), so that the Phase 0 numbers of the pre-refactor implementation apply to it; the project is seeded with the truth poses perturbed by the same known rotation and shift. Metrics go through test_gate to metrics.tsv. Floors follow section 10.1: reduction relative to the injected error, the analytic bound, and no worse than the Phase 0 value within a stated margin.

Stage Run Gate
a refine3D refine=cont objfun=euclid, shared-memory Pose error against the truth (pair_pose_error) below its floor and below the perturbed input; map against the truth (validate_reconstructed_volume)
b The same with objfun=cc The same
c Stage a with nparts=2 Poses and map agree with stage a within a declared tolerance
d All of a-c No polar reprojection model and no probability table in the run directory; only declared files remain
e refine3D_auto refine=cont from the perturbed project Runs to maxits; no pose-initialization or registration pass ran; nsample particles updated per iteration; pose error below its floor
f (Phase 9) refine3D discrete mode with pose_cont=yes and with pose_cont=no Pose error with the polish no worse than without; the discrete iteration after a polish runs and its scores are finite
g (Phase 9) refine3D_auto pose_cont=yes from the perturbed project Completes; a Cartesian pass follows every main-loop iteration over the same sample; one reconstruction per iteration; pose error no worse than stage f without the polish
h The normal entry path: a polar refine3D_auto run from the perturbed project, then refine3D_auto refine=cont on its output project The continuation accepts the polar run's poses without any seeding step; pose error and map against the truth are no worse after the continuation than after the polar run

As built in Phase 8 (commander_test_cont_refine3D_1jxy, floors declared in the code and here before the first run). Ruling R5 (2026-10-01) applies: correctness is measured against the truth orientations only, so the map gates of stages a, b and h are dropped and no FSC is compared. The fixture is simulated by simulate_particles with E25's CTF spread and SNR 1 under the fixed test seed (the noise realization differs from E25's, the recipe does not); the seeds are the truth perturbed by exactly 15 degrees about a random axis and 2 pixels, with state, half-set and projection direction 1, as a discrete workflow leaves them. refine3D_auto takes pose_cont=only (O7) where the table says refine=cont.

Stage As run Floors
a, b One refine3D refine=cont pass against the soft-masked truth map at lp 8 A with the E25 bounds (trs 5, athres_cont 15) and route (cont_route=shift_then_joint, ruling of 2026-10-02) E25's at 8 A: median rotation error <= 1.5 deg and median shift error <= 0.2 px (a tenth of the injected error, F1), fraction inside the basin width 7.64 deg >= 0.95 (F2)
c Stage a with nparts=2 Stage a's floors; against stage a, median rotation difference <= 0.01 deg and at most 1% of the particles differing by more than 0.1 deg (rounding level of threaded evaluation, see the Phase 7 finding)
d After a, b, c and e No reprojection model and no dist_part*/assignment_part* file in the run directory; every particle keeps the seed's projection direction, which a discrete pass would reassign; the file count is reported
e refine3D_auto pose_cont=only nsample=500 maxits=4 The convergence statistics of the last iteration show iteration 4 and 50% sampled; stage d; median rotation error <= 7.5 deg and median shift error <= 1 px (half the injected error, 10.1) and below the seed's
h Polar refine3D_auto with ref_pose_init=cc against the truth map (changed after the first run, see below), then refine3D_auto pose_cont=only maxits=2 on the same project The error is measured up to the four symmetry mates of 1JYX and a global frame (changed after the second run, see below). Precondition: the polar run's error is below the seeds'. The continuation runs on the polar poses without a seeding step; its error, against the polar result's symmetry mates and frame, is at most the polar run's plus 0.1 deg (the margin unchanged)

As built in Phase 9 (floors declared here and in the code before the first run of the stages):

Stage As run Floors
f refine3D refine=neigh objfun=euclid against the truth map at lp 8 A (the bounds of a), update_frac=0.3, two iterations, once with pose_cont=no and once with pose_cont=yes The symmetry-aware error (stage h's metric) over the particles the passes updated is with the polish at most the error without it plus 0.1 deg; the polish refines exactly the sample (corr_cart positive on every updated particle, zero on the others, which keep their seed poses); the discrete iteration that follows the first polish scores its particles (finite corr, positive mean)
g Stage h's polar refine3D_auto (ref_pose_init=cc against the truth map) with pose_cont=yes Completes; the convergence statistics of the last iteration count as many polish attempts as sampled particles, and every particle carries corr_cart; the symmetry-aware error is at most h's polar run's plus 0.1 deg (the like-for-like run without the polish; stage f, a refine3D against the truth map, is not comparable with a refine3D_auto run, so g is compared with h's polar run where the table names f)

One reconstruction per iteration (stages f and g) is evidenced from the CTest log: the assembly runs once per iteration between the stage markers the gate prints.

Finding of the first complete run (scratch/logs/cont_refine3D_1jxy_p8b.log): stages a-e passed; the polar refine3D_auto with its defaults did not refine the perturbed project. Its registration pass, an exhaustive greedy search against the startup map reconstructed from the 15-degree seeds, reassigned 78% of the projection directions, and the run ended at a pair pose error of 23.4 deg, no better than random 15-degree perturbations give; the continuation then moved that scrambled set by +0.13 deg, over the 0.1 deg floor. Stage h presupposes a polar result that refined its input, so its polar run now initializes the poses against the independent truth map (ref_pose_init=cc, the workflow's own path for poor input poses), and the precondition is gated. The floor of the stage is unchanged. On the same seeds stage e, the Cartesian continuation alone, ended at a median rotation error of 1.03 deg.

Second run (scratch/logs/cont_refine3D_1jxy_p8c.log): with the truth-map initialization the polar run still ended at a pair pose error of 21.7 deg (seeds 8.1 deg) and a median direct error of 178 deg, and its orientation motion grew every iteration (19, 30, 33, 37 deg). 1JYX is beta-galactosidase, D2-symmetric, and the gate runs in c1: the global searches of the polar workflow assign any of the four symmetry-related poses (the D2 operations are 180-degree rotations) and hop between them, which neither the direct error nor the pair metric forgives; the local Cartesian pass never reaches a mate, so stages a-e are unaffected. Stage h therefore measures the error up to the mates (sym_pose_error): the frame difference of each particle against the truth takes one of four values for a correct assignment; the values are found as the centres of the four densest 3-degree clusters (the truth map's symmetry axes are not assumed to follow SIMPLE's D2 convention, so the operators are not taken from sym), and the error of a particle is its distance to the nearest centre. The continuation is measured against the centres of the polar result. The precondition and the 0.1 deg margin stand.

10.4 Suite layout after the refactoring

Entry Sub-suites, in table order Tester modules
unit_cart_align3D Cartesian Fourier, cart calculator, pose optimizer, pose strategy, pose statistics simple_cartesian_fourier_tester, simple_cartft_calc_tester, simple_cartft_pose_opt_tester, simple_strategy3D_cont_tester, simple_convergence_tester
lib_cart_align3D pose 1JYX recovery simple_strategy3D_cont_1jyx_tester
cont_refine3D_1jxy (C18) high-level gate N20 commander in simple_commanders_test_highlevel.f90

Removed sub-suites: pose refiner and pose adapter (Phase 7, split into the calculator and optimizer sub-suites), pose workflow (Phase 1). The suite= selectors become cartesian_fourier, cart_calculator, pose_optimizer, pose_strategy, pose_statistics. A selector is derived from the sub-suite name (suite_id: lower case, blanks to underscores), so the calculator sub-suite is named cart calculator to give the selector C17 names (Phase 2).

10.5 Guards on the polar code

The refactoring touches code the polar path shares (Phases 5-7). These existing suites are rerun and compared with Phase 0 at each of those phases:

  • fast: unit_pftc_align2D3D, unit_ori, unit_project, unit_ui, unit_reconstruction;
  • high-level: simulated_workflow_1jxy, simulated_workflow_6vxx and abinitio3D_addon, which drive the polar strategies through the matcher;
  • by hand: the ordinary refine3D_auto run of Phase 0.

The high-level guards and the beta-gal runs are compared on a Release build of the phase's tree, out of tree under the run's scratch directory; the fast and library tiers on the Debug build of ./compile_debug.sh. In Debug, simulated_workflow_1jxy and _6vxx stop in abinitio3D at a pre-existing bounds check (calc_lplim_final_stage takes the median of the three best class resolutions and the 2D stage leaves one class), outside this plan's files; Release passes. Decided in Phase 0 (section 15, "Phase 0 baseline"). Ruling R3 (2026-10-01): the guards run once (not two or three times) and only in the phases that change code the polar path shares (5, 6, 7), compared with the Phase 0 spread; the beta-gal runs by hand only in Phases 7, 8 and 9.

10.6 Budget and records

  • The fast gate's time for unit_cart_align3D is read from build/test_runs/ctest_fast.log.timing.txt at Phase 0 and after every phase. A sub-suite that approaches a second is reduced or moved to the library tier before the phase exits.
  • During Phases 2-6 some checks run twice (old tester on the forwarder, new tester on the class). That duplication ends in Phase 7.
  • SIMPLE_CTEST_BUDGET goes from 29 to 30 in Phase 8, with the new entry (C18).
  • Every retirement in section 10.2 is stated in its commit message with the id of the replacing test.

11. Checks at every phase

  • git diff --check
  • python3 scripts/check_test_registry.py . --verbose
  • python3 scripts/check_descr.py .
  • no multiline THROW_HARD/THROW_WARN
  • stale-symbol scan for whatever the phase moved or deleted
  • ./compile_debug.sh (build and fast gate), run by the maintainer or by an unattended run under section 14

12. Risks and controls

Risk Control
Numerical drift during moves Phase 2 moves formulas unchanged; old and new testers both pass before Phase 3 changes anything
Regression in the nine polar strategies Phase 5 is mechanical and stands alone; section 10.5 guards rerun before the Cartesian child is added
Two reference authorities One materializer and filename family; validity check on read; N8 and N9
Shared-memory and distributed divergence Same child command and file contract; N20 stage c
sigma2 scale differs between representations N14, before any pass mixes them (Phase 9)
Memory and I/O One representation per pass; the padded transform of every state and half is resident for a Cartesian pass (section 6.2); with pose_cont=yes every iteration reads its particle sample twice; peak RSS, stack reads and wall time per iteration measured against Phase 0
Project compatibility O8: width unchanged at 52, slot 42 left alone (old cc_nonpeak values); N17
Fast gate grows Section 10.6
Scores of mixed origin are ranked Separate fields: corr polar, corr_cart Cartesian (C14)
A Cartesian run stops before it has stabilized No early stop until O2 is decided; N25
A floor canonizes a regression Floors from truth, an analytic bound and the Phase 0 pre-refactor values (section 10.1)
The Cartesian observation loses high-resolution signal the polar one keeps O4, O5; N28; the high-resolution E25 case; N29 on the nanoparticle case where refine=neigh is known to work
Gates at low resolution only E25 and N20 run at lp 8 A, where preparation order and taper barely show; the high-resolution E25 case and N29 cover the regime the method is for
Data race in the particle loop Ownership table of section 6.2; N12, N26, N27; the nightly four-thread run of the fast tier

13. Review checkpoints

  1. Calculator and optimizer public interfaces, on the first commit of Phase 2, before code moves behind them.
  2. Objective definitions, the rulings on O4-O6 and their tests (Phase 3).
  3. The file layout of section 6.6 (the handoff is C22), before Phase 4 starts; reference and particle lifecycle (end of Phase 4).
  4. Polar baselines after the hierarchy split (end of Phase 5).
  5. Matcher contents and the record layout of O8 (end of Phase 7).
  6. User-facing surface, the refine3D_auto switch of O7 and its stage bypass (end of Phase 8).
  7. Polish scheduling, reconstruction and convergence-field handling (Phase 9).

14. Unattended execution

A phase may be run unattended, for example by a scheduled overnight Claude Code run. The rules below add to sections 9-11 and relax none of them.

  • A run carries out one phase, or the part of a phase up to its review checkpoint, and stops there. It never starts the next phase.
  • It works in its own worktree, on its own branch from the last accepted phase. It does not push, merge or rebase.
  • Its prompt is the explicit request for builds and tests that repository policy requires. The prompt names ./compile_debug.sh, scripts/run_fast_gate.sh, the checks of section 11 and the CTest entries of the phase; nothing else is compiled or run.
  • It edits only the files section 8.3 assigns to the phase. The runner enforces the file list and the command list mechanically, not by instruction alone.
  • It stops and reports, without working around the cause, when a test fails for a reason the phase does not explain; when passing would need a changed tolerance, floor or existing assertion; when it needs a file outside section 8.3; when a contract ruling is ambiguous; or when an exit item needs the maintainer's data.
  • It ends with commits on its branch and a drafted row of section 15: the commits, each exit item met with its evidence (log path, metrics.tsv), each item not met and why.
Phase Mode A run ends at Precondition
0 Unattended for the test entries; the beta-gal runs are the maintainer's Test-entry numbers and inventories recorded Branch point chosen
1 Unattended End of phase Phase 0 test-entry numbers
2 Unattended, two runs The interface commit (checkpoint 1); then end of phase Checkpoint 1 accepted before the second run
3 Attended - The scientific change (checkpoint 2); O4-O6 ruled
4 Unattended End of phase Section 6.6 layout confirmed (checkpoint 3)
5 Unattended End of phase Phase 0 polar numbers
6 Unattended End of phase Phases 2-5 accepted
7 Attended - The matcher cut-over and the record layout (checkpoint 5); O8 ruled
8 Attended - The user-facing surface (checkpoint 6); O7 ruled
9 Attended - The scientific gate of the polish (checkpoint 7)
10 Unattended End of phase Phases 1-9 accepted

14.1 Delegated run (2026-09-30)

The maintainer delegated the whole refactoring to one unattended run on the Dell (Oracle Linux) and reviews the complete raw diff when it is done. For that run the following replaces the per-phase review gates above; everything else in sections 9-11 and the stop conditions of this section stand.

  • One driver runs phases 0 to 10 in order, one Claude Code session per phase, in its own copy of the repository (~/pose_cont_autorun/repo). Other checkouts on the machine are read, never written.
  • Nothing is committed, staged, stashed, branched or tagged (maintainer, 2026-09-30): the change lives in the working tree against the HEAD the copy started from, and git is read-only for the run. Where this plan speaks of commits (section 1: ownership moves and numerical changes in separate commits; the rest of section 14), the phase boundary takes their place: after every phase the driver writes that phase's diff (review/phase_N.diff) and the complete raw diff against HEAD so far (review/full_after_N.diff), and at the end review/full.diff.
  • A phase starts only when the previous one has met its exit criteria and written its row of section 15. A phase that cannot meet them stops the run with a report; it does not hand on a partial result.
  • Review checkpoints (section 13) are recorded, not waited for: at each one the run writes into section 15 what would have been reviewed and the evidence, so the final review can take the checkpoints in order.
  • Phases marked "Attended" in the table above run unattended. The open decisions are taken as section 4 records under "Delegation".
  • After every phase the driver checks that the files the phase changed are the ones section 8.3 assigns to it; a mismatch stops the run.
  • Phase 0 runs on the Dell: the test entries, each high-level entry two or three times so later phases compare against a spread, and the beta-gal runs on the bgal single-state set already on the machine. The run finds that set read-only; if it is absent, Phase 0 records the gap and the beta-gal comparisons of later phases fall back to the simulated gates.
  • Out of scope, as before: renaming the shared simple_cartesian_fourier.

15. Progress

Date Phase Commit Evidence Status
2026-09-30 Plan - Contract C1-C21 accepted; test plan added Awaiting Phase 0
2026-09-30 Plan review - Six review findings incorporated: mixed-origin scores (O3), no early stop under refine=cont (O2), continuation-only refine3D_auto mode, model file contract (6.6), ownership and thread-safety (6.2), floors (10.1) O3 awaiting ruling
2026-09-30 Plan review 2 - O3 withdrawn: the one ranking of stored ptcl3D scores is unused under the refine3D_states sampling defaults (section 3, C14); N24 dropped. Baseline recorded at the branch point, with simulated_workflow_6vxx and the fast-gate timings added (Phase 0). Section 8.3 made the complete file list. error stop count corrected and pure procedures handled (section 2, Phase 2). Interface commit opens Phase 2; 6.6 confirmed before Phase 4 (section 13). Unattended execution (section 14) Under review; awaiting Phase 0
2026-09-30 Plan review 3 - Reference handoff described as what it is: prepared real-space volumes, with central sections gathered on the fly at the continuous rotation and no projection grid (section 3, C10; 6.2; 6.6). Files renamed cart_refvols_{even,odd}.bin; the reason for a file and the per-matcher preparation it was weighed against recorded (6.6); in-memory footprint of the padded transforms added (6.2, section 12) Under review; awaiting Phase 0
2026-09-30 Ruling - C22 accepted: the file of prepared reference volumes stays as the handoff to the workers; per-matcher preparation not taken. The layout of 6.6 remains for checkpoint 3 Under review; awaiting Phase 0
2026-09-30 Methodology review - Section 5 checked against refine3D refine=neigh (strategy3D_greedy_sub, the refine3D_nano mode). Matches: euclid measure, cc weighting of the continuous polar stages, reference and gather, even/odd, band limit, sigma2 definition, shift-first staging. Open: particle preparation order (O4), particle-side interpolation (O5), search bounds (O6). Corrected: the cc row (two polar weightings), the CTF equivalence claim, shell membership. Added: N28, N29, the high-resolution E25 case O4-O6 awaiting ruling
2026-09-30 Naming - Short form cart for new identifiers (C17): cartft_calc, cartft_pose_opt, simple_cartft_calc, simple_cartft_pose_opt and their testers, l_cart_refine, cart_refvols_{even,odd}.bin, cart_refvols_header_compatible, selector cart_calculator. Names of current code that the refactoring deletes are unchanged in the inventory O4-O6 awaiting ruling
2026-09-30 Rulings - C5: sigma2 never enters a correlation; a Cartesian cc pass reads, requires and writes none. C14: corr (polar) and corr_cart (Cartesian) are separate stored objective values; nobody recalculates a stored score. C15 superseded by O8 (record layout; recommended width 52 with slot 51 corr_cart). O7 opened: the refine3D_auto continuous-only switch (recommended pose_cont=no\|yes\|only). The Phase 7 comment at the refine3D_states sort is dropped O4-O8 awaiting ruling
2026-09-30 Delegation - The maintainer delegated the whole run to the Dell and reviews at the end (section 14.1). Recommendations of O4, O5 (a), O6, O7 (b), O8 and the 6.6 layout adopted for the run; checkpoints recorded rather than waited for. The nine polar strategy files listed by name in section 8.3 Ready for Phase 0
2026-09-30 Delegation - No commits (maintainer): the run never commits, stages or stashes; it delivers the complete raw diff and one diff per phase (section 14.1) Ready for Phase 0
2026-10-01 Phase 0 - (base 714a15a99, no commit) Changed: src/main/strategies/search/simple_pose_cont_1jyx_tester.f90 (print lines only: per-particle error medians, fraction improved, fraction inside the basin width, LM status counts; no assertion changed), this file (10.5 note, this row, "Phase 0 baseline"). Exit "numbers and file inventories pasted into section 15": met, below. Build and fast gate: scratch/build_phase0.log, 13/13 pass, 3.3 s. unit_cart_align3D PASS, sub-suite times below. lib_cart_align3D four runs (Debug), PASS, metrics bit-identical: scratch/logs/lib_cart_align3D_r{1..4}.log. High-level simulated_workflow_1jxy, _6vxx, abinitio3D_addon three runs each on a Release build, all PASS: scratch/logs/*_R{1,2,3}.log; in Debug the two simulated workflows stop at a pre-existing bounds check (scratch/logs/simulated_workflow_*_r1.log), decision recorded in 10.5. Beta-gal set found (/data2/bgal_addon/5_abinitio3D, 5 513 particles): both routes of refine=pose_cont and of pose_cont=yes, a pose_cont=no control and one refine3D_auto, all NORMAL STOP: scratch/logs/bgal_*.log. Inventories: scratch/inventories/. Paths are under /home/elmlundho/pose_cont_autorun. No review checkpoint in this phase Baseline recorded
2026-10-01 Phase 1 - (working tree, no commit; review/phase_1.diff) Deleted: commanders/simple/simple_commander_refine3D_pose_cont.f90, strategies/parallelization/simple_refine3D_pose_cont_workflow.f90 and its tester, ui/simple/simple_ui_refine3D_pose_cont.f90, doc/policies/3D/refine3D_pose_cont_policy.md. Restored to e86286f2^: simple_exec_refine3D.f90, simple_ui_refine3D.f90, simple_commanders_refine3D.f90 (the four hooks gone; inline objfun=euclid, maxits/minits defaults, registration-pass setup and main-stage call back; plus the one later commit to that file, 02133edba, the oritype line of exec_refine3D), simple_ui_visibility_tester.f90 (plus the one later line of f9bbf72ce). Edited: simple_parameters.f90, _parse.f90, _phases.f90 (pose_cont_mode, its validation, the program-name checks and the prg case of the envelope report), simple_commanders_test_class.f90 and simple_test_ui_class.f90 (sub-suite pose workflow and selector pose_workflow gone), refine3D_auto_policy.md (paragraph and link dropped), this file. Tests retired: E22-E24 with the workflow module (replaced by N20, N21 in Phase 8); E26 with the program's UI (replaced by N21). Decisions: (1) section 8.3 named no Phase 1 for params/simple_parameters*.f90 although this phase's text removes pose_cont_mode there; Phase 1 was added to that row before the edit (plan rule). (2) E26 had added the helpers program_has_input, list_has_input and an expected_choices argument of assert_ui_param; retired with it, since unused they raise a new -Wunused-function warning; N21 (Phase 8) re-adds what it needs. (3) Phase 0 has one beta-gal refine3D_auto run, so its spread is one point; the comparison uses two Phase 1 runs on the same set and the iteration-to-iteration range of the Phase 0 run. (4) doc/policies/test_environment_policy.md still lists the pose workflow sub-suite: that file is Phase 10's (section 8.3). Also corrected in the Phase 0 table: the refine3D_auto FSC-at-4 A and mean-FSC columns are iteration 1, not the last iteration. Exit items: (a) exec_refine3D_auto identical to e86286f2^ (568 lines, diff of the extracted subroutine empty); the whole file differs from e86286f2^ only by 02133edba. (b) Ordinary refine3D_auto baseline reproduces, beta-gal, Release, nparts=2 nthr=6 as in Phase 0 (scratch/logs/bgal_p1_refine3D_auto_{a,b}.log, dirs scratch/bgal/runs/p1_refine3D_auto_{a,b}, load 6-8.5 = the run's own threads): final FSC 0.5 / 0.143 4.08 / 3.59 and 4.08 / 3.59 A (Phase 0 4.08 / 3.55, adjacent shell; Phase 0 iterations 3.51-3.63), cFAR 0.56 / 0.56 (0.57), mean FSC 8 A-Nyquist of the final map 0.4104 / 0.4114 (0.4098), iteration-1 motion 0.205 deg / 0.049 px in all three runs, iterations 2-4 within 0.01 deg; wall 18:54 / 19:32 (18:25), peak RSS 10.74 / 10.70 GB (10.74); the same 90 files (scratch/inventories/bgal_p1_refine3D_auto_{a,b}.txt). (c) Registry check clean (check_test_registry: 28 selectors, 31 programs, consistent); check_descr clean; git diff --check clean; no multiline THROW; stale-symbol scan empty for refine3D_pose_cont (except refine3D_pose_cont_ref_fname, Phase 4), pose_cont_mode, pose_cont_workflow, post_matcher, standalone_final and the four hook names. Build and fast gate: ./compile_debug.sh (scratch/build_phase1b.log), no compiler warnings, 13/13 pass, 3.3 s, unit_cart_align3D 0.14 s (5 groups, 494 assertions), unit_ui pass (scratch/runs/p1_fast_gate_build/). lib_cart_align3D (Debug) PASS, 129 s, every E25 metric identical to Phase 0 (scratch/logs/lib_cart_align3D_p1.log). simple_exec prg=refine3D_pose_cont stops with "not recognized"; pose_cont_mode= is rejected as an unknown argument. Paths under /home/elmlundho/pose_cont_autorun. No review checkpoint in this phase Done
2026-10-01 Phase 2 - (working tree, no commit; review/phase_2.diff; the interface state of checkpoint 1 in review/phase_2_interfaces/) New: src/main/cftc/cftc.inf, simple_cartft_calc.f90 (type cartft_calc), simple_cartft_pose_opt.f90 (type cartft_pose_opt), simple_cartft_calc_tester.f90, simple_cartft_pose_opt_tester.f90. Rewritten as thin forwarders that gain no behavior: volume/simple_cartesian_pose_refiner.f90 (1 182 to 393 lines; the inverse-envelope constructor stays here, applying the envelope before set_ref, until Phase 4 deletes it) and strategies/search/simple_pose_cont_refine3D_adapter.f90 (745 to 618 lines; its workspace holds a cartft_calc, the transaction moved to cartft_pose_opt%refine_pose; observation preparation, artifact I/O, particle workspace and policy constructors stay for their own phases; the two shift conversions lose pure and stop through THROW_HARD). Ported: simple_pose_cont_1jyx_tester.f90 (E25 through the calculator and optimizer; the observation is still prepared by the adapter). Registered: simple_commanders_test_class.f90, simple_test_ui_class.f90 (sub-suites cart calculator and pose optimizer, selectors cart_calculator, pose_optimizer). Assigned but unchanged: simple_strategy3D_pose_cont.f90 and its tester (they call the adapter, whose interface is unchanged), the refiner and adapter testers (the parity proof). This file: 6.2 "As built in Phase 2", 10.4 suite naming, header, this row, "Phase 2 interfaces". Review checkpoint 1: recorded in "Phase 2 interfaces" below, not waited for (14.1). Tests: E4, E5, E7-E10, E18 and the lifecycle part of E19 copied to the calculator tester; E11, E12, E14-E17, the round-trip part of E19 and the scaling part of E13 to the optimizer tester; N1 (calculator: repeated new/kill, distinct even/odd predictions, odd = -0.5 even by linearity) and N2 (optimizer: an accepted refine on an ori changes only the Euler angles and shift of its 52-real record, a rejected one changes nothing; native box 32 over cropped 16, which also pins the shift scaling); E25 ported; E6 stays in the refiner tester only (retired in Phase 4). Decisions: (1) the objective is an argument of the evaluation methods, OBJFUN_CC or OBJFUN_EUCLID, selecting the two existing objectives unchanged (whitened NCC, whitened half squared residual); Phase 3 changes the definitions. (2) Particles live in calculator slots; cartesian_pose_data keeps the raw inputs and every forwarded call reloads them into the slot of the calling OpenMP thread (slots = omp_get_max_threads() at construction, the matcher's team size), which rebuilds the prepared arrays bit for bit; the refiner and the adapter workspace hold their calculator through a pointer so the intent(in) signatures the unchanged testers and production use stay valid. (3) refine_pose (rotation matrix and cropped shift), the stage solvers refine_shift/refine_joint and right_increment_rotation are public: the forwarders and the 1JYX fixture need double-precision rotation matrices (an ori stores single-precision Euler angles), E12 tests the stages alone, fixtures perturb poses with the optimizer's convention; Phase 7 decides whether they become private. (4) Per-particle failures are typed statuses CARTFT_* (values of the old LM_* codes, which the forwarders alias); both stage solvers return CARTFT_INVALID_NUMERICS for an invalid slot (the old shift solver did; the old joint solver stopped); caller-contract violations are THROW_HARD; the gather is pure and returns an inside flag its non-pure callers turn into a stop; policy is validated once in new. The 28 error stop of section 2 are gone from the continuous-pose code. (5) The sub-suite is named cart calculator so that its derived selector is the cart_calculator of C17 (10.4). (6) The unused stencil-margin output of the old pose_normal_terms is dropped. (7) The optimizer tester pins that stage records chain the transaction objectives instead of the old aggregate balance, which stays a forwarder sum checked by the adapter tester. (8) A new motion check compares get_motion with the trace-form geodesic; its tolerance (1e-4 rad) is derived from the conditioning of that form at 1.8 degrees with single-precision seeds, not from a run. Exit (a), every Phase 0 numerical result reproduces through old and new testers: met. unit_cart_align3D 7 groups, 599 assertions, PASS (Cartesian Fourier 370, cart calculator 52, pose optimizer 53, pose refiner 48, pose adapter 45, pose strategy 14, pose statistics 17; the old counts are those of Phase 1); the printed lines of the old testers (POSE_CONT_MATCHED_PROJECTOR relative L2 1.4300E-07, POSE_CONT_ADAPTER_EXACT) are identical to a Debug build of the pre-Phase-2 tree (scratch/p1_build, scratch/runs/p2_parity_debug_p1/out.log), and the calculator's copy prints the same value. E25 through the new classes (Debug, two runs, scratch/logs/lib_cart_align3D_p2{,b}.log): every metric of the Phase 0 table identical (accepted 4 933 / 5 000, status 4 for 67; rotation RMS/median 1.774/0.196 deg; shift 0.248/0.050 px; mean objective 4.4635E-01 to 5.3728E-02; map correlation 0.98316/0.84102/0.98256; FSC 3.120/2.674 A). Production through the forwarders on beta-gal (Release, as Phase 0; scratch/logs/bgal_p2_*.log, dirs scratch/bgal/runs/p2_*): refine=pose_cont with both routes gives POSE_CONT_STATS_ITER001.txt identical to Phase 0 in every non-timing field and the same FSC (4.35/3.75 A, mean FSC 0.3296/0.3299); pose_cont=yes differs within the run-to-run variation of its discrete prob_neigh pass, which Phase 2 does not touch: two pose_cont=no controls of this build differ from each other (DIST mean/max 0.383/26.164 and 0.385/26.229 deg, FSC 0.143 3.80 and 3.75 A) as much as from Phase 0 (0.385/26.164, 3.75 A), and the polish runs land at FSC 4.35/3.75 A, mean FSC 0.3285/0.3286 (Phase 0 0.3286/0.3287). (b) Neither class imports matcher, commander, UI or project modules: simple_cartft_calc uses simple_core_module_api (scalars, CTF records, kbinterpol, cyci_1d), simple_image, simple_ctf, simple_cartesian_fourier; simple_cartft_pose_opt uses simple_core_module_api (ori, dm2euler, kinds) and simple_cartft_calc. Build and gate: ./compile_debug.sh (scratch/logs/compile_debug_p2_final.log), no compiler warnings, 13/13, 3.3 s; unit_cart_align3D 0.29 s (Phase 0 0.13-0.16 s; each new sub-suite under 0.1 s). Timing: beta-gal wall 3:35 / 2:20 / 5:51 / 4:37 for posecont stj/joint, polish stj/joint (Phase 0 3:34 / 2:29 / 5:54 / 5:14), transaction mean 0.350 s (0.352), peak RSS unchanged (2.5 and 21.6 GB). E25 in Debug takes 146-148 s against 129-136 s before: the -O0 -fcheck=all cost of the extra descriptor work per sample, not seen in Release. Checks: git diff --check, check_test_registry (28 selectors, 31 programs, consistent), check_descr, no multiline THROW, stale scan empty in src for the moved private routines (run_pose_cont_transaction, load_pose_reference, sample_fourier_with_grad, pose_cont_ctf_value, pose_cont_reference_slot, ...); the regenerated indexes (Phase 10) and doc/implementation_notes/continuous_3D_pose_end_polishing.md (not in 8.3) still name them. fence.py check 2: 11 files, each assigned to Phase 2. Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-01 Phase 3 - (working tree, no commit; review/phase_3.diff) Changed: cftc/simple_cartft_calc.f90 and tester, cftc/simple_cartft_pose_opt.f90 and tester, volume/simple_cartesian_pose_refiner.f90 and tester, strategies/search/simple_pose_cont_refine3D_adapter.f90 and tester, simple_strategy3D_pose_cont.f90 and tester, simple_pose_cont_1jyx_tester.f90, params/simple_parameters_phases.f90 (the forced cc_emit_sigma removed), simple_commanders_test_class.f90, simple_test_ui_class.f90, and, added to 8.3 for this phase, simple_strategy3D_matcher.f90 (polish path: policy from parameters, observation centred on the winner's shift, no sigma2 under cc, Fourier maps memoized per batch for the fused flip; the generic sigma rule replaces the removed predicate), simple_pose_cont_run_stats.f90 (objective label from objfun), simple_refine3D_strategy.f90 (stats policy from parameters); this file (8.3 rows, section 5 and 6.2 "As built in Phase 3", 10.2 E25, N20 fixture, Phase 0 baseline at 1 000 particles, this row). Adopted (delegation): C4-C6 with the slot-objective design of 6.2 (a slot is prepared for one objective, cc without any sigma2 argument; euclid the normalized polar loss with exp(-L) as score); O4 (prepimg4align's fused routines up to the mask, abs(CTF) on the model, the solve for the shift increment, stored shift plus increment committed); O5 (a) (the stencil's separable taper on the masked observation); O6 (trs and athres as the total bounds, trs = 0 freezes the shifts). Decisions: shell membership nint(r) inside the Nyquist circle (section 5); a zero-power observation is an invalid preparation; the exactness checks of E4 keep their thresholds expressed in the units of the old unnormalized loss (the same condition, not a relaxation); E14's unobservable case is a zero reference against a nonzero particle. Rulings applied: R1 (the 4 A E25 case starts from the 8 A poses of the same objective, floors F2 >= 0.90, F4, F5; F1 against the 8 A injected error; no optimizer change), R2 (E25 at 1 000 particles; Phase 0 re-measured), R3 (library tests on Release). Tests: E8 rewritten as N3, E9 extended as N5, E15 rerun under the new cc, E20 retired with the predicate (replaced by N3 and a parameter check that a cc pass requests no sigma emission), old refiner/adapter copies follow the new definitions; added N3, N4, N5, N6, N7, N28 and bound tests (O6). Exit: (a) both objectives pass formula, gradient and recovery tests: N3, N4, N5, N7 pass (unit_cart_align3D 7 groups PASS, calculator 86, optimizer 70, refiner 49, adapter 47 checks; scratch/runs/p3_unit1/out.log). (b) N6: Cartesian and polar cc and euclid select the same grid pose, and Cartesian cc the same as the ring-weighted gen_corr_for_rot_8: pass. (c) the high-resolution E25 case meets its floors: E25 Release, 1 000 particles (scratch/logs/lib_cart_align3D_p3_r1000.log, 26 s, 47 checks PASS): cc 8 A median rotation 0.188 deg, basin 0.9910, map 0.97246 (F3 from Phase 0 at 1 000: <= 0.388, >= 0.9770, >= 0.96388); euclid 8 A 0.198 deg, 0.9710, 0.97166; cc 4 A (from the cc 8 A poses) 0.128 deg, basin(3.82 deg) 0.9980, map 0.97300; euclid 4 A 0.126 deg, 0.9820, 0.97253; F5 0.188 -> 0.128 and 0.198 -> 0.126 deg. Finding (R1): from the 15 degree / 2 px start directly at 4 A (5 000 particles, scratch/logs/lib_cart_align3D_p3d.log and _p3_release_diag.log), euclid ends 0.80 of the particles inside the basin against 0.996 for cc; every particle outside the basin ends above its truth objective, so these are local minima of the euclid loss far from the optimum, and the captured particles converge as precisely as under cc (median 0.152 against 0.120 deg). Production (beta-gal, Release, scratch/logs/bgal_p3_*.log): refine=pose_cont and pose_cont=yes under euclid and cc NORMAL STOP, improved 5 513 / 5 513, FSC 0.5 / 0.143 4.35 / 3.75-3.80 A (Phase 0 4.35 / 3.75); a cc pass writes no sigma2 (C5); wall 1:32 / 3:06 (posecont euclid / cc; Phase 0 3:34), 3:41 / 5:06 (polish; Phase 0 5:54). Build and gate: ./compile_debug.sh no compiler warnings, 13/13, 3.3 s, unit_cart_align3D 0.78 s (Phase 2 0.29 s; calculator 0.49 s with N5/N6) (scratch/logs/compile_debug_p3_final.log). Checks: git diff --check, check_test_registry, check_descr, no multiline THROW, stale scan empty for POSE_CONT_OBJECTIVE_*, pose_cont_sigma_is_enabled, pose_cont_limits_from_boxes. Review checkpoint 2 (objective definitions, O4-O6 and their tests): recorded here and in 5 / 6.2 "As built in Phase 3", not waited for. Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-01 Phase 4 - (working tree, no commit; review/phase_4.diff) Changed: cftc/simple_cartft_calc.f90 (file contract of 6.6: set_refvol, write, read, cart_refvols_header_compatible, CART_REFVOLS_FORMAT_VERSION) and tester (N8, N9), simple_builder.f90 (cftc, killed with the general toolbox), src/defs/simple_refine3D_fnames.f90 (refine3D_cart_refvols_fname(half) replaces refine3D_pose_cont_ref_fname), params/simple_parameters.f90 and _phases.f90 (l_cart_refine, derived once), strategies/search/simple_matcher_refvol_utils.f90 (producer, reader read_cart_refvols and dispatch in read_reprojection_model, removal in remove_ref_section_files; adapter import and cartesian_only gone), simple_strategy3D_matcher.f90 (reads into build%cftc, the reference workspace views it), volume/simple_cartesian_pose_refiner.f90 and tester (new_inverse_envelope_reference and E6 deleted under O5 (a)), and, added to 8.3 for this phase, strategies/search/simple_pose_cont_refine3D_adapter.f90 and tester (the workspace is a non-owning view of build%cftc; the per-state MRC artifacts, their writer, remover and loader are deleted); this file (8.3 adapter row, 6.6 "As built in Phase 4", this row). Decisions: the calculator stages prepared volumes for the writer (no transform on the materializer); the compatibility function is type-bound and names the failing field; file names come from the caller; the matcher of a Cartesian pass reads at entry (an empty partition's sigma2 output needs the band); the polish reads the volumes after the polar model; one particle slot per thread until Phase 6. Tests: E6 retired with its constructor (E10 guards the gather, kept); N8 (write/read with identical predictions for two states and both halves, header fields, the band returned and adopted with lp through read_reprojection_model, the compatibility function false for version, box, state count, sampling, out-of-range band and differing even/odd headers) and N9 (remove_ref_section_files removes both files, none survives) in the calculator tester; the adapter tester builds its workspace from a calculator. Exit: (a) one owner produces, validates, reads and removes the references: cartft_calc writes, checks and reads the format; simple_matcher_refvol_utils produces (materialize_reprojection_model_from_volumes), reads (read_reprojection_model/read_cart_refvols) and removes (remove_ref_section_files); stale scan empty for refine3D_pose_cont_ref_fname, write_pose_cont_reference_artifact, remove_pose_cont_reference_artifacts, new_from_artifacts, load_reference_slot, new_inverse_envelope_reference, pose_cont_reference_state in src. (b) a distributed worker builds the calculator from declared files only: beta-gal refine=pose_cont nparts=2 nthr=6, Release (scratch/logs/bgal_p4_posecont_distr.log, dir scratch/bgal/runs/p4_posecont_distr): NORMAL STOP, two partitions, the run directory holds cart_refvols_{even,odd}.bin (header [1, 256, 1, 2, 86], 1.275 A, 67 108 888 bytes = 24 + 256^3 * 4), no polar model and no MRC reference artifact; LM statistics identical to the shared-memory Phase 3 run (improved 5 513 / 5 513, objective 0.96792 -> 0.96751, DIST mean 0.414 deg), FSC 0.143 3.80 A as Phase 3; pose_cont=yes (scratch/logs/bgal_p4_polish.log): NORMAL STOP, objective 0.96785 -> 0.96751 as Phase 3, both file families present. (c) no file I/O in the optimizer: simple_cartft_pose_opt opens, reads and writes no file (grep). Build and gate: ./compile_debug.sh no compiler warnings, 13/13, 3.3 s, unit_cart_align3D 0.85 s (scratch/logs/compile_debug_p4.log, scratch/runs/p4_fast_gate_build/); unit_cart_align3D 7 groups PASS (scratch/runs/p4_unit1/out.log: calculator 107, optimizer 70, refiner 48, adapter 48 checks); E25 Release 1 000 particles PASS, metrics identical to Phase 3 (scratch/logs/lib_cart_align3D_p4_release.log, 27 s). Checks: git diff --check, check_test_registry, check_descr, no multiline THROW. Review checkpoint 3, recorded not waited for (14.1): the layout of 6.6 was implemented as written (stream binary per half, five-integer header and smpd_crop, version 1, the compatibility rule, the reader adopting the band, removal by remove_ref_section_files only); the reference lifecycle (staged on the materializer, written once per iteration, read once per matcher into build%cftc, killed after the particle loop) and the particle lifecycle (thread slots of build%cftc filled by the forwarders until Phase 6) are as described in 6.6 "As built in Phase 4". Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-01 Phase 5 - (working tree, no commit; review/phase_5.diff) New: strategies/search/simple_strategy3D_pftc.f90 (abstract strategy3D_pftc, extends strategy3D, owns s). Changed: simple_strategy3D.f90 (representation-neutral: spec and the four deferred methods), the nine polar strategies (greedy, greedy_inpl, greedy_smpl, greedy_sub, shc, shc_smpl, snhc_smpl, eval, probabilistic/prob: extends(strategy3D_pftc)), simple_strategy3D_srch.f90 (writes cont_inpl_attempted/_improved at the end of its two continuous routes), simple_strategy3D_matcher.f90 (shift increment from the stored shift before and after srch; no ptr%s), simple_strategy3D_inplane_tester.f90 (N10), this file (6.3 "As built in Phase 5", R3 in 10.5, this row). Ruling applied: R3 (the polar guards once each, Release, compared with the Phase 0 spread; no beta-gal run in this phase), recorded in 10.5. Decisions: the increment equals the old one for every particle of positive state (prep4srch/prep4prob set prev_shvec from the stored record and every polar strategy calls one of them); for a rejected particle it is now zero instead of the shift, and its only reader, calc_sigma2, skips state-zero particles; the search object writes its continuous-route fields where the outcome is final, the matcher's pre-loop clearing keeping zeros for particles without a route (6.3). Tests: N10 (refine3D in-plane state: the previous shift of the search object after prep4prob is the shift stored in the project, which preparing the search leaves unchanged; one-particle strategy3D toolbox on a small phantom, tmp_ file removed) PASS; unit_pftc_align2D3D unchanged otherwise, all 7 sub-suites PASS (scratch/runs/p5_unit1/unit_pftc_align2D3D.log; refine3D in-plane state 44 checks, 0.38 s). Exit: (a) the matcher contains no ptr%s (grep of simple_strategy3D_matcher.f90). (b) ordinary refine3D and refine3D_auto baselines reproduce, through the guards of 10.5 (R3): fast unit_pftc_align2D3D, unit_ori, unit_project, unit_ui, unit_reconstruction PASS in the gate; Release, once each, side by side (load about 24 threads; wall times not comparable), all PASS: simulated_workflow_6vxx Pearson 0.8845 (Phase 0 0.8806-0.8823), masked truth FSC 0.5 / 0.143 6.09 / 4.89 A (5.67-6.24 / 4.89-5.94); abinitio3D_addon all 13 gate checks PASS, union_map_truth_corr 0.95234 (0.94655-0.94791), base_map_truth_corr 0.95051, union_truth_fsc0143_A 4.649 (4.738-4.928), cohort_frozen_pair_pose_error_deg 4.511 (4.588-9.829), cohort_pose_error_excess_deg 0.557 (0.306-1.761), addon_report_union_base_corr 0.99895; simulated_workflow_1jxy Pearson 0.7967 and FSC 0.5 20.80 A, just outside the Phase 0 range (0.8074-0.8215, 13.14-14.68 A; FSC 0.143 7.34 A inside), so one confirmation run alone: Pearson 0.8100, FSC 0.5 / 0.143 14.68 / 7.80 A, inside the range for the gate metric and FSC 0.5; the workflow differs from run to run (the three Phase 0 runs differ), and the first run is within that variation (scratch/logs/simulated_workflow_{1jxy,6vxx}_p5{,b}.log, scratch/logs/abinitio3D_addon_p5.log). E25 Release PASS, identical to Phase 4 (scratch/logs/lib_cart_align3D_p5_release.log). Build and gate: ./compile_debug.sh no compiler warnings, 13/13, 3.2 s (unit_pftc_align2D3D 2.40 s, Phase 0 2.00-2.25 s; scratch/logs/compile_debug_p5.log, scratch/runs/p5_fast_gate_build/). Checks: git diff --check, check_test_registry, check_descr, no multiline THROW. Review checkpoint 4 (polar baselines after the hierarchy split): recorded here, not waited for (14.1). Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-01 Phase 6 - (working tree, no commit; review/phase_6.diff) Changed: strategies/search/simple_matcher_ptcl_batch.f90 (build_batch_particles3D prepares the active representation(s) from one read; prep_cart_batch; prep_sigmas_objfun without flag; build_batch_particles3D_cartesian, the particle-workspace argument and the optional pad-image arguments removed; no continuous-pose import), simple_matcher_2Dprep.f90 (prepimg4align_cart, moved from the adapter), sigma2/simple_euclid_sigma2.f90 (generic new and calc_sigma2 over the polar and the Cartesian calculator; new_cartesian, set_particle_contribution removed; get_sigma2_part for N13), simple_strategy3D_alloc.f90 and simple_builder.f90 (no polar search state, no in-plane table under l_cart_refine), cftc/simple_cartft_calc.f90 (new_ptcls, get_nptcls, has_refs) and tester, simple_pose_cont_refine3D_adapter.f90 and tester (raw-particle workspace and observation records gone, refine_slot, observation forwarder for the E25 fixture), simple_strategy3D_matcher.f90, and, added to 8.3 for this phase, simple_strategy3D_pose_cont.f90 (evaluates the batch-prepared slot, sigma2 through the sigma owner); this file (8.3 row, 6.4 "As built in Phase 6", this row). Ruling applied: R3 (guards once; the two beta-gal runs below are the ones this phase needs because it rewires the production particle and sigma paths of the Cartesian pass and of the polish, whose centring changes). Decisions: the batch loop is prep_cart_batch in the matcher layer (the calculator does not import the image preparation of the matcher layer; one slot per iteration keeps the 6.2 rule); Cartesian slots are prepared when the pass has built build%cftc (has_refs; the probability-table commanders build none, and shared-memory prob_neigh runs them in-process with pose_cont=yes, which a first beta-gal polish run exposed: it stopped, scratch/logs/bgal_p6_polish.log); the polish observation is centred on the pre-search shift (6.4); the N14 fixture uses the box, sampling, mask and band of N6 so the polar calculator reuses its FFT plans (0.88 s to 0.51 s for the calculator sub-suite; the criterion, declared before the first run in state/journal_phase_6.md, is unchanged). Tests: E13 (observation part) moved to the calculator tester (prepimg4align_cart against norm_noise_fft_clip_shift, ifft_mask_fft); E18's adapter copy retired, replaced by N13 at the sigma owner (the calculator's E18 copy stays); new N11 (prep_cart_batch slot by slot equals the single-particle path, both objectives), N12 (team of three equals serial bit for bit), N26 (objective, gradient and residual by a team of three equal serial bit for bit), N13 (Cartesian calc_sigma2 stores the brute-force per-shell residual at the committed pose, zero at an exact match; a cc Cartesian pass builds no sigma2 state), N14 (zero reference, noise-only particle: with the taper Cartesian and polar per-shell sigma2 agree to mean 0.13 and max 0.26 standard errors of a shell, criterion <= 1 and <= 3; without it the polar/Cartesian ratio, 0.81-0.95, is the taper noise-power factor 0.867 within 3 standard errors in every shell); the adapter's slot transaction equals its data transaction bit for bit. unit_cart_align3D 7 groups PASS (scratch/runs/p6_unit1/out.log: calculator 123 checks 0.51 s, adapter 38). Exit: (a) no shared helper imports a continuous-pose module or takes a feature flag: simple_matcher_ptcl_batch, simple_matcher_2Dprep, simple_euclid_sigma2, simple_strategy3D_alloc import no pose_cont/cartesian_pose module; cartesian_only, pose_cont_particles and the optional pad arguments are gone (grep). (b) one sigma path: one constructor and one calc_sigma2 (generic), the outside setter removed; the Cartesian pass writes sigma2 through calc_sigma2 under euclid only. (c) N14 passes with the taper of O5 (a). Polar guards (Release, once, side by side; R3): simulated_workflow_1jxy Pearson 0.8153, FSC 13.14 / 7.13 A (inside the Phase 0 range); _6vxx 0.8855, 5.55 / 4.62 A (at or above); abinitio3D_addon all gate checks PASS, first run cohort_pose_error_excess_deg 2.978 and union_truth_fsc0143_A 5.029 outside the Phase 0 range (0.306-1.761, 4.738-4.928; floors 5 and 6.13), so one confirmation run (beside the beta-gal runs): 0.827 and 4.649, union_map_truth_corr 0.94527, cohort_frozen_pair_pose_error_deg 9.911, at the edges of the Phase 0 spread (run-to-run variation; the polar path is unchanged in logic) (scratch/logs/*_p6.log, scratch/logs/abinitio3D_addon_p6b.log). E25 Release PASS identical to Phase 5 (scratch/logs/lib_cart_align3D_p6_release.log). Beta-gal Release: refine=pose_cont nparts=2 NORMAL STOP, statistics identical to Phases 3 and 4 (objective 0.96792 -> 0.96751, DIST mean 0.414 deg, FSC 0.143 3.80 A; scratch/logs/bgal_p6_posecont_distr.log, rerun after the fix bgal_p6b_posecont_distr.log); pose_cont=yes after the fix NORMAL STOP, objective 0.96786 -> 0.96751 (Phase 4 0.96785 -> 0.96751), DIST 0.386 deg, FSC 0.143 3.80 A (scratch/logs/bgal_p6b_polish.log). Build and gate: ./compile_debug.sh no compiler warnings, 13/13, 3.3 s, unit_cart_align3D 0.88 s (scratch/logs/compile_debug_p6_final.log, scratch/runs/p6_fast_gate_build/). Checks: git diff --check, check_test_registry, check_descr, no multiline THROW; stale scan empty for build_batch_particles3D_cartesian, pose_cont_particle_workspace, new_cartesian, set_particle_contribution, pose_cont_observation_spec. Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-01 Phase 7 - (working tree, no commit; review/phase_7.diff) New: strategies/search/simple_strategy3D_cont.f90 (strategy3D_cont, extends strategy3D; new, srch, oris_assign, kill; pure cont_seed_is_valid) and tester, simple_convergence_tester.f90, strategies/search/simple_strategy3D_cont_1jyx_tester.f90 (E25 moved from simple_pose_cont_1jyx_tester.f90 under the name of 10.4; 8.3 row added for this phase). Deleted: volume/simple_cartesian_pose_refiner.f90, strategies/search/simple_pose_cont_refine3D_adapter.f90, simple_strategy3D_pose_cont.f90, simple_pose_cont_run_stats.f90, and their testers. Changed: simple_strategy3D_matcher.f90 (every entry of 8.1 removed; checkpoint 5 below), cftc/simple_cartft_calc.f90 (set_ptcl_inds, get_ptcl_slot: particle index to batch slot, cleared by new_ptcls and kill), parallelization/simple_refine3D_strategy.f90 (stats aggregation and its imports removed; reject_matcher_polish stops pose_cont=yes until Phase 9), src/defs/simple_defs_ori.f90 (O8: slot 51 I_CORR_CART/corr_cart; 52 stays the improved flag; no binoris change), simple_convergence.f90 (calc_pass_scores: a Cartesian pass reports the mean corr_cart over the sampled particles, attempts = sampled count, improved % from the flag; a polar pass corr; a Cartesian pass skips the polar in-plane statistics, whose fields an earlier polar pass leaves in the project and which the first beta-gal run below printed), ori/simple_ori_tester.f90 (N18), project/simple_binoris_tester.f90 (N17), simple_commanders_test_class.f90 and simple_test_ui_class.f90 (sub-suites pose strategy and pose statistics on the new testers, pose refiner and pose adapter removed, lib suite on the moved tester); this file (8.3 row, 6.3 "As built in Phase 7", this row, checkpoint 5). Decisions: the strategy finds its slot by particle index as the polar calculator does (pinds), so the matcher's loop needs no Cartesian argument; corr_cart is the calculator's score of the final objective of the transaction (the seed objective after a rejection; 0 with the flag 0 for an invalid slot); the polish stops in refine3D_strategy because the 8.3 table gives Phase 7 no parameters file; refine_pose and the stage solvers stay public (checkpoint 5). Tests: unit_cart_align3D 5 groups PASS, 600 checks (scratch/runs/p7_unit/out.log): pose strategy 29 checks 0.11 s (seed contract of E19; N15 through a class(strategy3D) pointer, twice, build%pftc never constructed, identity seed refined, state-zero rejected; N16 under cc and euclid: accepted commits pose, corr_cart = score of the objective evaluated in the test, flag and motion fields, rejected (seed at the noise-free optimum) leaves the pose bit-identical with corr_cart at the seed, corr unchanged, the sigma owner holds a residual under euclid; N27 team of three = serial bit for bit), pose statistics 8 checks (N19); unit_ori orientation 230/230 (N18), unit_project binoris 972/972 (N17) (scratch/runs/p7u/). E21 retired with the stats module; the refiner and adapter testers deleted (their checks run in the calculator and optimizer testers since Phases 2-6). E25 through strategy3D_cont (Release, 8 threads): PASS 47/47, 30.9 s, metrics those of Phase 6 within the run-to-run variation (cc 8 A median 0.188 deg, basin 0.9910, map 0.97246; euclid 8 A 0.199 (Phase 6 0.198), 4 A below 8 A for both) (scratch/logs/lib_cart_align3D_p7c_release.log; the first log _p7_release.log was written by two concurrent runs, see below). Finding: E25 is not bit-reproducible across threaded runs (the 4 A lines differ in the third decimal); serial runs are bit-identical (scratch/logs/e25det_t1{a,b}.log, 200 s), and an instrumented run (temporary, source restored) shows the objective at the seed and at the truth pose differing at 1e-8 for every particle before any refinement, so the fixture inputs (the threaded simulator, nthr = workers) differ, not the strategy; every run of the six passes the floors (scratch/logs/e25det_*.log, e25probe_*.log). Polar guards (Release, once, R3; the first round collided with a second copy of the driver that outlived its kill, so 1jxy and 6vxx were rerun at once): simulated_workflow_1jxy PASS 0.7990, FSC 20.80 / 10.40 A, _6vxx PASS 0.8750, 6.09 / 5.43 A (heavy load, scratch/logs/*_p7b.log), abinitio3D_addon 13 gate checks PASS (_p7.log); the Pearson values below the Phase 0 range, so the polar path was checked unchanged (whitespace-blind diff against the Phase 6 matcher rebuilt from review/full_after_6.diff: only Cartesian and polish lines differ) and one confirmation run each: 1jxy 0.8175, FSC 14.68 / 8.61 A; 6vxx 0.8895, 5.55 / 4.99 A; addon all PASS, cohort_pose_error_excess_deg 0.514, union_truth_fsc0143_A 4.928, union_map_truth_corr 0.94492, cohort_frozen_pair_pose_error_deg 4.616, inside or at the edge of the Phase 0 spread, as in Phases 5 and 6 (scratch/logs/*_p7c.log). Beta-gal Release: refine=pose_cont nparts=2 NORMAL STOP, 5 513 attempts, 100 % improved, DIST mean 0.414 deg and FSC 0.143 3.80 A as in Phase 6, SCORE now the mean corr_cart (exp(-L)) 0.380; the written project keeps corr bit-identical to its input and carries corr_cart and the flag (scratch/logs/bgal_p7_posecont_distr.log); pose_cont=yes stops at once with the Phase 9 message (bgal_p7_polish_rejected.log). Exit: the matcher's only continuous-pose symbol is strategy3D_cont, no select type (grep); ordinary refinement baselines reproduce (guards above). Build and gate: ./compile_debug.sh no Fortran warnings, 13/13, 3.6 s (scratch/logs/compile_debug_p7_final.log). Checks: git diff --check, check_test_registry, check_descr, no new multiline THROW, fence check 7 (23 files); stale scan of src, production, .github empty for the deleted modules, pose_cont_attempted, prepare_pose_cont_observation, aggregate_pose_cont_stats_files; the generated doc/code_overview/fortran-indexes/* and four notes still name them (Phase 10). Review checkpoint 5 (matcher contents and the O8 record layout): recorded below, not waited for (14.1). Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-01 Phase 8 - (working tree, no commit; review/phase_8.diff) Changed: params/simple_parameters.f90, _parse.f90, _phases.f90 (pose_cont no yes
2026-10-01 Phase 9 - (working tree, no commit; review/phase_9.diff) Changed: strategies/parallelization/simple_refine3D_strategy.f90 (check_polish_request replaces reject_matcher_polish; polish_follows; the polish pass after every discrete pass in shared memory, with params_polish, and distributed, as a second job round; the discrete pass writes no partial reconstructions when a polish follows), params/simple_parameters.f90 and _phases.f90 (l_cont_polish: refine=cont with pose_cont=yes, the Phase 8 rejection of the pair moved to the strategy's command-line check), strategies/search/simple_strategy3D_cont.f90 (the polish keeps the discrete convergence fields) and tester (N22, N23), simple_strategy3D_matcher.f90 (a polish pass draws sample4update_reprod and leaves frac_greedy), simple_convergence.f90 (calc_polish_stats, the polish's attempts and improved fraction beside a discrete pass's statistics; calc_pass_scores uses it) and tester, commanders/simple/simple_commanders_refine3D.f90 (refine3D_auto pose_cont=yes to the main loop only), commanders/test/simple_commanders_test_highlevel.f90 (N20 stages f and g; sym_pose_error takes a particle mask), commanders/test/simple_commanders_test_single.f90 (N29 pose_cont=yes stage); this file (8.3 rows extended with Phase 9 for the strategy, the matcher, convergence and its tester, parameters, the refine3D commanders; N20 "As built in Phase 9" with the floors of f and g declared before their first run; the N29 row; 6.5 note; this row; checkpoint 7). Decisions: the polish pass is named by refine=cont pose_cont=yes, so the workers need no new key (the strategy refuses the pair on its own command line); in shared memory the polish rebuilds the toolbox from the project the discrete pass leaves on disk, into parameters the strategy owns; sigma2 is prepared again before the polish, whose contributions are the iteration's (euclid); the polish runs in the main loop of refine3D_auto only, not in its registration pass, pose initialization or bootstraps; stage g is compared with stage h's polar run, the like-for-like run without the polish (the table names stage f, a refine3D against the truth map). Tests: unit_cart_align3D 5 groups PASS, 634 checks (pose strategy 40 with N22 and N23, pose statistics 35 with the polish statistics; scratch/runs/p9u/log_cart.txt). N20 cont_refine3D_1jxy (Release, CTest) PASS, 15:12 wall beside the two other jobs, peak RSS 9.18 GB (scratch/logs/cont_refine3D_1jxy_p9.log): f symmetry-aware error over the 600 updated particles 0.902 deg without the polish, 0.629 deg with it (floor 1.002); the polish refined exactly the sample; the discrete iteration after a polish scored finite (mean corr 0.629); one assembly per iteration, 300 polish attempts per iteration; g 0.222 deg against h's polar 1.516 (floor 1.616), attempts equal to the sample, every particle polished, one assembly per main-loop iteration, the reported motion the discrete search's; a-e and h as in Phase 8 (h continuation 0.297). N29 single_workflow PASS: refine3D_nano pose_cont=no 45.759 deg, pose_cont=yes 45.832 deg (margin 0.5) (scratch/logs/single_workflow_p9.log). Beta-gal Release, refine3D_auto pose_cont=yes nparts=2 (one run, R3): completed, 27:44 wall, peak RSS 10.84 GB (Phase 0 polar 18:25, 10.74 GB); main-loop iterations 2-4 ran a discrete job round (36, 32, 27 s) and a polish round (130, 115, 100 s) over the 5 513 particles, all accepted; the convergence lines carry the discrete motion (0.408, 0.409, 0.398 deg; 0.065, 0.044, 0.039 px) and the run converged by the discrete rule; one assembly per iteration (scratch/logs/bgal_p9_auto_polish.log). Exit: with pose_cont=no every baseline reproduces (the path is the Phase 8 one when polish_follows is false; N20 a-e and h unchanged, f without the polish, fast gate); with pose_cont=yes the pose error against the simulation truth is no worse than without it (f 0.629 against 0.902, g 0.222 against h's 1.516, N29 within its margin), and a discrete iteration that follows a polish runs unaffected (f: finite scores; g and beta-gal: the following discrete iterations ran and converged by their own rule). Build and gate: ./compile_debug.sh no Fortran warnings, 13/13, 2.7 s, unit_cart_align3D 0.78 s (scratch/logs/compile_debug_p9.log). Checks: git diff --check, check_test_registry, check_descr, no new multiline THROW, fence check 9 (12 files); stale scan empty for reject_matcher_polish. Review checkpoint 7 (polish scheduling, reconstruction and convergence-field handling): recorded below. Paths under /home/elmlundho/pose_cont_autorun Done (the sigma2 preparation before the polish withdrawn at review, 2026-10-02)
2026-10-01 Phase 10 - (working tree, no commit; review/phase_10.diff) Changed: doc/policies/3D/refine3D_policy.md ("Continuous Cartesian pose policy" under section 8: mode, ownership, references, preparation, objectives, bounds, scores, convergence, polish, tests), doc/policies/3D/refine3D_auto_policy.md (section 7 pose_cont=no|yes|only; the refine default noted as derived), doc/policies/test_environment_policy.md (the label table, 11 high-level gates; the process budget 30; the unit_cart_align3D sub-suites of 1.1; lib_cart_align3D and the new cont_refine3D_1jxy in 1.2; the two pose_cont rows of "Where is my test now?"), and, added to 8.3 for this phase, doc/implementation_notes/continuous_3D_pose_cont_refine3D.md and continuous_3D_pose_end_polishing.md (a superseded-by note at the top; the notes stay as the record of the earlier design) and continuous_3D_refinement_on_pcg_operator.md (its one sentence naming the removed refiner); this file (header status, R5 as amended in 10.1, 8.3 row, this row), moved to doc/refactoring_notes/completed/ with mv. Ruling applied: R5 as amended (first recorded here): the FSC counts above 2 000 particles, so the beta-gal half-map FSC of the runs of Phases 7-9, taken from their logs without a rerun, is compared with Phase 0: refine3D_auto pose_cont=only final map FSC 0.5/0.143 4.03/3.51 A and pose_cont=yes 4.08/3.51 A against the Phase 0 polar refine3D_auto 4.08/3.55 A (density-masked final maps, the same definition); the single Cartesian refine3D pass 4.35/3.80 A (Phase 7) against 4.35/3.75 A (Phase 0 posecont_stj, half-map of the iteration; a shell at 3.75-3.80 A) (scratch/logs/bgal_p8_auto_only.log, bgal_p9_auto_polish.log, bgal_p7_posecont_distr.log). Deviation, by the maintainer's instruction for this phase: doc/code_overview/fortran-indexes are not regenerated here (they carry the absolute paths of the maintainer's checkout); they still list the removed modules and the maintainer regenerates them at review. Tests: SIMPLE_UNIT_ORDER=reverse simple_test_exec test=unit_cart_align3D PASS, 634 checks, every sub-suite under a second (calculator 0.59 s) (scratch/runs/p10/reverse.log); ./compile_debug.sh 13/13, 2.7 s, unit_cart_align3D 0.78 s (scratch/logs/compile_debug_p10.log). Exit: the stale-symbol scan (pose_cont_refine3D_adapter, pose_cont_run_stats, strategy3D_pose_cont, cartesian_pose_refiner, pose_cont_mode, pose_cont_route, refine3D_pose_cont, and refine=pose_cont) is empty in src, production, scripts, .github and the policies, except the UI visibility tester, which asserts their absence, and the old test name pose_cont_refine3D_adapter as the lookup key of "Where is my test now?"; outside them it finds the indexes (regenerated at review), the superseded implementation notes (marked), this file and the completed and rejected refactoring records, which are history and are not rewritten; this file is in doc/refactoring_notes/completed/. Checks: git diff --check, check_test_registry (29 selectors, 32 programs), check_descr, fence check 10 (7 files). The report for the review is /home/elmlundho/pose_cont_autorun/review/REPORT.md (the run's file fence refuses the run root, where the report was requested). Paths under /home/elmlundho/pose_cont_autorun Done
2026-10-02 Review - (Mac checkout, uncommitted) Polish sigma2 fallback: the polish pass no longer opens a second sigma2 transaction (simple_refine3D_strategy.f90, shared memory and distributed); it starts from the discrete pass's range of the open transaction (euclid_sigma2%read_pending_range, called by prep_sigmas_objfun when l_cont_polish), so a particle whose Cartesian slot is invalid keeps the residual of its discrete pose instead of the previous generation's (N30); its range replaces the discrete pass's through a staged file and an atomic rename (a range file is created only once otherwise). Interchangeability of polar and Cartesian sigma2 beyond flat spectra: N31 (signal-bearing parity) and N32 (canonical round trip, Cartesian write and polar reload). Exact-zero policy (maintainer): the reducer's rule stands, a record with any non-positive or non-finite shell is excluded from the groups and stays in the particle rows; any positive record counts. A numerically exact Cartesian match gives zero only up to rounding (N13). refine3D_policy.md polish paragraph updated Written; build and run by the maintainer
2026-10-02 Ruling - (Mac checkout, uncommitted) O6 revised (section 4): athres_cont (default 10 degrees) bounds the total rotation of a Cartesian solve from its seed; declared in simple_parameters.f90, parsed, validated in (0, 180] for a Cartesian pass (simple_parameters_phases.f90), read by strategy3D_cont for cartft_pose_opt (its dummy renamed rotation_bound), offered on refine3D and refine3D_auto (UI, advanced), reaching the refine3D child and distributed workers with the command line. Tests: E25 and N20 set athres_cont 15 (was athres); the strategy fixture sets the polar athres to 0.5 degrees so that test_commit_contract recovers its 1.8 degree seed error only if the solve ignores it, and test_rotation_bound pins the bound itself (0.5 degrees); N21 checks that both programs offer athres_cont. refine3D_policy.md updated Written; build and run by the maintainer
2026-10-02 Ruling - (Mac checkout, uncommitted) C16 revised (section 4): the joint LM stage alone in production. cartft_pose_opt: shift_first policy (default off, optional in new), the shift-only stage only on that route; internal cont_route (simple_parameters*.f90: declared, parsed, validated, derived l_cont_shift_first) read by strategy3D_cont. E25 and N20 a-c run cont_route=shift_then_joint (floors unchanged); N20 e-h, the polish and every production pass run joint. E16 checks both routes' stage records (the default runs no shift stage and commits from the seed); E17, N2, N7 and the bound tests now run the production route. refine3D_policy.md updated Written; build and run by the maintainer
2026-10-03 Review - (Mac checkout, uncommitted) N31 failed twice at low k on the residual of a noise-free particle whose 14 px mask cut it. Diagnosis: the noise variance does not depend on the representation; a ring and an annulus sample a structured residual differently, and a noise-free residual is all structure. A second sigma2 state per representation was considered and withdrawn (one noise model per particle; the store and reducer stay as they are). N31 now gates the model power (amplitude and CTF handling), with the residual printed; N33 (new, test_polar_sigma_group) gates the group sigma2 of 16 noisy particles against the standard error of a group mean. simple_cartft_calc_tester.f90 Written; build and run by the maintainer

Phase 0 baseline

Recorded 2026-09-30 22:18 to 2026-10-01 01:09 on the Dell (Oracle Linux 8.10, Core Ultra 9 285, 24 cores, 62 GB, gfortran 15.2.1 of gcc-toolset-15, CMake 3.26.5). Source: base HEAD 714a15a99 plus the plan edits of the launch and the Phase 0 print lines in simple_pose_cont_1jyx_tester.f90; no production source differs from the base. The machine ran nothing but this phase; every job ran alone in a serial queue (scratch/queue.sh, scratch/queue2.sh, start and end with the load average in scratch/queue.log). The load was that job's own threads: the 1-min load at the end of a job was 7.8 to 8.4 for lib_cart_align3D, 2.9 to 7.9 for the high-level entries (several of their stages run fewer threads) and 6.0 to 10.4 for the beta-gal runs. The fast-gate reruns ran on the idle machine (load 2.2 falling). All paths below are under /home/elmlundho/pose_cont_autorun.

Builds:

  • Debug, ./compile_debug.sh into repo/build (35 s wall, make -j, fast gate included). Used for the fast gate, unit_cart_align3D and lib_cart_align3D.
  • Release, out of tree: cmake -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release repo in scratch/build_release, make -j4, make install into itself (3 min 44 s). Used for the three high-level entries and the beta-gal runs. It writes nothing into the source tree. Later phases build it the same way for the comparisons of section 10.5.

Fast gate (build/test_runs/ctest_fast.log.timing.txt; three runs: the build-time gate and two reruns at the end, scratch/runs/fast_gate_build0/, scratch/logs/fast_gate_run{2,3}.timing.txt). All 13 entries pass in all runs; total real time 3.3 s in each (budget 30 s), 10.2 proc-s.

Entry s (run 1 / 2 / 3)
unit_heterogeneity 3.30 / 3.29 / 3.33
unit_pftc_align2D3D 2.25 / 2.22 / 2.00
unit_ori 1.49 / 1.49 / 1.23
unit_image 1.19 / 1.18 / 0.95
unit_project 1.08 / 0.86 / 0.89
unit_numerics 0.18 / 0.15 / 0.14
unit_cart_align3D 0.16 / 0.13 / 0.13
unit_ui 0.12 / 0.11 / 0.10
unit_core 0.10 / 0.09 / 0.08
unit_reconstruction 0.10 / 0.10 / 0.10
unit_single 0.08 / 0.11 / 0.11
unit_ipc 0.07 / 0.05 / 0.05
unit_parallel 0.05 / 0.04 / 0.03

unit_cart_align3D: PASS, 6 groups, 518 assertions (reports scratch/runs/fast_gate_build0/unit_cart_align3D/, scratch/logs/unit_cart_align3D_run3.report.txt).

Sub-suite Assertions s (build gate / rerun)
Cartesian Fourier 370 0.02 / 0.01
pose refiner 48 0.08 / 0.07
pose adapter 45 0.03 / 0.02
pose strategy 14 0.01 / 0.01
pose statistics 17 0.00 / 0.00
pose workflow 24 0.01 / 0.01

lib_cart_align3D (E25, Debug, OMP_NUM_THREADS=8, route shift_then_joint, the refiner's NCC objective): four runs, PASS (7 assertions), every printed metric bit-identical across the runs, so the spread is zero. Sub-suite pose 1JYX recovery: 145.1 s (run 1, overlapped by two 8-s two-thread trial runs), 135.7, 132.7, 132.0 s; peak RSS 1.05 GB. These are the pre-refactor values section 10.1 allows as floors with a stated margin.

Metric (5 000 particles, 15 deg and 2 px injected) Before After
Rotation error RMS / median (deg) 15.000 / 15.000 1.774 / 0.196
Shift error RMS / median (px) 2.000 / 2.000 0.248 / 0.050
Fraction with lower rotation / shift error - 0.9864 / 0.9864
Fraction within the basin width lp/(mskdiam/2) = 7.639 deg 0.0000 0.9864
Mean objective (1 - NCC) 4.4635E-01 5.3728E-02
Accepted (status 1) / step-bound rejected (status 4) - 4 933 / 67 of 5 000
Map against the truth Exact poses Perturbed Refined
Correlation 0.98316 0.84102 0.98256
FSC 0.5 / 0.143 (A) 3.120 / 2.674 23.400 / 13.371 3.120 / 2.674

The 67 rejected particles keep their 15 degree seed; they are the RMS tail.

At 1 000 particles (ruling R2, 2026-10-01; measured in Phase 3 on the pre-refactor code: base 714a15a99 with review/phase_0.diff and TEST_PARTICLES = 1000, Release, OMP_NUM_THREADS=8, 7 s wall; scratch/logs/lib_cart_align3D_p0_1000.log): accepted 987 / 1 000 (13 step-bound rejected); rotation RMS / median 1.728 / 0.194 deg; shift RMS / median 0.237 / 0.052 px; fraction within the basin width 0.9870; mean objective 4.4984E-01 to 5.3705E-02; map correlation exact / perturbed / refined 0.96971 / 0.82194 / 0.96888, FSC 0.143 2.880 / 15.600 / 2.971 A. These are the E25 floors (F3) from Phase 3 on.

High-level entries (Release, three runs each, all PASS, 8 threads). Truth metrics from the log (validate_reconstructed_volume) for the simulated workflows; abinitio3D_addon removes its fixture, metrics.tsv included, when it passes, so its metrics are the gate lines of the log, which carry the same values. The spread is the range over the three runs.

simulated_workflow_1jxy R1 R2 R3 Range
Registered Pearson correlation (min 0.2) 0.8215 0.8159 0.8074 0.8074-0.8215
Masked truth FSC 0.5 (A) 13.14 13.87 14.68 13.14-14.68
Masked truth FSC 0.143 (A, max 40) 7.13 7.34 7.34 7.13-7.34
Docking correlation direct / mirrored 0.9655 / 0.8762 0.9611 / 0.8780 0.9551 / 0.8815
Wall (min:s) / peak RSS (GB) 8:21 / 2.24 8:33 / 2.23 8:12 / 2.28
simulated_workflow_6vxx R1 R2 R3 Range
Registered Pearson correlation (min 0.2) 0.8823 0.8819 0.8806 0.8806-0.8823
Masked truth FSC 0.5 (A) 6.24 5.67 5.67 5.67-6.24
Masked truth FSC 0.143 (A, max 40) 5.94 5.09 4.89 4.89-5.94
Docking correlation direct / mirrored 0.8364 / 0.9881 0.8377 / 0.9888 0.9884 / 0.8480 hand varies by run
Wall (min:s) / peak RSS (GB) 12:50 / 2.42 14:00 / 2.42 12:32 / 2.42
abinitio3D_addon gate metric (floor) R1 R2 R3
union_map_truth_corr (0.90) 0.94753 0.94791 0.94655
base_map_truth_corr 0.94632 0.94733 0.94591
union_minus_base_corr (-0.03) 0.00121 0.00058 0.00064
union_truth_fsc0143_A (6.03) 4.738 4.831 4.928
base_truth_fsc0143_A 5.029 4.928 5.029
cohort_frozen_pair_pose_error_deg (15) 4.588 7.373 9.829
frozen_frozen_pair_pose_error_deg 4.282 5.808 8.068
cohort_pose_error_excess_deg (5) 0.306 1.565 1.761
cohort_frozen_pairs_within_5deg 0.5116 0.4634 0.4411
frozen_frozen_pairs_within_5deg 0.5215 0.4838 0.4568
cohort_coverage (0.90) 1.0 1.0 1.0
addon_report_union_base_corr (0.90) 0.99902 0.99906 0.99904
addon_report_cohort_base_fsc0143_A 5.730 5.867 5.867
addon_report_dshell0143 3 3 3
Wall (min:s) / peak RSS (GB) 13:53 / 1.35 13:48 / 1.37 13:24 / 1.37

All 13 pass/fail checks of the addon gate pass in every run.

Debug runs of the high-level entries (first queue, scratch/logs/*_r1.log): simulated_workflow_1jxy and _6vxx stop in abinitio3D with "Index '3' of dimension 1 of array 'res' outside of expected range (1:1)" at simple_abinitio_utils.f90:509 (calc_lplim_final_stage(3); 68 and 82 particles, ncls=4 requested, the 2D stage ends with one class). The same failure was recorded on the base tree of this machine on 2026-09-30 (/data2/tmp_simple_verify/runs/progress_history.md, 09:01 and 10:14), and the file is outside this plan, so it is a property of the base, not of the refactoring. The Debug abinitio3D_addon run was stopped by hand after six minutes as redundant with the Release set. Hence the build rule of 10.5.

Beta-gal (Release, shared memory, 12 threads; refine3D refine3D_auto: nparts=2 nthr=6). Source: a copy of /data2/bgal_addon/5_abinitio3D (the abinitio3D control on all 5 513 particles, box 256, 1.275 A, pgrp=d2, mskdiam=180; stack /data/bgal/DAT/sumstack.mrc), copied with recvol_state01{,_even,_odd}.mrc into one fresh directory per run by scratch/bgal/run_bgal.sh. The refine3D runs: prg=refine3D mkdir=no vol1=recvol_state01.mrc mskdiam=180 pgrp=d2 objfun=euclid inpl_cont=no maxits=1 nthr=12 plus the mode. sigma2_state.bin was not copied, so every run rebuilt sigma2 at the start (SIGMA2 INIT: rebuilding), the same for all. refine3D_auto ran with defaults from the project volume (4 iterations for about 4 updates per particle, full updates, the registration pass refine=greedy and three prob_neigh iterations). probneigh_ctrl is an added control: the discrete iteration of the polish runs without the polish.

Run Mode Wall (min:s) Peak RSS (GB) FSC 0.5 / 0.143 (A) cFAR FSC at 4.0 A Mean FSC 8 A-Nyquist
posecont_stj refine=pose_cont pose_cont_route=shift_then_joint 3:34 2.53 4.35 / 3.75 0.5008 0.250 0.3296
posecont_joint refine=pose_cont pose_cont_route=joint 2:29 2.53 4.35 / 3.75 0.5012 0.252 0.3299
polish_stj refine=prob_neigh pose_cont=yes pose_cont_route=shift_then_joint 5:54 21.57 4.35 / 3.75 0.5072 0.248 0.3286
polish_joint refine=prob_neigh pose_cont=yes pose_cont_route=joint 5:14 21.57 4.35 / 3.75 0.5102 0.250 0.3287
probneigh_ctrl refine=prob_neigh pose_cont=no 2:31 21.57 4.35 / 3.75 0.5162 0.241 0.3264
refine3D_auto defaults, final map 18:25 10.74 (largest process) 4.08 / 3.55 0.5673 0.409 (iteration 1; 0.439 at iteration 4 and final) 0.4075 (iteration 1; 0.4100 at iteration 4; label corrected in Phase 1)

FSC of the refine3D runs is the half-map FSC of the iteration's reconstruction (RESOLUTION_STATE01_ITER001, spherical support, no post-hoc mask); 4.35 and 3.75 A are shells 75 and 87, so the finer columns are given. The refine3D_auto final FSC uses the density mask (posthoc_mask=density) and is not comparable with the single iterations. Peak RSS is /usr/bin/time -v of the run (largest process); the prob_neigh runs peak in the reconstruction master phase (20.57 GiB reported).

Run Mean orientation motion (deg, DIST BTW BEST ORIS) Mean shift motion (px, SHIFT INCR ARG) Accept fraction (improved / attempted) LM motion mean rotation (rad) / shift (px) Mean objective before / after (1 - NCC) LM iterations Transaction mean / max (s)
posecont_stj 0.479 0.143 5 513 / 5 513 9.126E-03 / 0.143 0.83301 / 0.83131 217 170 0.352 / 0.891
posecont_joint 0.486 0.134 5 513 / 5 513 9.281E-03 / 0.134 0.83301 / 0.83131 136 968 0.217 / 0.562
polish_stj 0.384 0.085 5 513 / 5 513 8.651E-03 / 0.128 0.83290 / 0.83131 213 148 0.343 / 0.980
polish_joint 0.381 0.086 5 513 / 5 513 8.799E-03 / 0.119 0.83290 / 0.83131 136 846 0.228 / 0.566
probneigh_ctrl 0.385 0.086 - - - - -
refine3D_auto iterations 1-4 0.205, 0.410, 0.354, 0.328 0.049, 0.065, 0.041, 0.033 - - - - -

Under pose_cont=yes the orientation and shift motion of the convergence lines is that of the discrete search, measured against the input pose; the LM motion columns are those of the polish alone. No particle was rejected in any run (no bound rejection, no invalid or unreliable solve). Every run declared CONVERGED: yes after its single iteration; for refine=pose_cont that is the behaviour O2 removes. The % CONTINUOUS IN-PLANE RUNS IMPROVED 64.194 line of the refine=pose_cont runs repeats the input project's cont_inpl_* fields, which a Cartesian-only pass does not write.

On LM route choice (C16, decided in Phase 8, shift_then_joint kept; see the Phase 8 row): on beta-gal both routes accept every particle and reach the same mean objective (0.83131); joint needs 37% fewer LM iterations and 38% less transaction time (2:29 against 3:34 wall for refine=pose_cont); maps agree within a shell. E25 runs only shift_then_joint.

Files each run leaves in its directory (full lists with sizes in scratch/inventories/):

  • refine=pose_cont (28 files, both routes the same): the copied inputs bgal_addon.simple, recvol_state01{,_even,_odd}.mrc (the last three overwritten by the iteration's maps); pose_cont_reference_state01_{even,odd}.mrc (67 MB each), POSE_CONT_STATS_ITER001.txt, sigma2_state.bin, fsc_state01.bin, RESOLUTION_STATE01_ITER001, CFAR_SUMMARY_ITER001.txt, simple_stats.txt, orientations_distribution_state01.jpg, recvol_state01_{even,odd}_unfil.mrc, recvol_state01_part1_{even,odd}.mrc, rho_recvol_state01_part1_{even,odd}.mrc, recvol_state01_pcg_support.txt, REFINE3D_BENCH_ITER001{,_PART1}.txt, REFINE3D_STRATEGY_BENCH_ITER001.txt, VOLASSEMBLE_BENCH_ITER001.txt, and the markers CALC_GROUP_SIGMAS_FINISHED, CALC_PSPEC_FINISHED, JOB_FINISHED_, VOLASSEMBLE_FINISHED. No polar reprojection model, no probability table.
  • pose_cont=yes (33 files): the 30 of probneigh_ctrl plus pose_cont_reference_state01_{even,odd}.mrc and POSE_CONT_STATS_ITER001.txt.
  • probneigh_ctrl (30 files): the refine=pose_cont set without the three pose_cont files, plus reprojection_model_{even,odd}.bin, assignment_part.dat, dist_part_neigh_1.dat, fft_wisdoms.dat.
  • Both the Cartesian reference volumes and the polar reprojection model survive the run in its directory.
  • refine3D_auto (90 files, in 1_refine3D_auto/): per-iteration RESOLUTION_STATE01_ITER00N, CFAR_SUMMARY_ITER00N.txt, bench files of two parts, fsc{,n,t,u}_state01.bin, RESOLUTION_FINAL_STATE01, rec_final_state01{,_lp,_pproc,_pproc_mirr}.mrc, the NU filter outputs (*_nu_filt.mrc, recvol_state01_nu_locres.mrc, nu_envmask3D_state01.mrc), automask3D_state01.mrc, reprojection_model_{even,odd}.bin, assignment_part.dat, dist_part_neigh_{1,2}.dat, metadata.json.
  • lib_cart_align3D: SIMPLE_TEST_lib_cart_align3D_<date>/ keeps molecule_centered.pdb (3 MB, written by pdb2mrc) and the report; the fixture files the tester names are removed.
  • simulated_workflow_1jxy / _6vxx: 1 191 / 1 219 files in 0_pdb2mrc, 1_reproject, 2_simulate_movies and the workflow's 1_import_movies to 7_abinitio3D; no pose_cont file; reprojection_model_{even,odd}.bin remain in 7_abinitio3D.
  • abinitio3D_addon: nothing on a pass (the fixture is removed).

Out of scope, observed: shared-memory refine3D with the default mkdir=yes, called directly, creates a nested 1_refine3D/1_refine3D at the first iteration and stops on the sigma2 state path (simple_refine3D_strategy.f90:1099), for refine=shc as for refine=pose_cont; the beta-gal runs therefore use mkdir=no. refine3D_auto requires nparts.

Phase 2 interfaces (review checkpoint 1)

Recorded, not waited for (section 14.1). The state reviewed is review/phase_2_interfaces/ (types, public signatures and doc comments, no bodies), written before any code moved behind it; the bodies then changed it only in private helpers (gather takes the reference array rather than the private reference type; ref_index and check_eval_args added).

cartft_calc (src/main/cftc/simple_cartft_calc.f90), the counterpart of polarft_calc:

Method Contract
new(nstates, box, nptcls), kill Even/odd reference slots per state and nptcls particle slots for an even box; kill is safe on a killed instance
set_ref(state, iseven, volume), ref_exists Reference from a prepared physical volume: pad by 2 in real space, transform once, no inverse envelope (C10); Phase 4's file read calls it
set_ptcl(iptcl, observed, ctfparms, sigma2, kfromto), ptcl_is_valid, get_ptcl_kfromto The refiner's particle preparation into a slot; an invalid sigma2 or empty range leaves the slot invalid (a per-particle status, not a stop); Phase 6's prepare_batch fills the slots
predict, objective_gradient, shift_normal_terms, pose_normal_terms, sigma_contribution Evaluation on (state, iseven, iptcl), calculator intent(in); objective OBJFUN_CC or OBJFUN_EUCLID per call

cartft_pose_opt (src/main/cftc/simple_cartft_pose_opt.f90), the role of pftc_shsrch_grad, one per particle search, fixed-size state only:

Method Contract
new(box, box_crop, objfun, [shift_first, maxits, rotation_scale, max_total_rotation, shift_step_bound, max_total_shift]), kill Geometry and policy; the defaults are the adapter's (shift then joint, 40 iterations per stage, 0.1 rad per proposal, 15 degrees, one and five native pixels on the cropped grid); validated once
refine(calc, iptcl, o) The transaction on an ori: seed from its matrix and native shift, state and half from its record; on acceptance only Euler angles and shift change; otherwise nothing
refine_pose(calc, state, iseven, iptcl, rotmat, shift) The same in calculator coordinates; seed in, committed pose out
refine_shift, refine_joint(..., [active, anchor_rotmat, anchor_shift]) The two LM stages alone (masks, cumulative guard)
get_status, get_objectives, get_motion, get_stage Record of the last solve; statuses CARTFT_*

Reasons, beyond those of the Phase 2 row: the particle record becomes private to the calculator (8.2) and the slots are the batch layout of 6.2, so Phase 6 adds only the batch fill; the evaluation methods are the ones the optimizer needs, so the optimizer reaches no calculator internals; the optimizer takes the calculator per call instead of a pointer to the builder, so it imports nothing above the calculator and holds no shared state; the two public objectives keep objfun's names so that Phase 3 changes definitions, not call sites. Open for the final review: whether the objective becomes a property set in new (Phase 3), whether refine_pose, the stage solvers and the optional policy arguments stay public after Phases 7 and 8.

Phase 7 matcher and record layout (review checkpoint 5)

Recorded, not waited for (section 14.1). The state reviewed is the working tree at the end of Phase 7 (review/phase_7.diff).

Matcher contents. simple_strategy3D_matcher.f90 (717 to 500 lines) imports one continuous-pose symbol, strategy3D_cont, and has no select type. Every entry of section 8.1 is gone: the strategy, stats and adapter imports, do_pose_cont_polish/do_pose_cont_strategy, the adapter and stats declarations, the seed validation, the per-thread stats and their report, the clearing of pose_cont_* fields, the init_ctrl mode validation (the strategy's new validates its policy), the downcasts, bind_context, get_result, timers and field writes, run_pose_cont_after_pftc and wall_time_seconds. What remains for a Cartesian pass is the representation switch l_cart_refine at the points where the pass owns other data:

Where Cartesian pass Polar pass
Entry read_cart_refvols (band and references, 6.6) adopt_reprojection_model_range
prepare_refs_sigmas_and_pftc no polar model; prep_sigmas_objfun; cftc%new_ptcls(batchsz_max) read_reprojection_model; prep_sigmas_objfun
memoize_refs skipped under do_prob_align = no
Batch build build_batch_particles3D (Phase 6), then cftc%set_ptcl_inds build_batch_particles3D
Strategy allocate(strategy3D_cont :: ...) the refine case table
Sigma in the strategy, under euclid calc_sigma2 on pftc with the shift increment
Teardown cftc%kill pftc%kill

The in-matcher polish (pose_cont=yes) stops in refine3D_strategy (reject_matcher_polish) until Phase 9 schedules it; a beta-gal run with pose_cont=yes stops in 7.8 s with that message (scratch/logs/bgal_p7_polish_rejected.log).

Record layout of O8, as recommended: the particle record stays 52 reals; slot 42 (I_CC_NONPEAK, unused) is left alone; slot 51 is I_CORR_CART, flag corr_cart, the score of the last Cartesian pass (cc or exp(-L)); slot 52 is I_POSE_CONT_IMPROVED, flag pose_cont_improved, 1 when the last Cartesian pass improved the pose. pose_cont_attempted is gone: a Cartesian pass attempts every particle it samples, so simple_convergence counts the attempts as the sampled particles of positive state and the improved percentage from the flag among them, and reports the score of a Cartesian pass as the mean corr_cart over them, of a polar pass as the mean corr (calc_pass_scores). The binoris reader needs no change: a record narrower than the header width reads its missing slots as zero (N17); the beta-gal project written by the Cartesian pass carries corr bit-identical to its input and corr_cart and the flag set.

Answer to the question left open at checkpoint 1: refine_pose, the stage solvers and the optional policy arguments of cartft_pose_opt stay public for now; strategy3D_cont uses refine only, the optimizer tester uses the stage solvers and refine_pose, and E25 now runs through the strategy. Phase 8 or the final review may narrow them.

Phase 8 surface and the refine3D_auto switch (review checkpoint 6)

Recorded, not waited for (section 14.1). The state reviewed is the working tree at the end of Phase 8 (review/phase_8.diff).

User-facing surface (section 6.5, O7 (b) adopted):

Program Key Values Notes
refine3D refine ..., prob_neigh, cont cont replaces pose_cont; l_cart_refine is refine=cont
refine3D pose_cont yes, no yes stops until Phase 9 schedules the polish
refine3D_nano refine ..., prob_neigh, cont its own list (8.3 row added)
refine3D_auto pose_cont no, yes, only refine is derived and rejected on the command line, as refine3D_states rejects multivol_mode; yes stops until Phase 9
all pose_cont_route removed the generated argument table drops it with the declaration

N21 pins the table (UI visibility, 281 checks with the suite). Parameter validation under refine=cont and the seed check are described in 6.5 ("As built in Phase 8").

Stage bypass of refine3D_auto pose_cont=only (section 7.1): rejected with it are an explicit ref_pose_init=cc and regpass=yes; set are regpass=no and refine=cont; at entry check_cont_seeds on ptcl3D, before the sampling, the startup volume and the sigma bootstrap; unchanged are the sampling (set_refine3D_auto_sampling), the sigma bootstrap, the startup reconstruct3D, the NU low-pass seeding and calc_final_rec; the main loop runs refine=cont with no projection grid. The iteration strategy needs no mode branch for the bypass (no prob_align for a non-probabilistic mode, no polar model under l_cart_refine since Phase 4); its one Cartesian branch writes the matcher's sample to the project before a shared-memory assembly (trailing reconstruction reads it from the file; a polar non-probabilistic mode with trailing reconstruction in shared memory reads the previous iteration's sample there, a pre-existing behaviour outside this plan, noted for the maintainer). Evidence: N20 stage e (iteration 4 of 4, 50% sampled, no polar file, no projection direction reassigned) and the beta-gal run of the Phase 8 row (no refine=sigma pass ran in its final reconstruction, which reused the committed sigmas).

LM route (C16): shift_then_joint is kept and becomes the optimizer's only route; shift_first is gone from cartft_pose_opt%new. The step and iteration caps stay optional arguments of new as tester seams; production passes none, so they act as the private constants C16 asks for.

Phase 9 polish scheduling (review checkpoint 7)

Recorded, not waited for (section 14.1). The state reviewed is the working tree at the end of Phase 9 (review/phase_9.diff).

Scheduling. pose_cont=yes in a discrete mode (polish_follows: not refine=cont, not eval or sigma) makes simple_refine3D_strategy follow the discrete pass of every iteration with a refine=cont pass: - shared memory: the discrete refine3D_exec writes no partial reconstructions; the strategy writes the field to the project, rebuilds the toolbox from the iteration's command line with refine=cont pose_cont=yes into a parameters object it owns (params_polish, so no pointer of the rebuilt toolbox outlives it), prepares the sigma2 update again under euclid, runs refine3D_exec with the partial reconstructions, and writes the polished field before the assembly; - distributed: the discrete job round runs with volrec=no, the merged alignment documents go to the project, and a second job round with refine=cont pose_cont=yes writes the partial reconstructions and the sigma2 contributions, then is merged. refine=cont with pose_cont=yes is the internal name of that pass (params%l_cont_polish); check_polish_request refuses it on the command line of refine3D, and refuses pose_cont=yes with objfun_den=yes (C21). refine3D_auto pose_cont=yes passes the switch to its main loop only; the registration pass, the pose initialization and the bootstraps run without it (C19 names the main loop).

Particle sample. The polish matcher draws sample4update_reprod (the sample the discrete pass drew or prob_align wrote), which counts no update. N20 stage f shows the polish refining exactly the 30% sample and nothing else.

Reconstruction. One per iteration, from the polished poses: N20 f and g, and beta-gal, show one assembly per iteration in the logs.

Convergence fields. The polish commits the pose, corr_cart, the improved flag and, under euclid, the sigma2 contribution; it leaves corr, dist, dist_inpl, shincarg, mi_proj, mi_state, frac and frac_greedy of the discrete search (N23; the matcher skips frac_greedy), so the main-loop rule still measures the discrete search: on beta-gal it declared convergence from the discrete motion, and its log shows the polish's attempts and improved fraction beside it (calc_polish_stats).