The atomicity prior on the PCG backend: open work¶
Status (updated 2026-10-25): the prior works inside reconstruct3D, and autorefine3D_nano
can bootstrap it from each round's detect_atoms model. It is not yet used by refine_tomo or
standalone refine3D_nano. Design, rationale, the rules every prior obeys, and the
record of what was built are in
../completed/single_pcg_integration_completed.md
(read its sections 3 to 6 for the maths and section 11 for the implementation choices).
Terms. PCG is the preconditioned conjugate-gradient reconstruction backend. The atomicity prior
models the map as x = G c + e, where each column of G is the density kernel of one atom at its
model position, c are free per-atom amplitudes, and only e is penalized, with strength
lambda_A times x^T (I - P_G) x (P_G projects onto the span of the atom kernels). AET is atomic
electron tomography. refine_tomo is the SINGLE tilt-series workflow. SINGLE is the nanoparticle
workflow of SIMPLE. A "held-out" check predicts the images or tilts that a map was not built from.
The learning so far. On FePt (68 tilts) with refined poses, the prior beats the prior-free map on atom recall (0.44 against 0.42 at best prior-free), surface recall (0.18 against 0.14) and atom roundness (elongation 1.80 against 2.07), but it only matches, not beats, the prior-free map on held-out tilt prediction (0.0862 against 0.0852 at its best iteration count). The estimated strength was within 1 percent of the best on the grid. Per-atom amplitudes fitted to the data separated atoms from false peaks and Fe from Pt in a numpy prototype; that is not yet in the program.
1. What is implemented (do not redo)¶
reconstruct3D atm_prior=yes pdbfile= [lambda_atm= bfac_data= maxits_atm= rtol_atm=] with
rec_backend=pcg: the module src/main/volume/simple_pcg_atomic_prior.f90, the operator and
preconditioner hooks in simple_reconstructor_pcg.f90, the plumbing in
simple_rec3D_pcg_strategy.f90, and the atomic_prior sub-suite of unit_reconstruction.
Choices fixed there: one Gaussian kernel for all species, B = B_min + B_data; the width fit uses
its own 1.5-voxel, 5-sigma model; the strength estimate uses the half-map noise; Jacobi-PCG Gram
solve in double precision with a ridge of 1e-7 of each diagonal entry; 30 iterations by default;
the prior'd halves are never a noise reference (use the prior-free _base halves).
2. Open work¶
refine_tomointegration (first, because AET is the first target). Version 1 changes only the final reconstruction: (1) the masked PCG base map from the refined poses, as now; (2)detect_atomson it, in process, with the element list, giving the model including atoms recovered from the residual (the model errs toward inclusion: a spurious kernel costs little, a missing one pulls a real atom to zero); (3)B_data, the Gram matrix andlambda_Afrom the base map; (4) the regularized solve per half. Products:tomo_final.mrc(regularized),tomo_final_base.mrc,tomo_final_res.mrc(base map minusG c), and a sidecar_atmprior.txt(B_data,N,S,C^2,lambda_A,rel,N_atoms, CG statistics). Residual peaks above3 sqrt(N)are missing-atom candidates; atoms withc_ifar below their species' median are removal candidates. Using the regularized map as the pose-refinement reference waits until the drift found on 2026-10-15 is understood. Files:single_commanders_tomo.f90, the strategy above.- The held-out scan inside the program (
atm_cv). A new parameter. For a tilt series each half's regularized map predicts the other half's tilts; for particles it predicts the other half's images. Score the prediction error over the run's band on the grid{0, 1/4, 1/2, 1, 2, 4} x lambda_A,rel. This is how the estimate is checked, never by the FSC of prior'd halves. - The TEM kernel. The five-Gaussian electron scattering factor of each element, broadened by
B_i = B_min + B_data, asatoms%convolveuses. Makeatoms%convolve's per-element tables a kernel builder shared by the simulator and the prior. The prior currently uses one Gaussian for all species, which suits annular dark-field STEM (AET) but not TEM data (SINGLE). - SINGLE particles, partly implemented.
autorefine3D_nano atm_prior=yes rec_backend=pcgnow runs stage 1 prior-free, builds a model withdetect_atoms, and passes that PDB to the next stage's atomic-prior reconstruction. The published map is the regularized solve; resolution, the next atom detection, and species discovery use the prior-free_basepair. Every stage retains_base,_res, and_atmprior.txtbeside the existing products. The loop is agnostic to the atomic species (ruling of 2026-10-26):autorefine3D_nanotakes noelementand no species key, each round'sdetect_atomsruns species-free, and the next prior uses_ATMS.pdbwith its per-atom table_atoms.csv(the density model of../completed/atomic_density_model.md: every strong and weak atom with its fitted intensity and width); the model products are retained per round. The prior takes from that table the positions and the per-atom widths (BFAC) and leaves every amplitude free: its unpenalized subspace is the span of the atom kernels, each at its own width (ruling 4 of../completed/atomic_density_model.md, 2026-10-26; the one-scale form pinned every atom's intensity to the last round's fit of an incomplete model). Species are called afterwards on the final model. A PDB without a per-atom table (a model from elsewhere) keeps the position-only, free-amplitude prior at one fitted width;_species.pdbwith_species.csv(a species-posterior intensity) gives a standalonereconstruct3D atm_prior=yesthe fitted-model form, whose one-dimensional subspace leaves only the global scale free. Species-dependent TEM kernels still need item 3. Standalonerefine3D_nano, the fullsingle_workflowacceptance trajectory and the held-out image check remain open. Thefcccase ofsingle_workflowruns the loop withmaxits_atm=2and checks the products exist. - Per-atom amplitudes for species discovery. Write the data-fitted amplitude
c = argmin || A G c - b ||^2(solvesG^T H G c = G^T rwith the reconstructor's normal operator, by a small CG in atom space) and letdiscover_speciesuse it instead of the aperture sum on the filtered map, which underestimates the Pt/Ni ratio by 23 percent and Pt/Al by 43 percent on the synthetic particles. The amplitude measured on the map,(G^T G)^-1 G^T x, does not work (numpy prototype); do not use it. Seespecies_discovery_unfinished.md. - Acceptance runs of the design not recorded as done. See section 3.
- Later, not now: a smooth B field (not free per-atom B); a per-atom trust weight if surface or low-Z atoms fail the hard inclusion; non-negative amplitudes; the prior inside the pose-refinement references.
- Site visit demonstration. The unsupervised pipeline run on the 2020/2021 SINGLE data sets, models compared with the curated ones. Needs items 3, 4, 5 and the image hold-out run of item 2.
3. Acceptance checks still to run¶
Written down before the runs, from the design:
- Synthetic tilt series (the atomic phantom of the PCG sparse-sampling test, sparse and dense
tilt range). With the true model: rounder atoms and a cleaner background than prior-free at the
same detection. With a damaged model (10 percent of atoms removed, half of them surface atoms;
10 percent spurious added; positions jittered 0.2 Å; width off by 2; model map scaled by 10):
the missing atoms are the top residual peaks, spurious atoms get
cnear 0 and no density,B_datadoes not depend on the scale, and detection on the regularized map beats prior-free. Score against the phantom's atoms, surface atoms (fewer than 12 neighbours) apart, over several noise realizations; not by FSC. - Amplitudes for species:
cagainst the aperture intensities on FePt and on the synthetic species cases, by coordination number. - Across data sets, at least four, so that a calibration that holds only on FePt is caught: multislice simulations with Peter Ercius (NCEM) with exact atoms; a single-species AET set (the tungsten tip of Xu et al., 2015); an AET Pt/Ni set if obtainable; the SINGLE Pt particle data.
- Default strength rule. The estimated
lambda_A,relbecomes the default only if, on every test set above, its held-out prediction error is within 1 percent of the best on the grid. Otherwiselambda_atmstays an explicit input. The test is on the error, not the strength, because the optimum is flat. Met so far on FePt only. - SINGLE particles: held-out image prediction and atom statistics (item 4).
4. Rulings and rules that bind¶
- Version 1 has one prior and one strength.
- Tomography first, then SINGLE.
- Rules every prior obeys: a symmetric positive semi-definite term; a linear operator frozen during a solve; nothing accumulated into the raw accumulators; attached only in deapodized kernel mode; strength zero reproduces the prior-free result bit for bit; half independence kept or its loss declared; resolution reported from the prior-free pair only; judged by truth, held-out data or against a model, never by the FSC of prior'd halves; one variable per experiment, thresholds written down before a run.
- Strength anchor:
lambda_A = lambda_A,rel x realspace_diag, withlambda_A,relthe Wiener ratio of the completed note's section 6. Unmeasured voxels keep a zero in the preconditioner (giving them1/lambda_Astalled CG). - Amplitudes of the model never enter the prior (scale-free), so simulated and reconstructed maps need no common scale.
- Related companion changes: the rule in the species design that atoms with amplitude below 0.2 of the median are removal candidates would flag a whole light species; reference it to the noise instead.