SINGLE without a species input: atom detection, Gaussian density model, species discovery and map simulation¶
Implementation note, 2026-10-07, revised 2026-10-08 after review. Written
against master 108c8c9d.
Status (2026-10-20): the design, the method and phases 0 to 8 are done and
recorded here. The prototype is in the tree: opt-in species discovery in
detect_atoms (element optional, discover_species, nspecies, min_nbrs),
B factors in the simulator's element kernels, the species list, compound
lattices and the coordination term of 3.6. The code was built and tested by the
maintainer (fast gate, species_discovery, single_atoms_stats). Phases 0 to 3
ran on 2026-10-08, phases 4 and 5 on 2026-10-08 and 09, phase 6 was withdrawn on
2026-10-09, phases 7 and 8 (validation on the 66 real Pt maps) ran on
2026-10-11, and the coordination term was built and tested on 2026-10-12. The
design as a replacement of the present detection was never approved; what was
approved is the opt-in prototype, which changes none of the existing products.
Open work is in ../planned/species_discovery_unfinished.md:
phase 9 (the coordination term measured on the 66 real maps, section 10.11
here, not yet run), the validation of 10.8, promotion of anything beyond
diagnostics, the open questions of section 13 and the smaller open items. The
living entry point for picking the work up is
../planned/species_discovery_status.md.
Sections 10.8, 10.11 and 13 below keep their original text as the record of
what was planned; the unfinished note supersedes them.
Status as written on 2026-10-08 (kept as history). The design is for review and is not approved as a replacement of the
present detection. What is approved is a small, opt-in prototype: the
foundations and the species-free level 1 of section 10 (phases 0 to 2, which
change nothing for an existing run) and the residual recovery and species
call behind an experimental key, producing diagnostics only (phase 3). The
prototype is developed alongside the existing detection machinery, which
keeps working unchanged throughout; section 10.0 states the rules. Phases 0
to 3 ran on 2026-10-08. The second run, phases 4 and 5 (10.5, 10.6), follows
two rulings of the same day: B factors go into the element kernels of the
simulator, and the species of a synthesised particle are given on the
command line as a list; its test renders ground truth with the element
kernels, not with the atoms the detector assumes. Promotion of anything
beyond diagnostics waits for the validation of section 10.8. The third
run, phases 7 and 8 (10.9), runs detect_atoms in all its modes on the 66
real Pt maps and changes no code. Section 15 records the reviews and what
they changed.
Companion pages: single_pcg_integration_completed.md and
single_pcg_integration_unfinished.md (section 11 says how they fit together),
and the report species_discovery_report.md of
the unattended runs.
Where this note says "nothing in SIMPLE was compiled or run", that referred to
the design stage of 2026-10-07: the numbers of section 8 come from a numpy
emulation of the proposed pipeline on synthetic particles (emul_species.py,
which needs emul_detect.py; both are kept out of the tree, like the other
reference scripts), checked in section 8.8 by a second, independent
implementation (codex_checks.py). They show how the algorithm behaves on
idealised input and are not a measurement on data: the generator produces the
Gaussian atoms the detector assumes, so agreement between the two says the
design is coherent, not that it works on a reconstruction. The measurements on
SIMPLE itself are in section 16.
0. What is asked, and what constrains the design¶
The request: no element on the command line. The program finds the atoms,
finds how many kinds of atom there are and which atom is which, and simulates
a map from what it found. The first data are HAADF-STEM images (high-angle
annular dark-field scanning transmission electron microscopy, whose contrast
rises with atomic number) of Pt/Ni particles.
Two further points from the discussion shape the design.
- The B factor rises from the core to the surface, so anything that matches the density against a fixed shape has a different error rate at the surface than in the core. The density should be modelled by a generic Gaussian fit whose parameters can be examined as a function of radius. This is adopted: every atom gets its own fitted width, the species call does not use matching, and the radial profiles of the fit are a product (sections 1, 3.7, 3.8, 7).
- An alternative is to specify the species, take the maximum over per-species correlation maps for the segmentation, and assign species with a Gaussian mixture model that includes the B factors. The mixture model with embedded B factors is what sections 3.6 and 3.7 are. The maximum over per-species maps does not change the segmentation, and section 5 says why and what specifying the species does buy.
"Species" in this note means an intensity class. HAADF contrast orders the atoms by atomic number, so the data can say that there are two kinds of atom, which is which, and what their intensity ratio is. They cannot name the elements without a calibration, and nothing in the density model needs the names (sections 5 and 12).
"Pt:Ni is 3-6:1" can be read as the atom ratio or as the intensity ratio. The design does not depend on the reading: the emulation covers atom ratios of 3:1 and 6:1 crossed with intensity ratios of 3:1 and 6:1. Which one is meant matters for what to expect from the data (Q1).
Constraints taken from the code:
refine3D_nanohas no species dependence (single_commanders_nano3D.f90:269-295). The species entersautorefine3D_nanoonly throughdetect_atomsand the_SIM.mrcit returns asvol1, and once upstream, in thestartvol.mrcofanalysis2D_nano(single_commanders_nano2D.f90:196-203).- The simulated map is an alignment reference only. Trailing reconstruction
blends accumulators, never volumes
(
.github/skills/simple-frac-update-trailing/references/frac-update-contract.md), so_SIM.mrcputs no density into the reconstruction. The intensities measured in the next map come from the particle images. (As read inderive_sampling_settings,simple_parameters_phases.f90:504-512,l_trail_recis cleared whenupdate_fracis above 0.99, andautorefine3D_nanosetstrail_rec=yes ufrac_trec=0.5but notupdate_frac. If that reading is right, trailing is off in the default SINGLE loop. Not traced beyond that routine.) - The volumes
refine3D_nanoships are zero outside a soft sphere of radiusmsk_crop(simple_commanders_rec_distr.f90:461-466,:638-682), andnanoparticle%newmasks again (simple_nanoparticle.f90:271-278). Any noise reference has to come from inside that sphere and away from the atoms. Withoutmskdiam,nanoparticle%newestimates the particle's diameter (low-pass at 5 A, Otsu, the largest connected component) and masks at 1.2 times it (2026-10-11; section 7 says what the estimate did before). Discovery takes its noise from the map as read, so the noise region is not bounded by that mask (3.2). image%phase_corrdivides by one global norm that depends on the map (simple_image_calc.f90:1482-1485). Correlation maps of different residuals are therefore not on one scale until they are standardised.atoms%convolvereads neitherbetanoroccupancyand silently skips anyZoutside its table (simple_atoms.f90:1235-1236);set_nameandset_elementstop on an unknown symbol (:727-743,:890-904).- A single-species data set must come out as it does today: one class, no atoms added.
discard_atomsdeletes an atom by clearing its component in_BIN, relabelling_CCand callingfind_centers, which deallocates and reallocatesatominfo(simple_nanoparticle.f90:767-768,:1116,:1151);identify_atomic_posalready has to recomputevalid_corrafter it for that reason (:601-603). Nothing fitted per atom survives pruning unless pruning comes first or works on the atom table. Its size test compares the longest extent of the component with half the atom radius (:1132-1139), so a component that is generated from the model can never fail it.- The regression test of the present path is
single_atoms_stats(production/CMakeLists.txt:307-308): it simulates a Pt particle in process (simulate_nanoparticle, box 160,moldiam=20), runsdetect_atoms element=Ptandatoms_stats, and requires recall and precision of 0.90 or more within 1 A, a root-mean-square position error of at most 0.75 A and a correlation of at least 0.80 between_SIM.mrcand the input. The last recorded result is recall 1.000, precision 1.000, 0.015 A, 1.000. The sub-suitenanoparticle atomsoflib_singlethat the first version of this note named no longer exists (moved 2026-09-25).
1. The model¶
rho(r) = b(r) + sum_i A_i exp(-4 pi^2 |r - r_i|^2 / B_i)
b is a smooth background. Each atom is one isotropic Gaussian with its own
position, amplitude and width. Its integrated intensity is
I_i = A_i (B_i / 4 pi)^(3/2)
The atoms form a mixture of K classes. Class k has an intensity I_k,
and an atom of class k has I_i near I_k. The width B_i belongs to the
atom and not to the class: it is free per atom, and it is expected to vary
with radius.
The reason for this split is physical. In an incoherent image the integral of
an atom is set by its scattering power, and displacement, the probe and the
reconstruction only spread it. So I carries the species and B carries the
environment. A statistic that mixes the two, such as the peak height, a
correlation with a fixed shape, or the amplitude at a fixed width, cannot
tell a light atom from a heavy atom that is smeared. Section 8.4 shows that
this is not a small effect: with widths that grow towards the surface, the
amplitude at a fixed width invents a species in a single-species particle.
Unknowns found from the map: the number of atoms, r_i, B_i, the number of
classes K, the class of each atom with its probability, and the I_k.
2. Length scales from the data¶
The element currently supplies an atom radius r and, through the lattice
table, a neighbour cutoff. Both follow from one measured number, the
nearest-neighbour distance d_NN: the median over atoms of the distance to
the nearest other centre, taken from the centres of the first binarisation.
r = 0.4 d_NN. For Pt this gives 1.106 A against the tabulated 1.10 A, sosplit_atoms,validate_atomsanddiscard_atomskeep their behaviour.- Neighbour cutoff
1.267 d_NN, which is whatfind_rMaxreturns for FCC Pt (3.504 A). This assumes close packing. The general form is the midpoint between the first two peaks of the pair-distance histogram plus0.15 r; not emulated (Q5). - The contact-score ceiling of
discard_atoms(12 or 4, from the crystal system) is 12 in the prototype, the close-packed value that goes with the neighbour cutoff above (Q5), so that the pruning logic is unchanged. Deriving it from the data (the median contact score of the inner 30% of the atoms) belongs to 10.8. - Fit and aperture radius
d_NN / 2. - Radial coordinate of an atom: its distance from the centre of the atom
positions (
cendist, already inatom_stats). For a particle that is far from spherical the depth below the surface is the better coordinate (Q3).
The distance tests of split_atom multiply squared voxel distances by smpd
where smpd^2 is meant (simple_nanoparticle.f90:914-969), so the exclusion
radius written as 0.9 r acts as 0.59 A for Pt at 0.358 A. The species-free
path should state it in Angstroms as a fraction of d_NN: 0.21 reproduces
today's effective value, 0.36 the written one. To be settled on the Pt test.
3. Pipeline¶
Nine parts inside detect_atoms; 3.9 gives the order they execute in (level
1, its pruning, then the rest). 3.1 and 3.9 are the present flow, with the
Gaussian kernel and the d_NN length scales substituted only when element
is absent. The rest is new and runs only under discover_species=yes.
3.1 Level 1: the present flow with a pseudo-atom¶
phasecorr_one_atom, the Otsu threshold ladder, the bisection,
discard_small_ccs and split_atoms run as now, with one change: the
template and the equal-atom simulation of t2c use the Gaussian of section 1
at a reference width B_ref, not an element. At 0.358 A the Pt template
correlates at 0.997 with a single Gaussian of sigma 0.42 A (B = 13.9 A^2),
which is the starting B_ref; with an element, B_ref is the Gaussian
fitted to that element's template. After the first fit (3.4) the median B
of the strong atoms is compared with B_ref and the ratio is reported
(_species.txt); re-running the detection at the fitted width is left to
10.8, because in the prototype level 1 and its products must not depend on
the opt-in key. Nothing is carried between calls of detect_atoms.
Level 1 finds the strongest class and nothing else. That is the behaviour to preserve for single-species data, and the reason more levels are needed: the Otsu gate sits at about a quarter of the strong peak, and in every multi-species case of section 8 level 1 found the strongest class (all of it in all cases but two, 395 and 394 of 396 there) and none of the weakest.
3.2 Noise reference¶
The noise region is the set of voxels of the map as read (before the mask of
nanoparticle%new) that lie inside the box's inscribed sphere and inside any
mask the input already carries (its nearest exactly zero voxel, as in the
volumes refine3D_nano ships), both less two soft-edge widths, and farther
than 1.5 d_NN from every accepted atom. It is rebuilt after each level.
Without half maps the noise field of the z maps is the matched-filter
residual of that unmasked map. Three numbers come from it:
- the mean and standard deviation of each correlation map, which turn that
map into a z map and remove the global norm of
phase_corr; sigma_n, the standard deviation of the map itself;s_A, the standard deviation of the matched amplitude atB_ref, ands_I, that of the aperture intensity (3.5), both measured at 400 or more phantom sites placed at random in the region.
Measuring the noise of each statistic by applying that statistic to empty positions makes no assumption about the colour of the noise. The emulation used white noise, noise band-limited at 1 A, and strongly correlated noise, with the same thresholds.
If the region is too small, because the box leaves too little room around the particle, the program stops. The noise in the region is a lower bound on the noise inside the particle, where alignment error adds to it.
Half maps as the noise reference. With vol_even and vol_odd given,
sigma_n and the mean and standard deviation that standardise each
correlation map come from the half-map difference (its noise is sqrt(2)
times that of a half and twice that of the average, so the full-map value is
the difference's divided by two), measured over the same region. The
difference is free of any density, so atoms that have not been found yet
cannot enter it. That matters: the region excludes 1.5 d_NN around every
accepted atom, which removes an undetected surface shell (its atoms sit
within one d_NN of the strong atoms) but not an undetected domain made only
of the weak species and thicker than that. In the check of section 8.8 such a
domain inside a mask of radius 14 to 16 A raised the region's standard
deviation by 36 to 40% (5% at 21 A); a robust spread removed only a quarter
to two fifths of that excess, because the matched filter spreads every atom
over a hundred voxels. The
direction of the error is conservative (a higher effective threshold, fewer
detections), and with a single map and no half maps it is accepted and
reported as the ratio of the region's robust to plain spread.
The detection threshold is calibrated, not fixed. A threshold on a z map
of local maxima is a multiple-testing problem: the number of noise maxima
above k grows with the volume searched and depends on the colour of the
noise, and the per-voxel Gaussian tail does not give it (it overpredicts the
count of maxima six times in the check of section 8.8). The region does. The
number of maxima of a smooth Gaussian field above u has the form
C (u^2 - 1) exp(-u^2 / 2) (the Euler characteristic density in three
dimensions), with C proportional to the volume searched. C is fitted to
the counts of region maxima above 2.5, 3.0 and 3.5, scaled by the ratio of
the search volume to the region volume, and k is the u at which the
expected number of false atoms in the search volume is a target of 0.2 per
particle. Scaling the region's own count by volume predicted the search
volume's count to within a factor 0.8 to 1.0 in the check; the calibrated k
came out at 5.0 for white and 1 A band-limited noise and 4.7 for strongly
correlated noise, so the fixed k = 5 of the first version of this note was
right for the emulated geometry and would be wrong for a larger search volume
or a different noise colour. The expected false count at the chosen k is a
reported diagnostic (section 7).
3.3 Residual levels¶
After level 1, repeat:
- Subtract the fitted density of all accepted atoms from the map as read.
- Matched-filter the residual with the same template; standardise to a z map with 3.2.
- Candidates are local maxima of the z map above a threshold
k(non-maximum suppression within0.35 d_NN) with at leastNVOX_THRESHof the 27 surrounding voxels abovek. The position is the centroid of the positive residual within0.35 d_NN. - Accept, fit each new atom on the residual, go to 1.
Two stages. Stage A uses the calibrated threshold k_A of 3.2 (5.0 on the
emulated geometry), searches the whole shipped sphere, and accepts any
candidate farther than 0.7 d_NN from every accepted atom; it repeats until
it adds nothing. Stage B uses k_B = k_A - 1 and accepts a candidate only
if it passes a neighbour gate: no accepted atom closer than 0.85 d_NN, and
at least three within 1.15 d_NN. Its search volume is therefore the
accepted atoms dilated by 1.15 d_NN. It also repeats until it adds nothing.
At most eight levels per stage. The gate's requirement is the key
min_nbrs, the number of already found atoms within 1.15 d_NN that a
recovered atom needs (default 3; 0 switches the gate off), and every atom
records the stage and level that accepted it and its detection z, so that a
run with the gate off can be compared atom by atom.
Three choices here were forced by the emulation.
- Local maxima, not connected components. At a fixed low threshold the components of neighbouring atoms merge when the signal is strong, and the merged centroid lands between two atoms.
- No Otsu on the residual. It has no noise reference and can fall to the noise floor.
- The gate. Without it,
k_B= 4 (its value on the emulated geometry, used for every number below) over the shipped sphere admits 2 to 4 noise maxima per particle (4.2 for white and band-limited noise, 2.3 for strongly correlated; 1.5 within the particle envelope; section 8.8, current variant of the levels; the first version of this note gave 6 to 13 from an earlier variant), and in one single-species run of that earlier variant 13 of them were returned as a second species holding 2.4% of the atoms. That is how a species gets invented. With the gate,k_B= 4 gave 0.2 to 0.4 false atoms per particle and raised the recall of weak, broad atoms from the 25% of stage A alone to 61% on a weak surface shell and 58% for weak adatoms, and from 59% to 78% on a weak-only domain.
What the gate assumes and what it costs. It is a local lattice prior: it
needs three found neighbours in a shell of 0.85 to 1.15 d_NN, so it
assumes a locally close-packed neighbourhood whose spacing is within 15% of
the particle's median. It uses only d_NN, so it does not assume one
lattice across the particle, but an amorphous or heavily strained surface
would fail it, and nothing in the emulation tests that. It cannot find a
weak atom with fewer than three accepted neighbours and a z below k_A; an
isolated adatom is found by stage A or not at all. A region made only of the
weak species is reached from its boundary inwards, one shell per level, and
in the check of section 8.8 the interior of such a domain was found to 99%.
Measured at the same k, the gate costs recall against an ungated search:
about six points on the surface shell and nine in the coordination 5 to 7
bin of the weak-only domain. Measured at the same false-positive rate, which
is the comparison that counts, the gated stage B at k_B = 4 beat an
ungated search at k = 4.5 by 7 to 15 points in every case and every
unsaturated coordination bin (the interior bin is 99% for both; 61 against
46% on the surface shell, 78
against 71% on the weak-only domain, 58 against 43% for weak adatoms of
coordination 2 to 4). The gate is kept, as a switch, on that evidence.
This is the one step that matches against a shape, and section 7 treats what that means at the surface.
3.4 Density fit, stage 1: free amplitude¶
Three sweeps over all atoms. For atom i the data are the map minus the
background minus the fitted density of every other atom, inside a sphere of
radius d_NN / 2. The amplitude is linear; B_i is found by a
one-dimensional search that minimises
SSE(B) / sigma_n^2 + ((ln B - m_i) / tau_i)^2
SSE is the sum of squared residuals over the sphere. m_i and tau_i are the median and the robust spread (floor 0.1) of ln B
over the strong atoms (amplitude above 10 s_A) of the same radial shell,
within d_NN in radius; the global values are used when fewer than five
qualify. After each sweep the background is the residual smoothed with a
Gaussian of standard deviation d_NN.
A strong atom keeps its own width, since its data term dominates. A weak atom cannot: with a free amplitude its width is not determined by its own density (in a comparison of single-atom estimators made while drafting, not reported here, the fitted sigma of an atom at 0.175 of the strong amplitude ranged from 0.26 to 0.67 A around a true 0.35), so at this stage it borrows the width of the strong atoms at its radius. Stage 2 removes the need for that.
Subtracting the neighbours is what allows the sphere to reach d_NN / 2
without a per-atom background term. An earlier variant, with the sphere of
calc_isotropic_disp (three quarters of that radius) and a free background
per atom, lost part of the integral of broad atoms to the background.
Positions were held fixed in the emulation. In the implementation each sweep should also move the centre to the centroid of the atom's own residual.
3.5 Aperture intensity¶
I_i = smpd^3 sum over |r - r_i| < d_NN/2 of [ map - b - sum_{j /= i} rho_j ] / F(d_NN / 2 sigma)
F(t) = erf(t / sqrt 2) - sqrt(2 / pi) t exp(-t^2 / 2) is the fraction of a
Gaussian inside t standard deviations, and sigma^2 = B / 8 pi^2 with B
the median fitted B of all atoms: one width for every atom, not the atom's
own. On a filtered map an atom's own width is narrowed by its neighbours'
negative halos (section 7), and dividing by its own F made the intensity
fall with coordination; in stage 2 it also let the class an atom is tied to
feed back into its intensity (3.7). Section 7 gives the numbers. The factor
smpd^3 puts the voxel sum in the units of the
continuous integral A_i (B_i / 4 pi)^(3/2) of section 1, which the
stage-2 penalty of 3.7 compares it with; the first version of this note
omitted it (the mixture of 3.6 is scale-free, so the emulation did not see
the error, but the tie of 3.7 would have been off by smpd^-3, about 22 at
0.358 A). Every intensity in this note, in the products and in the tests is
in those units: the voxel sum of a pseudo-atom of intensity q is q /
smpd^3 (section 10, phase 1).
This is the classification statistic. It is a plain sum, so it involves no matching; it measures the quantity that carries the species; and it does not depend on any atom's own width. Its cost is noise: about 2.3 times that of the matched amplitude for white noise, and more when the noise is concentrated at low frequency (case 8b of section 8.1).
3.6 Species discovery¶
Input: the I_i and s_I. A one-dimensional Gaussian mixture is fitted for
K = 1, 2, 3 as an extreme deconvolution (simple_xd_gmm of the clustering
library, after Bovy, Hogg and Roweis 2011): every intensity is a class value
plus measurement noise of spread s_I, so a class variance is the class's
intrinsic spread and its observed spread is that plus s_I^2. This is the
"variance floored at s_I^2" of the first version made exact, in the same
likelihood family; the fit is expectation-maximisation from two
deterministic starts (sorted quantiles, as in sortmeans, and the K-1
largest gaps of the sorted sample), keeping the likelier. Each fit gets the
Bayesian information criterion BIC = -2 ln L + (3K - 1) ln N, with L the
likelihood and N the number of atoms.
A K is admissible when every class holds at least max(8, 0.02 N) atoms and
adjacent classes are separated by D >= 3, with
D = |mu_a - mu_b| / sqrt((var_a + var_b) / 2). K = 1 is always admissible.
The admissible K with the lowest BIC is taken. Each atom gets the posterior
probability of every class, which is stored, and is labelled by the largest.
Classes are numbered by decreasing intensity.
The labels use no spatial information beyond the environment term below. Whether the species are mixed, ordered or segregated is the result, so no neighbour may favour one class over another.
The environment term (ruling of 2026-10-12, option A of 10.10). On real
maps an atom's intensity rises with its number of contacts, by about 4% of
the mean per contact, the same for every atom whatever its species. Every
intensity therefore carries one term beta (c_i - 12) in its contact count
c_i (the contacts of 3.9, counted for every merged atom before the fit),
shared by the classes, so that mu_k is the intensity of an atom of class
k with twelve contacts. For one class beta is the slope of the
least-squares line, its maximum likelihood. For several it is fitted by
alternation: the classes are fitted to I_i - beta (c_i - 12) (each fit
started from the previous class means, at a looser EM tolerance than the fit
without the term), and beta is refitted as the within-class regression
slope of the intensity on the contacts (each class weighted by its inverse
variance, each atom by its posterior), until it moves by less than 0.001 of
the mean intensity (at most 20 rounds). It starts once from beta = 0 and
once from the least-squares slope, the likelier slope is kept and the
classes are refitted at it from their means, at a tighter tolerance: on the
core fixture the least-squares start alone settled on a slope that absorbed
the core (123 wrong labels in one of seven draws). A grid search of the
likelihood was tried first and was far too slow; the alternation gives the
same calls on Pt_example and on the fixtures (10.10). It counts as one
parameter in the BIC. Every mixture fit now stops after at most 200 EM
iterations or at a relative change of the likelihood of 1e-8 (1000 and
1e-10 before): the fits that ran longer were extra classes crawling on a
flat likelihood, they made the species unit tests take 14 s, and on the
fixtures and on Pt_example they change no call except one borderline
class planted at 0.6. The
term favours no class, but a species confined to one range of contacts is
partly absorbed by it (10.10). _species.txt reports beta as
coord_slope, and over the intensity of class 1.
nspecies fixes K when the user knows it, and a species list does the same
(section 5).
3.7 Density fit, stage 2: the B factor inside the mixture¶
With the classes known, every atom is refitted with its integral tied to its
class. For atom i of class k the one-dimensional search over B now
minimises
SSE(A, B) / sigma_n^2 + ((A (B / 4 pi)^(3/2) - I_ik) / tau_k)^2
with the amplitude given in closed form for each B, and I_ik = mu_k +
beta (c_i - 12) the intensity the class fit expects of the atom (3.6). tau_k is the
intrinsic spread of the class from the deconvolution fit (the observed
var_k less s_I^2, under the root) with a floor of
0.05 I_k. Two rounds: fit, recompute the aperture intensities and the
classes, fit again. The aperture intensities do not use the tied widths
(3.5), so a class cannot reinforce itself through them.
The tie makes the width of a weak atom measurable. Its peak height is now informative about its width, because a broader atom of the same species must be lower by the cube of the width ratio. No width is borrowed from the strong class any more, so a light species that is broader than the heavy one at the same radius comes out broader (case R6 in section 8.2).
The cost is an assumption: all atoms of a class have the same integral to
within tau_k. An atom that is present part of the time will be fitted as a
broader atom of its class. The stage-1 widths are kept in the per-atom table
so that the two can be compared.
3.8 Radial profiles¶
The per-atom table (section 6) holds every fit parameter with the atom's
radius and coordination number, so any dependence can be plotted directly.
detect_atoms also writes the profiles: per class, in equal-count radial
shells of at least 20 atoms, the number of atoms, the mean radius, the width
(root mean square sigma and its standard error, and the same as B), the
mean intensity with its standard error, the mean coordination, and the
predicted detection signal-to-noise of section 7.
3.9 Pruning and validation¶
The order is: prune level 1, then fit it provisionally, then recover, then
prune the recovered atoms on the atom table, then fit and classify. No
per-atom fit survives a discard_atoms pass, so fitting starts after
level-1 pruning; the recovered atoms are pruned without discard_atoms,
which keeps their fits.
Level 1 is pruned as today: discard_small_ccs, split_atoms,
validate_atoms and discard_atoms run on the level-1 set, unchanged in
logic, with the length scales of section 2 in place of the element's. This
is the production path and its products (_ATMS.pdb, _BIN, _CC, _MSK,
_SIM) are written from it exactly as now. The first version of this note
placed pruning after the fits; the constraint of section 0 rules that out,
since discard_atoms rebuilds atominfo on every pass.
Residual-level atoms have no component at the level-1 threshold, so the
present pruning cannot apply to them and must not be imitated with
model-generated components (the size test would then be circular). They
are pruned on the atom table alone: the contact-score rule of
discard_atoms (fewer contacts than the threshold among the 15% of atoms
farthest from the centre), computed on the merged set, plus the exclusion
distances of 3.3, in a routine that touches neither _BIN nor _CC.
Ruling of 2026-10-09 (second): recovered atoms are pruned by the present
policy, not a weaker one. The densities discovery recovers around a real
particle are real, and detect_atoms removes them on purpose: weakly
occupied, lowly coordinated surface atoms of low confidence and high B,
which the contact-score thresholding of discard_atoms exists to remove.
Discovery must not reinstate them. A recovered atom therefore faces what a
level-1 atom would: its contact score counts level-1 atoms only (after
level-1 pruning), never other recovered atoms; the outer zone and the
threshold are those discard_atoms derived for the level-1 set (beyond the
85% radius quantile from the centre of mass, the same threshold with the
same ceiling and cap), reported in _species.txt; a recovered atom in that
zone is removed if its contact score is below the threshold, which is
discard_atoms' rule for small, lowly contacted atoms (a recovered atom is
weak by construction) and contains its other rule. Atoms inside the zone
(interior vacancies, a light species inside the particle) are not affected.
_species.txt also reports, per class, the fraction of its atoms in that
zone and their mean coordination, and flags a class with more than 80% of
its atoms there as possible partial occupancy (reported only).
The stage-1 and stage-2 fits (3.4, 3.7), the aperture intensities (3.5) and
the species call (3.6) then run on the merged, pruned set. valid_corr of
the level-1 atoms is the one measured today against the equal-atom
simulation; for the recovered atoms the same correlation against a
simulation in which every atom has its class intensity and its own width is
written to the species table as a diagnostic. Once recovered atoms are
promoted into _ATMS.pdb (section 10.8), valid_corr moves to that
simulation for every atom, and two penalties of the present equal-atom,
equal-width simulation disappear: the one on a weak atom next to strong
neighbours, and the one on a broad atom at the surface.
4. Simulation¶
atoms%convolve gets a pseudo-atom branch: for a sentinel Z the kernel is
the Gaussian of section 1 with B from beta and amplitude
q (4 pi / B)^(3/2), q from occupancy. An atom with q = 1 has unit
integrated intensity whatever its width.
At promotion (10.8; in the prototype _SIM.mrc is the present equal-atom
simulation) _SIM.mrc is rendered with the class intensity for q and the
fitted B_i of each atom. Against the noise-free generating density of the multi-species
cases this correlated at 0.99 or better, the same as rendering every atom
with its own fitted amplitude, so the class constraint costs nothing. One
width per class gave 0.94 to 0.99, and the equal-atom simulation used today
0.86 to 0.96 (section 8.1).
Because occupancy and beta are PDB columns, the PDB defines the
simulation. simulate_nanoparticle pdbfile= then is the species-free map
simulator, with per-atom amplitude and variance, and also the fixture
generator for the tests of section 10.
B factors in the element kernels (phase 4, ruling of 2026-10-08). In
the five-Gaussian parametrisation the scattering factor is
f(s) = sum_j a_j exp(-b_j s^2) and the Debye-Waller factor multiplies it by
exp(-B s^2), so the product is the same sum with b_j + B in every term:
in real space each Gaussian of the atom has its width parameter raised by
B. convolve already does this for the resolution blur,
b = b + bfac with bfac = (4 lp)^2 and lp at least 2 smpd
(simple_atoms.f90:943-945, :1255, equation B.6 of Rullgard et al.), so
every element atom carries at least (8 smpd)^2 = 8.2 A^2 at 0.358 A. The
change adds the atom's own beta(i) to the same sum, behind an optional
logical bfac_pdb of convolve, default false; a negative beta with the
flag is an error, and the pseudo-atom branch ignores the flag (its beta
is its width already). The integral of an atom is independent of B, so
the voxel sum is conserved and the peak falls as
sum_j a_j / (b_j + bfac + B)^1.5 over sum_j a_j / (b_j + bfac)^1.5,
0.243 for Pt at B = 20 A^2 and the default blur. It is opt-in because
simulate_atoms and write_centers write coordination numbers and
valid_corr into the B column before rendering
(simple_nanoparticle.f90, the which cases of write_centers_2 and the
set_beta calls of simulate_atoms); every existing call of convolve is
unchanged. simulate_nanoparticle exposes it as the key pdb_bfac
(yes|no, default no), accepted only with pdbfile=; a fixture is then
fully specified by a PDB with elements, coordinates and B factors.
5. When the species are given¶
The maximum over per-species correlation maps. phase_corr removes the
scale of the template, and at this sampling the shapes of the element
templates are nearly the same: the Pt and Ni templates correlate at 0.998. In
the emulation the correlation map made with the Pt template and the one made
with the Ni template correlated at 0.9955, and the maximum of the two found
the same atoms as either: all of the strong class and, at an intensity ratio
of 6:1, none of the weak class (section 8.5). The weak atoms are missed
because the correlation map is linear in atom amplitude and the first
threshold sits above them. A template of the weak species has the same
shape, so it does not raise them. Residual levels do (3.3).
The same holds for widths: a template of the wrong width loses little. For an atom with twice the variance of the template the matched signal falls by 8%.
What a species list does buy. Three things, none of them in the
segmentation: K is fixed, so model selection cannot go wrong; the classes
get element names; and the species PDB (and _ATMS.pdb at promotion)
carries real element symbols. The class intensities and widths still come
from the data. They cannot come from the scattering-factor table, which
describes the electrostatic potential (Pt over Ni is 2.0 at the peak of the
templates and 1.65 in the integral) and not the HAADF signal.
The species list (phase 4, ruling of 2026-10-08: the species of a
synthesised particle are known and are given). element=Pt,Ni, a
comma-separated list of element symbols, brightest first. Without a comma
the key keeps today's meaning exactly, one element or one of the compound
selectors (CdSeW, CdSeZ, CdSeR; section 9 says how these are both a
lattice and a species statement), and every present path executes the
same branches.
- The order given is the order of decreasing expected intensity, and the
program does not reorder it: classes found by decreasing intensity take
the symbols in the order given. Atomic number is not a safe proxy even
in the simulator (in the five-Gaussian model Pt integrates above Au),
and in HAADF data the user knows which species is brighter. The symbols
must be physical elements (the pseudo-atom symbols
X1toX3are rejected) and distinct. The list has any length:nspeciesis set from it, and everything sized by the number of classes is sized bynspecies(the mixture of 3.6, the posterior columns of_species.csv, the chains of_species.pdb), not by a constant.MAX_NSPECIES(3) remains only the ceiling of the automatic search of the blind mode. - Parsing reuses the comma-list machinery of
simple_string_utils:list_of_ints2arris whatclustindsgoes through, and the species list goes through its string sibling, added beside it (blanks around an entry and empty entries ignored, as there, soPt,and,Ptsplit to the one symbolPt). A value with a comma is a list, and a list must hold two or more symbols after splitting;Pt,is therefore an error, with a message saying so, not a one-element list.parameters%elementbecomescharacter(len=STDLEN)likeclustinds, so any length fits. The element checks sit in a non-fatal helper,parse_element_list(str, symbols, errmsg)insimple_atoms, whereelement_existslives, returning a logical and a message so that its rejections can be unit-tested in process; the fatal stop happens in the caller.simple_parameters_phases, where the element is validated today, calls it when the value holds a comma, stores the symbols in a newspecies(:)(character(len=2), allocatable), setsnspeciesto their count, a new logicall_species_listandl_discover_speciestrue, and setselementitself to the first symbol, so that every present use ofparams%elementsees one element. A list is accepted bydetect_atomsonly (prgis inparameters); every other program stops with a message, so that nothing runs silently as the list's first element. exec_detect_atomsnormalises the raw command line before anything is checked: whenelementholds a comma it setsdiscover_species=yeson the command line (and rejectsdiscover_species=no), so that the checks that follow (the half maps,min_nbrsandnspeciesneed discovery) see the implied value.nspeciesis derived from the list, so giving it with a list is an error rather than something to reconcile. The combinations:
element |
discover_species |
nspecies |
min_nbrs |
half maps | result |
|---|---|---|---|---|---|
| one symbol, or absent | absent or no |
given | any | any | error: needs discover_species=yes |
| one symbol, or absent | absent or no |
absent | given or half maps given | error: needs discover_species=yes |
|
| one symbol, or absent | absent or no |
absent | absent | absent | present path, no discovery |
| one symbol, or absent | yes |
0 or 1 to 3 | any | both or neither | blind discovery; K automatic or fixed |
| list | absent or yes |
absent | any | both or neither | discovery with K = list length, classes named |
| list | no |
error | |||
| list | given | error: nspecies is the list's length |
|||
| compound selector | absent or no |
absent | absent | absent | present path on the selector's lattice, no discovery |
| compound selector | yes |
absent | any | both or neither | discovery with K = 2, classes named by the selector's symbols |
| compound selector | yes |
given | error: nspecies is the selector's |
||
list, with any program but detect_atoms |
error |
- Level 1 then runs as
element=<first symbol>runs today: that element's template and lattice table, the present pruning, the present products, byte-identical to the one-element run (10.5 checks it). The maximum over per-species maps above is why this costs nothing. - The species call uses the list:
Kis its length, the admissibility test is still computed and reported (with a fixedKit is the diagnostic that says whether the data support the separation the list asserts; an inadmissible fit is reported in_species.txt, not an error), and_species.pdbcarries the symbols in its element column and the chainsA,B,Cby class. The nanoparticle keepsspecies(:)for naming only; nothing in detection or in the fits reads it. - The blind mode,
discover_species=yeswithout a list, is unchanged, andnspeciesapplies there only. Withoutelementand without the key the present flow runs with the Gaussian template and thed_NNlength scales, and nothing more. - The shared help text of
element(simple_ui_params_common.f90) stays as it is, since the list form is accepted by one program; the program description ofdetect_atomsinsingle_ui_atom.f90documents it.
The mixture model with B factors is sections 3.6 and 3.7: class
intensities, per-atom class probabilities, and a width per atom estimated
inside the class model. A fuller form would compute the class probabilities
from the density likelihood of each atom under each class with B profiled
out, replacing the aperture sum. It uses the same model and the same code
path as stage 2; it was not emulated, and the aperture sum has the advantage
that it depends on the atom's own fit only through the small correction of
3.5.
6. Products¶
In the prototype the present products are written by the present path from
the level-1 atoms and are not changed: _ATMS.pdb (B column valid_corr,
as today), _BIN.mrc, _CC.mrc, _MSK.mrc and _SIM.mrc (equal atoms of
the reference width). Everything the prototype finds goes into four new
files, so that a run with discover_species=yes differs from one without it
only by their presence:
_species.csv, one row per atom at full precision, level-1 and recovered atoms alike: position, radius, coordination number, stage and level that accepted it, detection z, amplitude,Bof stage 1 and of stage 2, aperture intensity and its signal-to-noise, class, class probabilities,valid_corr, and whether the gate was needed to accept it._species.pdb, the same atoms for a viewer: element column and chain by class (X1and chainAthe strongest class,X2andBthe next; with a species list, the symbols given, in their order), occupancy the class intensity over the strongest class's, B column the stage-2B_i. It is the layout promotion gives_ATMS.pdb, written to a file of its own so that_ATMS.pdbstays as it is._species_radial.csv: the profiles of 3.8._species.txt:K; class intensities, ratios and fractions;D; the BIC table with admissibility; the expected misclassification rate;d_NN,B_ref, the noise numbers and their source (half maps or region); the calibrated thresholds and the expected false count at each; atoms added per stage and level; the diagnostics of section 7.
Promotion, after the validation of section 10.8, adds the recovered atoms and the class information to the present products:
_ATMS.pdb. Element column: the class symbol (X1,X2,X3, registered inget_element_Z_and_radiuswith sentinelZ, precedentCDSE, 999; or the element names when a species list is given). Chain:A,B,Cby class, so a class is one selection in a viewer. Occupancy:I_k / I_1. B column:B_i. Today the B column holdsvalid_corr(simple_nanoparticle.f90:1821); within SIMPLE only the unit tester reads it back, andvalid_corr_in_bfac_field.pdbkeeps it foratoms_stats._SIM.mrcas in section 4._CC.mrc,_BIN.mrc,_MSK.mrc. Atoms found at residual levels have no connected component of the level-1 threshold. Their components are derived from the data, never from the model: the connected region of the residual z map abovek_B / 2around the accepted maximum, split between neighbouring maxima by a watershed on the z map (the merging of components at a low threshold is what moved detection to local maxima, so the split is required, not optional). The first version of this note generated the component from the fitted Gaussian; that would make the size test ofdiscard_atomscircular and change whatatoms_statsmeasures, and is withdrawn.atoms_statsreads_CC.mrcwith_ATMS.pdb, so promoted atoms need a component. Not emulated.
7. Diagnostics and limits¶
- Core and surface. For an atom of integrated intensity
Iand width sigma the best possible detection signal-to-noise scales asI sigma^(-3/2). An atom with twice the variance is detected at 0.59 of the signal-to-noise of the same atom in the core. That loss belongs to the data and no method avoids it; fitting the atom needs it to be found first. Using a core-width template on it costs a further 8%. A bank of two template widths was tried and dropped: it changed the number of atoms found by a few in either direction and admitted more noise peaks. So detection is less complete at the surface, for the light species first. The design does three things about it. The species call of an atom that was found does not depend on detection sensitivity, and neither does its fitted width. The predicted detection signal-to-noise is reported per class and radial shell, computed from the class intensity and the fitted width of that shell. And the shells where it falls below about 6.5 are flagged: there the emulation found 56-81% of the light atoms against 88-100% above (section 8.2), and the atoms that were found were the narrower ones, so the shell average of the light class is biased low in width. - Detection limit overall. In the emulation a class whose found atoms had
a median fitted amplitude of 6.6 or more times
s_Awas found to 88-100%; at 6.4 it was 84%, at 5.0 it was 65% and at 4.1 it was 45%. The same number can be read off an existing map before any code is written: the peak of the correlation map at the weakest visible atoms over its standard deviation away from the particle. - Missing species. When a class is below the limit the program reports one class and cannot know better from intensities. The coordination of interior atoms can: with a quarter of the sites undetected the inner 30% of the atoms had a mean coordination of 8.9 where 12 is expected (case 8b). Reported as the interior coordination deficit.
- What a class is. An intensity class. A site that is occupied part of the time, or an atom that moved during acquisition, integrates to less than its species and can form a class of its own. The per-class coordination and radial profile are reported so that a class confined to the surface is visible. It is a flag and not a verdict, since surface segregation of the light species gives the same picture.
- Marginal atoms. Stage B occasionally admits a noise peak at a plausible surface site (section 8.6 gives the count). Each atom carries its detection z, its stage and level, and whether the gate was needed to accept it.
- Expected false atoms. The calibration of 3.2 gives, for each stage, the expected number of noise maxima above its threshold in its search volume. Both numbers are reported with the thresholds and the noise source (half-map difference or region), together with the ratio of the region's robust to plain spread, which flags a contaminated region.
- Half-map agreement. With
vol_evenandvol_oddgiven, the aperture intensities are measured at the final positions in each half map, and the label agreement and the intensity correlation are reported. The halves share their alignment, so this measures the effect of noise on the labels and not model bias. Not emulated. - No light species in the surface layer (ruling of 2026-10-09, fourth). Recovered atoms in the outer zone with fewer level-1 contacts than the threshold are removed whatever their intensity class (3.9), so a light species confined to that zone is not reported. This is by design: the surface layer is where the map is worst, partial occupancy is highest and B factors are highest, so a light atom there cannot be told from a weak, partly occupied surface site.
- Intensity bias on filtered maps (rulings of 2026-10-09, second and sixth), a known limitation. The aperture intensity is biased low on element kernels filtered as a reconstruction is (low frequencies suppressed, signal ending near 1.1 A), more for a light atom among heavy ones, because neighbours and background are modelled as Gaussians while the filtered kernels have negative halos. On the fixtures of 10.6 as phase 5 closed them the fitted class ratios are 25% low for Pt/Ni mixed at random, 38% for Pt/Al and 13% for a Ni core under a Pt skin, where the Ni intensity rises toward the centre and one Ni atom at the centre was called Pt (the coordination bias below, fixed by the common width of 3.5; in SIMPLE every atom of the core case is labelled right since 2026-10-12). The classes still come out in the right order; the ratios are reported, not floored. A remedy, fitting each atom with the map-filtered kernel, was tried as phase 6 and withdrawn (10.7).
- Width bias on filtered maps (2026-10-09, found after the merge), a
known limitation of the same origin. The negative halos of many
neighbours narrow an interior atom's apparent width, so the fitted width
falls with coordination and a core-to-surface rise appears where there is
none. On a noise-free 285-atom Pt particle with the same B on every atom,
rendered with the element kernels and the signal transfer of the 10.6
fixtures, the Gaussian fit with neighbour subtraction gives B = 19.8 A^2
for atoms with 12 neighbours and 23.8 A^2 for atoms with 6, a rise of
4.4 A^2 from the inner to the outer fifth; without the filtering the rise
is -0.7 A^2. With a true rise of 4.6 A^2 the fit reports 8.1. The widths
of
_species.csvand the radial profiles are therefore not mobility measurements on filtered maps; the B-factor work (atom_bfactor_model.md) has to model the filtering. - Coordination bias of the intensity (2026-10-11, found after the merge). Until then each aperture sum was divided by the enclosed fraction at the atom's own fitted width. A numpy emulation of the pipeline on the pure fixture of 10.6 (level-1 positions taken from the generating model) showed what that did:
- Noise-free, the intensity fell by 19% from atoms with 5 neighbours to atoms with 12. Half came from the aperture sum (12%), half from the width correction: the fitted B was 31.4 and 24.9 A^2 where the generated B differ by 3.8.
- Over 35 noise draws, the two-class fit forced by
element=Pt,Niwas admissible in 9, and BIC preferred two classes in 34. The brighter class was always low-coordination surface atoms (mean coordination 6.2 to 8.7) and the class called Ni the bulk (10.2 to 11.7), 89 to 235 atoms. Without the stage-2 recompute it was admissible in 3. - With one common width (3.5) it was admissible in none (
Dat most 2.54, mean 1.95), and BIC preferred two classes in 1. - On the alloy, core and light fixtures (7 draws each) the common width
labelled every atom right in list and blind mode. With own widths one
surface atom of the alloy and the Ni atom at the centre of the core
(1.6 A out) were called Pt, as the test had seen.
Drose from 5.8-7.0 to 8.0-9.4 (alloy), 6.3-6.9 to 7.5-8.0 (core) and 6.7-8.5 to 9.9-11.7 (light). The class ratios did not change. The 12% bias of the aperture sum itself remains, under the intensity bias above. - Mask estimate (2026-10-11, found by the first validation run of
10.9). Without
mskdiamthe mask comes from the particle's diameter, measured byimage_bin%diameter_ccon the largest connected component of the map low-passed at 5 A and binarised by Otsu. That routine was written for images: it took the centre of mass with z fixed at the first plane, so in a volume it measured from the bottom face of the box and returned nearly the box diagonal (82 to 93 A in boxes of 57 A). The mask covered the box, which was harmless on volumes already masked byrefine3D_nanoand not on the unmasked archive maps: there the present path reproduced 33 of 66 maps. The centre now has its z, the mask diameter is 1.2 times the measured diameter, and discovery's noise region no longer lives inside the mask (3.2). On the maintainer'sPt_examplemap a numpy copy of the fixed estimate gives 27.1 A against a coordinate extent of 28.3 A. - Model bias. Labels are found from scratch at every call; nothing is
carried between iterations. Since
_SIM.mrconly aligns (section 0), a wrong label can reach the next map only through the orientations. A direct test is cheap and worth having once_SIM.mrccarries the labels (after promotion, 10.8): render a random 10% of the atoms at the pooled intensity and check that they separate as well as the rest in the next iteration. Not emulated.
8. Emulation¶
Particle: FCC, a = 3.84 A, diameter 24 A, 528 atoms, box 128 at 0.358 A. Gaussian atoms, sigma 0.35 A in the core with 5% scatter, integrated intensity 1 for the strongest class. Two models of broadening, both at conserved integral: "surface x2" doubles the variance of the 195 atoms with coordination 9 or less; "radial x2" (or x3) lets the variance grow with the square of the radius to twice (three times) its central value at the surface. Noise is given as its standard deviation per voxel over the peak of a core atom of the strongest class. One particle per case unless stated.
8.1 Detection, discovery and simulation¶
"Level 1" is the present flow. Counts are atoms found per class, strongest
first. "SNR" is the median fitted amplitude over s_A per class. The last
column is the correlation with the noise-free generating density of the
equal-atom simulation used today and of the proposed one.
| # | Case | Level 1 | All levels | False | K | Class intensities | SNR | Simulation: today, proposed |
|---|---|---|---|---|---|---|---|---|
| 1 | 3:1 atoms, intensity 3:1, noise 0.03 | 396, 0 | 396/396, 132/132 | 1 | 2 | 1 : 0.330 | 79, 27 | 0.937, 0.998 |
| 2 | 3:1 atoms, intensity 6:1, noise 0.03 | 396, 0 | 396/396, 132/132 | 0 | 2 | 1 : 0.167 | 76, 12 | 0.903, 0.999 |
| 3 | 6:1 atoms, intensity 3:1, noise 0.05 | 453, 0 | 453/453, 75/75 | 0 | 2 | 1 : 0.336 | 46, 15 | 0.960, 0.997 |
| 4 | 6:1 atoms, intensity 6:1, noise 0.05 | 453, 0 | 453/453, 73/75 | 0 | 2 | 1 : 0.161 | 46, 7.8 | 0.943, 0.998 |
| 5 | as 2, noise 0.05, surface x2 | 396, 0 | 396/396, 116/132 | 0 | 2 | 1 : 0.169 | 42, 7.0 | 0.871, 0.997 |
| 6 | as 5, light species at the surface | 396, 0 | 396/396, 60/132 | 0 | 2 | 1 : 0.155 | 47, 4.1 | 0.918, 0.997 |
| 7 | as 5, light species in the core | 396, 0 | 396/396, 130/132 | 0 | 2 | 1 : 0.159 | 37, 8.6 | 0.862, 0.997 |
| 8 | as 2, noise 0.05 band-limited at 1 A | 396, 0 | 396/396, 132/132 | 0 | 2 | 1 : 0.169 | 49, 7.9 | 0.901, 0.998 |
| 8b | as 2, strongly correlated noise 0.05 | 395, 0 | 396/396, 1/132 | 0 | 1 | - | 12, 3.1 | 0.981, 0.984 |
| 9 | single species, noise 0.05 | 528 | 528/528 | 0 | 1 | - | 41 | 0.994, 0.998 |
| 10 | single species, noise 0.05, surface x2 | 528 | 528/528 | 0 | 1 | - | 45 | 0.952, 0.998 |
| 11 | as 10, noise band-limited at 1 A | 528 | 528/528 | 0 | 1 | - | 41 | 0.948, 0.998 |
| 12 | three species 2:1:1, intensities 1 : 0.5 : 0.167, noise 0.03 | 264, 132, 0 | all 528 | 0 | 3 | 1 : 0.495 : 0.166 | 79, 40, 13 | 0.877, 0.999 |
| R1 | as 2, noise 0.05, radial x2 | 396, 0 | 396/396, 111/132 | 0 | 2 | 1 : 0.173 | 33, 6.4 | 0.896, 0.996 |
| R2 | as R1, light species at the surface | 396, 0 | 396/396, 86/132 | 0 | 2 | 1 : 0.166 | 34, 5.0 | 0.909, 0.996 |
| R3 | single species, noise 0.05, radial x2 | 528 | 528/528 | 0 | 1 | - | 32 | 0.976, 0.997 |
| R4 | 3:1 atoms, intensity 3:1, noise 0.05, radial x3 | 394, 0 | 396/396, 128/132 | 1 | 2 | 1 : 0.314 | 25, 8.5 | 0.895, 0.995 |
| R5 | 6:1 atoms, intensity 6:1, noise 0.03, radial x2 | 453, 0 | 453/453, 74/75 | 0 | 2 | 1 : 0.170 | 52, 8.4 | 0.928, 0.999 |
| R6 | as R1 at noise 0.03, light species 1.3x the variance of the heavy one at every radius | 396, 0 | 396/396, 129/132 | 0 | 2 | 1 : 0.163 | 52, 6.6 | 0.881, 0.998 |
| R7 | single species, noise 0.05, radial x3 | 528 | 528/528 | 0 | 1 | - | 26 | 0.954, 0.996 |
Every atom that was found and matched to the generating model received the
right label, in every case. D was 10.1 or more wherever more than one class
was found. Class fractions equalled the fractions among the found atoms;
where weak atoms were missed (cases 5, 6, R1, R2) the light fraction is
underestimated accordingly (0.227, 0.132, 0.219 and 0.178 against 0.25).
In the multi-species cases the simulation with one width per class correlated at 0.941-0.994 and the one with per-atom amplitudes at 0.995-0.999, against 0.995-0.999 for the proposed one.
8.2 Radial profiles¶
Case R6, where the light species is broader than the heavy one at every radius. Widths are root-mean-square sigma per shell in Angstroms: fitted with its standard error, then the generating value. "Stage 1" is the width before the class tie (3.4).
| Class | Atoms | Mean radius (A) | Stage 1 | Stage 2 | Generating | Intensity / I_1 | Predicted SNR | Found in shell |
|---|---|---|---|---|---|---|---|---|
| 1 | 80 | 5.3 | 0.383 | 0.384 +- 0.002 | 0.384 | 0.996 | 66 | 100% |
| 1 | 79 | 8.0 | 0.417 | 0.417 +- 0.003 | 0.417 | 1.002 | 59 | 100% |
| 1 | 79 | 9.6 | 0.448 | 0.448 +- 0.002 | 0.448 | 1.003 | 53 | 100% |
| 1 | 79 | 10.8 | 0.473 | 0.475 +- 0.003 | 0.477 | 1.001 | 48 | 100% |
| 1 | 79 | 11.7 | 0.489 | 0.492 +- 0.003 | 0.492 | 0.998 | 46 | 100% |
| 2 | 26 | 5.7 | 0.416 | 0.434 +- 0.007 | 0.438 | 0.174 | 9.0 | 100% |
| 2 | 26 | 8.4 | 0.447 | 0.475 +- 0.010 | 0.477 | 0.162 | 7.8 | 100% |
| 2 | 26 | 9.7 | 0.466 | 0.498 +- 0.007 | 0.516 | 0.161 | 7.3 | 100% |
| 2 | 26 | 10.7 | 0.466 | 0.504 +- 0.008 | 0.532 | 0.157 | 7.1 | 96% |
| 2 | 25 | 11.7 | 0.479 | 0.528 +- 0.008 | 0.548 | 0.161 | 6.6 | 92% |
What the profiles of all radial cases show:
- Strongest class. The fitted shell width was within 0.006 A (1.1%) of the generating value in every shell of every case, including the single species cases R3 and R7 and the factor-three gradient of R4 and R7.
- Light class. With stage 2 its own profile is recovered: in R6 it is broader than the heavy class in every shell, by 6% to 14% in sigma at similar radii where 14% was generated. Stage 1 alone pulls it to the heavy profile (first width column). Over all radial cases the fitted width of the light class was within 3% of the generating value in the inner shells, up to 6% low in outer shells where detection was complete or nearly so, and up to 10% low where it was not (R2, 56-70% found): there the atoms that are found are the narrower ones.
- Intensity. The class intensity is flat in radius for the strongest class (0.987 to 1.008). For the light class it is flat within its errors in the inner shells and falls by up to 10% in the outermost ones (0.157-0.161 against 0.174 here).
- Detection. Over the light-class shells of R1, R2, R4, R5 and R6, a predicted signal-to-noise of 6.6 or more went with 88-100% of the atoms found, and 6.1 or less with 56-81%.
8.3 What the cases show¶
- Cases 1-4: both readings of "3-6:1", and both together, are within reach at these noise levels.
- Cases 5-7 and R1-R6: widths that grow towards the surface do not confuse the labels, wherever the light species sits, and the widths are recovered per class. They do limit detection: a light atom that is also broad is the hardest object (cases 6 and R2).
- Case 8: the thresholds hold when the noise is not white.
- Case 8b: when the light species is below the detection limit the answer is one class, with a coordination deficit. The aperture statistic is also at its worst here, because noise at low frequency adds coherently over the sphere.
- Cases 9-11, R3 and R7: no species is invented from broadening or from noise.
- Case 12:
Kis not tied to two.
8.4 Choice of the classification statistic¶
Three statistics were run through the same class discovery.
| Cases | Amplitude at fixed width | Integral from a single-atom fit with a width prior | Aperture intensity (3.5) |
|---|---|---|---|
| 1-4, 8, 12, R2 | right K, all labels right | right K, all labels right | right K, all labels right |
| R1, R5, R6 | right K, 98.9-99.2% | right K, 99.8-100% | right K, 100% |
| 5 | K = 3 | K = 2, 99.8% | K = 2, 100% |
| 6 | K = 3 | K = 2, 85.7% | K = 2, 100% |
| 7 | K = 3 | K = 1 | K = 2, 100% |
| R4 | K = 1: the light species is not seen | K = 1 | K = 2, 100% |
| 10, single species | K = 2: 37% of the atoms called a second species | K = 2 | K = 1 |
| 11, single species | K = 2 | K = 1 | K = 1 |
| 9, R3, R7, single species | K = 1 | K = 1 | K = 1 |
| 8b | K = 1: the light species was not detected | K = 1 | K = 1 |
The amplitude at a fixed width has the lowest noise and is the wrong statistic: it reads a broad heavy atom as a lighter species. An earlier review of the first draft (2026-10-07, before the one recorded in section 15) recommended it on the evidence of particles with uniform widths; this table withdraws that recommendation.
8.5 Per-species correlation maps¶
The same synthetic maps, correlated with the Pt template, with the Ni template, and the voxel-wise maximum of the two. "Gate" is the Otsu threshold of the present flow.
| Case | Correlation of the two maps | Weak peak / strong peak | Gate / strong peak | Weak atoms above the gate: Pt map, Ni map, maximum |
|---|---|---|---|---|
| 1 (intensity 3:1) | 0.9955 | 0.34 | 0.25 | 132, 132, 132 of 132 |
| 2 (intensity 6:1) | 0.9957 | 0.17 | 0.25 | 0, 0, 0 of 132 |
| 4 (intensity 6:1) | 0.9955 | 0.17 | 0.25 | 0, 0, 0 of 75 |
The three maps behave as one. At 3:1 the weak atoms clear the gate in all of them, and the threshold criterion of the present flow then drops them: level 1 of case 1 returned none.
8.6 Repeats¶
Five seeds each for cases 2, 4, 6, 9, 10, R1, R2 and R3 (40 runs): the right
K in 40 of 40 and every label right. In the 15 single-species runs K was 1
throughout and one noise peak was accepted in one run. Recall of the light
species ranged over 73-75 of 75 (case 4), 60-74 of 132 (case 6), 94-107 of 132
(R1) and 75-89 of 132 (R2), and its intensity estimate over 0.162-0.187 where
0.167 was generated.
False atoms over all 60 runs of sections 8.1 and 8.6: five, one each in five runs. The one that was examined (case 1) was accepted at stage B, at a surface site with four accepted neighbours.
8.7 Not covered¶
split_atoms, discard_atoms, validate_atoms, the soft mask and the
iterated-conditional-modes denoising that a map may have been through
(icm_imgfile) were not emulated. Atoms are exact Gaussians, the background is zero,
positions are not refined, the particle is a sphere, and the noise is
stationary. The noise levels are guesses; what transfers is the
signal-to-noise scale of section 7. D = 3, the class-size floor and the 5%
floor on tau_k are starting values; the detection thresholds are
calibrated per map (3.2), and the target of 0.2 false atoms per particle is
a starting value.
8.8 Checks of 2026-10-08¶
A second implementation of the generator of section 8 and of the detector of
3.3 (codex_checks.py, numpy only, written without reference to
emul_species.py) was run to test the review's points about the thresholds
and the gate. Same box, sampling, template, lattice and diameter; its own cut
of the sphere gave 531 atoms, 210 of them with coordination 9 or less (528
and 195 in the emulation of 8.1); the level-1 set was taken as the strong
class at its true positions jittered by 0.05 A and fitted on the map, as the
emulation found it in every case; stage-1 fits with positions fixed and no
background; six noise maps per colour, five seeds per case.
Noise maxima above k in a pure-noise z map, standardised with the region's
mean and standard deviation, per map (search over the shipped sphere of
radius 21 A, 845,000 voxels; over the particle envelope of radius 14.7 A,
291,000 voxels; and inside the noise region, 233,000 voxels):
| Noise | k = 3.5: sphere, envelope, region | k = 4 | k = 4.5 | k = 5 | Gaussian tail x sphere voxels at k = 4 |
|---|---|---|---|---|---|
| white | 29.0, 10.3, 7.2 | 4.2, 1.5, 1.2 | 0.33, 0, 0 | 0, 0, 0 | 26.8 |
| band-limited at 1 A | 27.3, 10.2, 6.7 | 4.2, 1.5, 1.3 | 0.67, 0.17, 0 | 0, 0, 0 | 26.8 |
| strongly correlated (2.5 A) | 11.3, 4.2, 2.3 | 2.3, 0.67, 0.83 | 0.33, 0, 0.33 | 0, 0, 0 | 26.8 |
The region's count scaled by volume predicted the sphere's count at k = 4
to within a factor 0.98, 0.86 and 0.77. The calibration of 3.2 gave k =
5.01, 5.00 and 4.73 for a target of 0.2 false atoms per particle, with 0,
0 and 0.17 observed at those thresholds. For the tester of phase 1: the
white-noise region counts above 2.5, 3.0 and 3.5 were 154.5, 38.0 and 7.2
per map, the search-to-region volume ratio 3.628, the fitted C 2105
(the Euler-characteristic value for white noise smoothed by the template,
V / FWHM^3 (4 ln 2)^(3/2) / (2 pi)^2, is 1656), and the resulting k
4.99. detect_peak_thres_fdr of
simple_segmentation.f90 (the false-discovery-rate routine: median and
robust spread of the peak values as the null, Benjamini-Hochberg selection
bounding the expected fraction of false discoveries at q = 0.05), applied to
all local maxima of the sphere, selected 0.2 to 0.3 noise peaks per map: the distribution of maxima
(mean z 1.84, spread 0.73) has a heavier right tail than its median and
spread describe.
Recall of the weak atoms and false atoms per particle at noise 0.05 with surface broadening, three cases: the surface shell of case 6 (132 weak atoms at intensity 1/6, coordination 5 to 9); a weak-only domain (118 atoms with x > 4 A at intensity 1/6, 57 of them interior); 40 weak adatoms at intensity 1/6 on sites of coordination 2 to 4 outside a single-species particle. "Calibrated" is the threshold of 3.2 (5.0 within 0.02 on these maps).
| Variant | Shell: recall, false | Domain: recall, false | Adatoms: recall, false | Domain interior (coordination 10-12) | Domain surface (5-7) |
|---|---|---|---|---|---|
| stage A only, k = 5 | 25.5%, 0.2 | 58.6%, 0 | 24.5%, 0 | 93% | 26% |
| A at k = 5, B gated at k = 4 | 60.6%, 0.4 | 77.6%, 0.4 | 57.5%, 0.2 | 99% | 55% |
| A at k = 5, B ungated at k = 4 | 66.2%, 3.8 | 82.4%, 3.2 | 68.0%, 3.8 | 100% | 64% |
| A at k = 5, B ungated at k = 4.5 | 45.9%, 0.6 | 71.0%, 0.6 | 43.0%, 0.4 | 99% | 43% |
| calibrated A, gated B at k = 4 | 60.6%, 0.4 | 77.6%, 0.4 | 57.0%, 0.2 | 99% | 55% |
detect_peak_thres_fdr, q = 0.05, ungated |
55.5%, 1.6 | 76.8%, 1.4 | 52.5%, 0.4 | 99% | 54% |
| A at k = 5, B gated at k = 3.5 | 72.3%, 0.8 | 84.9%, 0.8 | 70.0%, 0.2 | 99% | 70% |
The ungated search at k = 4.5 is the one with a false count close to the
gated stage B's; the gate wins against it everywhere. The FDR routine
controls what it promises (its false discoveries are 2% of its discoveries
here) but admits three to four times the gate's false atoms at lower recall.
The gated stage B at k = 3.5 shows the gate can be pushed; its false count
doubles and it was not adopted.
Contamination of the region by an undetected weak-only domain, with the
level-1 atoms excluded by 1.5 d_NN: standard deviation measured over true,
1.054 at a mask radius of 21 A (337,000 voxels, 29 undetected atoms inside
the region), 1.356 at 16 A (30,500 voxels), 1.398 at 14 A (12,100 voxels);
robust spread 1.019, 1.221, 1.298. With the surface shell undetected
instead: 1.000 to 1.002, no weak atom inside the region.
What these checks do not change: they use the same idealised generator as section 8, so they say nothing about reconstructions, backgrounds, the five-Gaussian kernels or position refinement. That is what section 10.8 is for.
9. Code map¶
The prototype touches detect_atoms and the modules under it, and nothing
else that runs today. Every new behaviour sits behind a condition that is
false for a run as it is given today (element present, discover_species
absent), so the present path is the same code executing the same branches.
New: src/main/nano/simple_nano_species.f90, array numerics with no image
dependence: the mixture fit, BIC, admissibility and the choice of K
(fit_species_mixture(x, s_meas, nspecies_in, K, labels, post, mu, var); the
routine is not named after the key; the fit itself is the extreme
deconvolution xd_gmm of src/utils/clustering/, driven in one dimension
from the two starts of 3.6, so the module owns no EM of its own), the
enclosed-fraction function F of 3.5, and the threshold calibration of 3.2
from an array of region maxima counts. Tester
simple_nano_species_tester.f90, sub-suite species of unit_single
(table suites_single in simple_commanders_test_class.f90, list in
simple_test_ui_class.f90, checked by scripts/check_test_registry.py).
src/defs/simple_defs_atoms.f90: the pseudo-atom symbols X1, X2, X3
in get_element_Z_and_radius, each with its own sentinel Z in a reserved
range held in named constants (precedent CDSE, 999; the range must not
collide with it), radius 1.0 until the data give 0.4 d_NN.
src/main/nano/simple_atoms.f90: convolve gets the pseudo-atom branch of
section 4 for Z in the reserved range, reading beta as B and
occupancy as q; element_exists, set_element, guess_an_element and
Z_and_radius_from_name accept the symbols. The per-element table, epot
and every existing branch stay as they are. simple_atoms_tester.f90
gains the closed-form tests of phase 1.
src/main/nano/simple_nanoparticle_utils.f90: phasecorr_one_atom gets an
optional kernel width (B_ref) and, when it is given, correlates with the
pseudo-atom instead of the element; est_nn_dist(centers); find_rMax and
calc_contact_scores get an optional d_NN that replaces the element
lookup. Callers that do not pass the new arguments behave as before.
src/main/nano/simple_nanoparticle.f90:
- a logical
l_species_free, set innewwhenparams%elementis empty.newthen does noZlookup;theoretical_radius, the neighbour cutoff and the contact-score ceiling are set fromd_NNonce the first binarisation has produced centres (section 2), inidentify_atomic_pos, beforediscard_small_ccs. With an element,newis unchanged. atom_stats:amp,bfac,bfac_stage1,aper_int,aper_snr,det_z,det_stage,det_level,gate_used,species,species_post.cendist,u_isoandisocorrexist.identify_atomic_pos: the present sequence, with the pseudo-atom template and thed_NNlength scales substituted at the element entry points whenl_species_free(phasecorr_one_atomat:587,t2cthroughwrite_centersandatoms%convolve,calc_contact_scoresat:1045,:1121,:1156,get_lattice_paramsat:1032-1033,simulate_atomsat:1775-1776). Afterdiscard_atoms, and only whenparams%l_discover_species:fit_atoms_jointon the level-1 atoms (stage 1, the provisional fit that the subtraction of 3.3 needs),est_noise_region,calibrate_threshold,detect_residual_levels,prune_recovered,fit_atoms_joint(both stages, merged set),calc_aperture_int,assign_species, a diagnostic render of the class-intensity, per-width simulation into a scratch image through the pseudo-atomconvolve(for the recovered atoms'valid_corrcolumn; not written to disk),write_species_report,write_radial_profiles; then the present output block, unchanged, from the level-1 atoms. The recovered atoms live in a second atom table (recovered(:)of the same type) so that nothing that writes the present products can see them until promotion.l_species_freebelongs to the nanoparticle (set innew);l_discover_speciesandmin_nbrsbelong toparameters, derived from or validated with the keys insimple_parameters_phases.f90.simulate_atoms,write_centers,kill: unchanged in the prototype, except thatkillfrees the new table.
calc_isotropic_disp stays for atoms_stats. Its log-linear estimator over
positive voxels is biased in noise (at noise 0.03 it returned amplitude 0.91
and sigma 0.371 A for true 1 and 0.350); atoms_stats can take u_iso from
the stage-2 fit once that exists.
Parameters and UI, prototype: element becomes optional
(required_override=.false.) in detect_atoms only
(single_ui_atom.f90:226-227); three new keys on detect_atoms:
discover_species (yes|no, default no: residual recovery and the species
call, diagnostics only), nspecies (integer, default 0 = automatic K),
min_nbrs (integer, default 3, 0 = no neighbour requirement); vol_even
and vol_odd (existing
keys) accepted as the optional half maps of 3.2. The thresholds other than
the calibrated ones stay module constants. exec_detect_atoms
(simple_commanders_atoms.f90:405-423) validates the combination before
params%new: nspecies and min_nbrs need discover_species=yes; both
half maps or neither. atoms_stats, autorefine3D_nano,
conv_atom_denoise and analysis2D_nano keep requiring element until
promotion.
Later, with promotion (section 10.8): element optional in the other four
programs; simulate_atoms sets occupancy and beta per atom and
write_centers writes symbol, chain, occupancy and B; data-derived
components for the recovered atoms (section 6); autorefine3D_nano passes
the half maps to detect_atoms and copies the species files with the
other per-iteration products; analysis2D_nano without an element cannot
build the ideal-lattice start (Q4).
Phase 4 adds, in the same areas: parse_element_list in simple_atoms.f90
with its tests in the atoms tester; the bfac_pdb argument of convolve
(section 4); pdb_bfac through the whole parameter lifecycle, declaration
and default in simple_parameters.f90 with its logical, registration in
simple_parameters_parse.f90, yes|no validation and the pdbfile
dependence in simple_parameters_phases.f90, the key on
simulate_nanoparticle in single_ui_atom.f90, and the flag passed to
convolve in exec_simulate_nanoparticle (simple_commanders_sim.f90);
species(:), l_species_list and the list parsing in the parameters
(section 5); the list rules in exec_detect_atoms; species(:) copied
into the nanoparticle in new for write_species_pdb. And the sizing by
nspecies of everything that was sized by MAX_NSPECIES: the arrays of
fit_species_mixture and its optional bic and admissible results
(allocatable, kmax = nspecies_in when given, MAX_NSPECIES when the
search is automatic); the posteriors, which leave atom_stats
(species_post(MAX_NSPECIES)) for an (n, K) array of the nanoparticle;
the POST columns of _species.csv, written for K with a header the
test reads; the chains of _species.pdb (letters, then digits); the bound
nspecies <= 3 in simple_parameters_phases, which goes.
The compound selectors CdSeR, CdSeW, CdSeZ (phase 4; the
maintainer asked on 2026-10-08 that the present species mixtures be handled
correctly). Today nanoparticle%element is character(len=2), so the
selector is cut to Cd before every lattice lookup, which then falls back
to fcc with a = 3.76 (simple_nanoparticle.f90:216, :300, :1115,
:1804, :2459; the table is get_lattice_params in
simple_defs_atoms.f90:223-271, which knows CDSER, CDSEW and CDSEZ),
and the utilities fit_lattice, run_cn_analysis, strain_analysis,
calc_contact_scores and find_rMax take the element as
character(len=2) and cut it the same way. Widening those arguments alone
is not a repair: find_rMax uses the one value for the lattice table,
where CDSEW is valid, and for get_element_Z_and_radius, where it is not
and stops (simple_nanoparticle_utils.f90:271 and following), and
strain_analysis uses it for the lattice and for PDB names. The repair
keeps two values apart everywhere: the selector as given (element_key,
five characters, for every lattice lookup) and the two-letter symbol of
the first species (for radii, atom names and set_element). The utilities
take the selector as character(len=*) and derive the symbol as its first
two characters themselves, as simulate_nanoparticle does (el1,
simple_commanders_sim.f90:439); the nanoparticle holds both. For a
one-element selector the two values coincide and nothing changes, so the
Pt regression stays byte-identical; for the compound selectors the lattice
becomes the one the table defines, a change on a path that was wrong.
Regressions: find_rMax('CdSeW') and get_lattice_params('CDSEW') in a
unit test; and single_atoms_stats run a second time by CTest with
element=CdSeW (the program already takes element), with the Pt floors.
If its assertions prove specific to the fcc coordination, they are
parameterised by the crystal system, not skipped.
A compound selector is also a species statement: CdSeW says the particle
holds cadmium and selenium. The parser of section 5 therefore returns, for
a selector, the symbols it names (Cd, Se, in the order written, which
for the three selectors is the brighter first) together with the selector
itself; without discover_species=yes nothing more happens than today
(now on the right lattice), and with it the species call runs with K = 2
and those names, exactly as element=Cd,Se would, but with the wurtzite,
zincblende or rocksalt lattice of the selector instead of the close-packed
cutoff of the first symbol. A comma list and a compound selector together
(CdSeW,Pt) are rejected.
Ruling of 2026-10-08 (23:30): the lattice analysis of the compound
crystals is repaired in phase 4. Phase 4 found that the selector, once it
reaches fit_lattice, run_cn_analysis and strain_analysis, breaks them:
they had only ever been reached with the fcc fallback. fit_lattice fitted a
cubic grid inside the wurtzite cutoff (a of 6.1 to 6.5 A), the wurtzite
branch of run_cn_analysis put its cutoff near 8 A (coordination numbers
of 24 to 76 where the fallback gave 1 to 4), and its zincblende branch was
dimensionally wrong. The maintainer chose to repair the analysis rather
than keep the fallback:
- The coordination number of a binary crystal counts its first shell, the
bonds between the two species: 6 in rocksalt, 4 in zincblende and in
wurtzite. The cutoff is the midpoint between the bond length and the
second-shell distance of the fitted lattice: rocksalt
a/2anda/sqrt(2), zincblendesqrt(3) a / 4anda/sqrt(2), wurtziteu c(u= 3/8) anda. One function gives the cutoff of every crystal system tofind_rMax,run_cn_analysisand the other copies of the formulas; fcc, bcc and the single elements keep their present formulas exactly. - For the three compound systems
fit_latticederives the lattice from the median nearest-neighbour distancedover all atoms instead of fitting a cubic grid: rocksalta = 2 d, zincblendea = 4 d / sqrt(3), wurtzitea = d sqrt(8/3)andc = a sqrt(8/3). strain_analysisassumes a cubic grid of stepa/2: rocksalt runs it with the fitteda; zincblende and wurtzite skip it with a logged message. No hexagonal strain model is invented.single_atoms_statswith a compound selector asserts what would have caught the defect: the standard coordination number of the interior atoms (the inner 30% by distance from the centre) and the fitted lattice constant within 2% of the table. It runs forCdSeW, and forCdSeZandCdSeRifsimulate_nanoparticlebuilds them. The cutoff function is unit-tested for the five crystal systems against the closed forms.PbSe, which also reaches its rocksalt table entry now, follows the same rules.
10. Phases and the tests that gate them¶
Sections 10.1 to 10.4 are phases 0 to 3, the first run (done 2026-10-08); 10.5 and 10.6 are phases 4 and 5, the second run; 10.7 is its phase 6, added and then withdrawn by rulings of 2026-10-09; 10.8 is what comes after them; 10.9 is phases 7 and 8, the third run, which validates on real maps and changes no code; 10.10 is what the validation leaves open, with two options and the ruling; 10.11 is phase 9, the fourth run, which measures the chosen option on the real maps.
10.0 Rules of coexistence¶
The present detection is working production code with a regression test, and it stays that way throughout. Concretely:
- No existing routine changes its behaviour for a call as it is made today.
New behaviour is reached only through
l_species_free(noelement) orl_discover_species(discover_species=yes), both false for every existing caller and every existing test. Optional arguments added to utilities default to the present behaviour. single_atoms_statsis run on every phase's build and must pass with its present floors; its atom count, recall, precision, root-mean-square error and correlation are recorded in Progress each time and compared with phase 0. Any drift is a stop condition, not something to explain.- The present products are written by the present code from the level-1 atoms; the prototype writes only its own files (section 6).
- No new CMake target, no per-file compile option, no new global flag
(
doc/policies/compile_time_policy.md); a new tester goes into the existingunit_singleexecutable through the suite table; a new CTest entry raisesSIMPLE_CTEST_BUDGETinproduction/CMakeLists.txtby one. - Release 4 rules: nothing is aliased or kept for compatibility; the only
on-disk format that must keep reading is the
.simpleproject. - The fast gate (
scripts/run_fast_gate.sh: the test-registry, description andscripts/check_flex_dag.pychecks, then thefastandprovisionalCTest labels) passes at the end of every phase, in Debug.
10.1 Phase 0: baseline¶
Build the copy as it was handed over (Debug with BUILD_TESTS=ON, the
machine's compiler and environment recorded), run the fast gate and
single_atoms_stats, and record its numbers. Then run the same simulation
and detection by hand (simulate_nanoparticle element=Pt moldiam=20
box=160 smpd=0.358, detect_atoms element=Pt) and keep the input volume,
simatms.pdb and _ATMS.pdb under the run's scratch/keep/: they are the
reference of phase 2's equivalence test. Record the atom count of
simatms.pdb and of _ATMS.pdb, the positions' root-mean-square
difference and the _SIM.mrc correlation. Exit: fast gate passes;
single_atoms_stats passes; the reference is kept and its numbers are in
Progress.
10.2 Phase 1: foundations that change nothing¶
The pseudo-atom kernel in convolve with its symbols and the PDB round
trip through occupancy and beta, so that simulate_nanoparticle
pdbfile= renders pseudo-atoms; and simple_nano_species with its tester.
Exit: unit tests on one and two pseudo-atoms against the closed forms (peak
q (4 pi / B)^(3/2), voxel sum q / smpd^3 within 1% at a cutoff of
4 sigma, two atoms adding linearly), and a round trip PDB to atoms to PDB
preserving symbol, occupancy and B; discover_species returns the right
K, labels and BIC ordering on fixed samples (one class; two classes at
D of 2.5 and 4, the first inadmissible; a class below the size floor;
three classes; fit_species_mixture) and the calibration returns 5.0
within 0.1 from the region counts of section 8.8 (white noise) scaled to
its geometry; the species
sub-suite is registered and scripts/check_test_registry.py is clean; fast
gate; single_atoms_stats unchanged against phase 0.
10.3 Phase 2: level 1 without an element¶
d_NN, the derived length scales, the Gaussian template, element
optional in detect_atoms. Exit: detect_atoms on the phase 0 input
volume without element gives the same atom count as the reference within
1%, positions matched within 0.5 A with a root-mean-square difference of
at most 0.1 A, and the same _SIM.mrc correlation within 0.01; the same
command with element=Pt gives a _ATMS.pdb identical to the reference
(same count, positions within 1e-3 A: the element path did not move); the
measured d_NN is within 2% of 2.766 A (Pt, a = 3.912); fast gate;
single_atoms_stats unchanged. If the species-free count differs by more
than 1% the phase stops and reports which step (template, threshold
ladder, splitting, pruning) lost or gained the atoms, with the counts after
each.
10.4 Phase 3: residual recovery and species call, diagnostics only¶
Noise region and half-map reference, calibrated thresholds, the two stages
with the gate switch, pruning of the recovered atoms on the atom table,
both fit stages, aperture intensities, species assignment, radial profiles,
the files of section 6. The fixtures are rendered by
simulate_nanoparticle pdbfile= from pseudo-atom PDBs written by the test
itself (the generating models of cases 2, 9, R3 and R6 of section 8 on the
Pt lattice of phase 0's particle, so that level 1 is known to work on them),
with Gaussian noise added in process at a fixed seed and at the section 8
noise levels relative to the peak of a core atom of the strongest class.
Exit, as a new high-level test species_discovery (registered like
single_atoms_stats, budget raised by one): for the two-species fixtures,
recall of the weak class at least 0.90 where its predicted detection
signal-to-noise (section 7) is 6.5 or more, no more than one false atom per
particle, K = 2, every label of a found atom right, the intensity ratio
within 10%, the per-shell width of the strongest class within 3% and of the
light class within 10%; for the single-species fixtures, K = 1 and no
recovered atom; for every fixture, _ATMS.pdb, _BIN.mrc, _CC.mrc,
_MSK.mrc and _SIM.mrc identical to the run of the same command without
discover_species (the products did not move); fast gate;
single_atoms_stats unchanged. The floors are those of the emulation and
are set before the first run; a floor the code does not reach stops the
phase with the measured value, it is not lowered.
10.5 Phase 4: B factors in the element kernels and the species list¶
The second run starts from the maintainer's checkout after the first run and its follow-ups (section 16 and the report list them). Two rulings of 2026-10-08 define it: B factors go into the element kernels now, as an opt-in (section 4), and the species of a synthesised particle are given on the command line as a list (section 5). The reason is the review's main objection, model-matched evidence: the test of phase 3 renders pseudo-atoms that the detector fits exactly, so a pass shows that the code does what the emulation did; the five-Gaussian element kernels are the independent model SIMPLE has had all along, and with B factors they can render everything the design is about.
Work: the bfac_pdb argument of convolve and the pdb_bfac key of
simulate_nanoparticle (section 4); the list parser parse_element_list
in simple_atoms, the parameters and the commander rules of section 5, the
species names in _species.pdb (section 6); the compound-selector repair
and the selectors as species statements (end of section 9).
Exit, besides the checks every phase makes (10.0):
simple_atoms_tester: an element atom rendered withbfac_pdbatB= 0 and atB= 20 A^2 conserves its voxel sum within 1%, and its peak falls bysum_j a_j / (b_j + bfac + B)^1.5oversum_j a_j / (b_j + bfac)^1.5within 1%, withbfac = (4 lp)^2the blurconvolvealways adds ((8 smpd)^2= 8.2 A^2 at 0.358 A withoutlp; for Pt andB= 20 the ratio is 0.243, not the 0.007 one gets by leaving the blur out); the default leaves the B column unread (same voxels as before the change); a pseudo-atom is unaffected by the flag.parse_element_list:Pt,NigivesPt,Niin that order;Ni,PtgivesNi,Pt;Ptalone is one symbol and not a list;Pt,Pt,Pt,,,Pt,Pt,XxandPt,X1are rejected with a message, without stopping, since a fatal error cannot be asserted in process; a list of five symbols is accepted and sizesnspeciesto five;Pt,is rejected as a list of one.simple_nano_species_tester:fit_species_mixturewithnspecies_in= 4 on a four-class sample (means 1, 0.6, 0.35, 0.2, spread 0.02, 100 atoms each) returns four classes with every label right and the means within 0.02, andbicandadmissibleof size 4; withnspecies_in= 0 on the same sample it returns 3, the ceiling of the automatic search, which is what the ceiling means.simulate_nanoparticle pdbfile= pdb_bfac=yeson a PDB of three Pt atoms with B factors 0, 10 and 20 A^2 gives three peaks in that order with equal voxel sums (recorded); without the key the three atoms are identical.- The phase 0 reference regenerated with the commands of its Progress entry
(the first run's directory is not relied on):
element=Ptreproduces its numbers. Discovery needs noise (the noise region's standard deviation calibrates the thresholds, and a noiseless map stops with a message), so the comparison runs use one noisy copy of the reference volume, Gaussian noise at a fixed seed with a standard deviation of 0.05 of a core Pt peak, added once and read by every run: on that copy,element=Ptandelement=Pt,Nigive the five present products byte-identical, andelement=Pt,Niwrites_species.pdbwithPtandNiin the element column,_species.csvwithPOST1andPOST2, and a four-symbol list (Pt,Ni,Al,Si, a wrong statement about a Pt particle, accepted as a statement) writesPOST1toPOST4, chainsAtoD, and reports the four-class fit inadmissible. - The parameter truth table of section 5 holds, checked by hand for every row with a fatal outcome and recorded.
find_rMax('CdSeW')returns the wurtzite cutoff andget_lattice_params('CDSEW')the wurtzite lattice in a unit test;parse_element_list('CdSeW')returnsCd,Seand the selector;single_atoms_statswithelement=CdSeWpasses as a second CTest entry (SIMPLE_CTEST_BUDGETraised by one), its numbers recorded next to the Pt ones;element=CdSeW discover_species=yeson that fixture writes a_species.pdbwithCdandSein the element column.
10.6 Phase 5: the species test on element ground truth¶
species_discovery is rebuilt. No pseudo-atom fixture remains in it; the
pseudo-atoms keep their unit tests and their role as the detection
template.
Fixtures. The Pt lattice that simulate_nanoparticle element=Pt moldiam=20
box=160 smpd=0.358 writes (285 atoms); a chosen set of atoms relabelled
with a second element; every atom given B_i = B_SURF (r_i / r_max)^2 with
B_SURF = 10 A^2, an added displacement variance of B / 8 pi^2 = 0.127
A^2 at the surface (what doubled the variance of a 0.35 A Gaussian in the
emulation; on an element kernel with the default blur the effective
broadening is smaller and element-dependent, and the fitted widths are
recorded rather than compared with a generating sigma); rendered with
simulate_nanoparticle pdbfile=model.pdb pdb_bfac=yes at box 160 and 0.358
A (no lp); Gaussian noise added in process at a fixed seed, with a
standard deviation of 0.05 of the peak of a core Pt atom measured on the
clean render. Four cases:
| Case | Composition | Runs |
|---|---|---|
| pure | Pt only | element=Pt; element=Pt discover_species=yes; element=Pt,Ni; no element; no element with discover_species=yes |
| alloy | Pt, a random quarter Ni | element=Pt; element=Pt,Ni; element=Pt,Ni with half maps; no element; no element with discover_species=yes |
| core | Pt skin, the innermost quarter Ni (ruling of 2026-10-09, fourth; replaces the shell case, a Pt core under the outermost quarter Ni) | element=Pt; element=Pt,Ni |
| light | Pt, a random quarter Al | element=Pt; element=Pt,Al; no element; no element with discover_species=yes |
The runs without an element are the blind mode on element kernels, which the first run covered only on pseudo-atoms. Half maps are two renders with independent noise at sqrt(2) times the standard deviation, whose average is the map.
Ground truth, measured: one isolated atom of each element at B = 0,
rendered the same way in a box of 64, integrated (voxel sum times
smpd^3), gives the generating intensities and their ratios. From the
coefficients in convolve (the integral is proportional to the sum of the
a_j), Pt over Ni is 1.65 in the integral and 2.0 in the peak at the
default blur, closer than HAADF contrast will give, so the harder case for
the species call; at that contrast the Ni atoms are expected to be found at
level 1, so the alloy and shell cases test the species call, the fits and
the widths on element kernels, not the residual recovery. The light case is
there for the recovery and for the design's central claim: aluminium (Z =
13) is a diffuse atom whose integral is only 1.84 times below platinum's
while its peak is 3.5 times below. The peak is what the first threshold
sees, so this is the regime of case 1 of section 8, where the first
threshold dropped the light atoms and the residual levels found them; the
integral is what the species call sees, so the classes separate on the
integral ratio, not the peak ratio.
Eligibility for the recall floors is defined without the fit, so that it
cannot be circular, and from each atom's own signal, so that neighbours
cannot lend it: a generating atom is eligible when its marginal signal,
the peak of its own kernel (its element at its own B_i, rendered alone
in a small box and filtered with the detection template, a Gaussian at
B_ref), divided by the standard deviation of the added noise filtered
the same way, is 6.5 or more. Both come from what the test rendered, and
the eligible set of a case is computed once and used by every run of that
case, so that a plain run and a recovery run are compared on the same
atoms.
Floors, written into the test before its first run, none lowered:
- Within a case, the five present products are identical across every run
with the same
elementvalue (files_identical): the list, the key and the half maps do not move level 1. This holds forPtagainstPt,NiandPt,Al, and for no element against no element with the key. - Pure case:
K= 1 and no recovered atom withelement=Pt discover_species=yesand with no element and the key; withelement=Pt,Ni, no recovered atom and the two-class fit reported inadmissible in_species.txt. - Every run of every case: recall of the strong class (Pt) of at least
0.98 over its eligible atoms, and recall over all eligible atoms of all
species of at least 0.95 for runs with discovery (the species call is
not allowed to pass while most atoms are missing); at most one false
atom (a found atom with no generating atom within
0.3 d_NN, or a second atom on one site). - Alloy, shell and light, with the list: every found atom within
0.3 d_NNof a generating atom carries that atom's element; the two-class fit admissible; recall of the light element of at least 0.90 over its eligible atoms; the fitted intensity ratio within 10% of the measured single-atom ratio;_species.pdbwith one atom per table row and the element column equal to the symbol of the table's class. - Light case: over the same eligible Al atoms, the
element=Ptrun finds fewer than 90% of them, otherwise the fixture does not test the recovery and the phase stops to have it redesigned (a lighter element, or a lower noise); theelement=Pt,Alrun finds at least 90% of them, so the difference is the residual levels' work, recorded by stage and level. - Alloy and light without an element, with the key:
K= 2 and every label of a found atom right, class 1 being the heavier element. - Widths, reported and not floored (ruling of 2026-10-09, after the merge):
the stage-2
Bof the Pt class in the inner and the outer radial shell of_species_radial.csv, the generated rise (B_RISEtimes the difference of the shells' mean(r / r_max)^2over the generating atoms in them), and their ratio. The floor first written here (the ratio between 0.5 and 1.5) was withdrawn: on filtered maps the fitted rise carries a coordination artefact (section 7), so the ratio measured the artefact as much as the fit; it ran at 1.28 to 1.42 on the Dell and failed at 1.60 on the maintainer's Mac in the core case, whose Pt class is only the outer skin and whose generated rise (2.9 A^2) is the smallest. - With half maps:
noise_sourceishalf_mapsand the label agreement between the halves is at least 0.95. - Every check and every measured number above goes through
test_gate(simple_test_gate:check,metric,report) intometrics.tsvin the test's directory, as the test policy requires of a workflow test; the test passes when the gate has no failure. The test removes its fixture tree when it ends, pass or fail.
detect_atoms runs with the test's thread count. The CTest entry keeps its
name, label and budget; if it exceeds its timeout in Debug the timeout is
raised, not the cases cut. If a floor is not met, the phase stops with the
measured values and, for a false atom, its position, its distance to the
nearest Pt atom and the residual z map's value there: this is the first
contact between the method and non-Gaussian atoms, and the maintainer
decides.
Ruling of 2026-10-09: the fixtures are made to look like a real Pt map;
level 1 is not changed. The first run of the rebuilt test stopped: on the
pure fixture, level 1 found 3 of 285 atoms at some noise seeds (its
threshold search lands on a plateau where the whole particle is one
component), and the fitted intensity ratio missed its 10% floor. Level 1
works on real data, so the fixture is at fault. A real map supplied by the
maintainer (recvol_state01_iter005.mrc, 160^3 voxels at 0.358 A, with the
_ATMS.pdb of 476 atoms that production detect_atoms wrote) differs from
the fixture in four measured ways: a core atom is as wide as a Pt kernel of
total B 21 A^2 (the fixture: 8.2, the default blur only); the surface
peak is 0.75 of the core peak (0.41); between atoms inside the particle the
map sits 2.1 background standard deviations below zero (the fixture: 0.6
above, a pedestal from the kernels' tails); and its noise is concentrated
at low frequency, where the fixture's was white. The core peak is 17
background standard deviations in both. The rules:
- Level 1 and everything on the present path stay as they are; the floors above stand.
- The fixtures take the real map's measured properties, as named constants
of the test: per-atom
B = 12.8 + 6 (r / r_max)^2A^2 on top of the default blur, replacingB_SURF; the clean render filtered in Fourier space by the measured signal transfer relative to 2 to 2.5 A (0.37 beyond 20 A, 0.50 at 10 to 20 A, 0.86 at 5 to 10 A, 1 from 5 A to 1.6 A, then a cosine fall to 0 at 1.1 A, interpolated between shell centres); white Gaussian noise shaped by the measured background amplitude per shell (10-20 A 0.364, 5-10 A 0.339, 3.3-5 A 0.415, 2.5-3.3 A 0.322, 2-2.5 A 0.249, 1.6-2 A 0.172, 1.3-1.6 A 0.136, 1.1-1.3 A 0.119, 0.95-1.1 A 0.105, 0.8-0.95 A 0.096, 0.72-0.8 A 0.088; the lowest shell takes the 10-20 A value), interpolated between shell centres and scaled so that the mean core-atom peak of the filtered clean render is 17 standard deviations of the noise measured outside the particle (r> 18 A); half maps as two independent draws, each scaled bysqrt(2), averaged into the map. Eligibility, ground truth and every floor are computed on these fixtures; the single-atom renders of the ground truth get the same filter. - The ground-truth intensity of an element is its isolated atom's aperture intensity, measured with the same aperture, enclosed-fraction correction and filter as the fitted atoms, not its full integral; the 10% floor stands.
- Real data by hand, recorded in Progress without floors: the present
products of
element=Pton the real map against the supplied_ATMS.pdb;discover_species=yes(K, the recovered atoms and their detection z, the admissibility of a two-class fit);element=Pt,Ni(the two-class fit inadmissible). The supplied_evenand_oddmaps are not half reconstructions of this map (they correlate 0.964 with its simulated reference_SIM.mrcand 0.49 with the map) and are not used as a noise reference. - Discovery with fewer than two level-1 atoms stops with a clear message in
the discovery code instead of inside
est_nn_dist; the present path is untouched.
Ruling of 2026-10-09 (second): the floors. The Pt recall floor of 0.98
applies to runs with discovery and to the pure case; on mixed particles the
runs without discovery (the present path) report their Pt recall without a
floor, since their misses come from the present contact-score pruning of
surface Pt atoms whose light neighbours level 1 cannot see. The intensity
floor becomes: the classes come out in the right order (the heavier element
brighter, class 1) and the two-class fit is admissible; the ratio of fitted
class intensities against the isolated-atom aperture ratio is reported, not
floored (phase 6, which was to restore it, was withdrawn: 10.7). Eligibility for the recall floors
follows the pruning of 3.9: a generating atom is eligible only if, besides
the signal-to-noise condition, that pruning would keep it, its contact
score counted against the generating strong-class atoms with the zone and
threshold computed the same way on the generating model; the number of
atoms this excludes is reported per case. The real map is rerun by hand
with the new pruning (recovered atoms kept and pruned, their radii, K,
admissibility), recorded in Progress without floors.
Ruling of 2026-10-09 (fourth): the shell case is replaced by a core
case. A light species confined to the surface layer is not a target
(section 7), and the pruning of 3.9 removes the Ni shell of the shell case,
so that case is removed from the test, not kept as a reported case. The core
case relabels the innermost quarter of the atoms by radius Ni (the Pt-skin
arrangement of Pt3Ni catalysts), with the lattice, B profile, filters and
noise of the other cases; its runs are element=Pt and element=Pt,Ni, and
its floors are those the shell case had: every found atom carries its
element, the two-class fit admissible, the class order right, the Ni recall
over the eligible atoms at least 0.90, at most one false atom, Pt recall
0.98 in the discovery run, present products identical between the two runs;
the intensity ratio is reported. Wherever the text above names the shell
case among the mixed cases, the core case stands in its place.
Ruling of 2026-10-09 (fifth): the label floor of the core case moves to phase 6. In the core case one Ni atom at the particle centre (1.7 A from it) was called Pt: the aperture intensity of the Ni atoms rises toward the centre (154 at 5 to 7 A, 188 at 3 to 5 A, 215 inside 3 A, against a Pt class at 357), the environment-dependent bias of section 7. In phase 5 the core case's "every found atom carries its element" is reported (the number of wrong labels and where they are), not floored; every other floor stands. Phase 6 was to restore that floor for every case; it was withdrawn (10.7), and the core case's label count stays reported. With the common width of 3.5 (2026-10-11) the emulation labels the centre atom right in 7 draws of 7. A build of 2026-10-12, with the coordination term of 3.6 in place, labelled every found atom of the core case right, and the floor is back (Progress, before phase 9).
10.7 Phase 6, withdrawn¶
Added by the third ruling of 2026-10-09 and withdrawn by the sixth; no
source change of it remains. What was tried: after level-1 pruning, the
map's transfer per Fourier shell, T(s) = Re<F_map conj(F_R)> / <|F_R|^2>,
against a reference R that renders the level-1 atoms as unit pseudo-atoms at
B_ref, with shells correlating below 0.2 (and every shell beyond the first
such shell past 2 A) set to zero and a three-shell smoothing; a radial
kernel table K(r; B) = IFT[G(s; B) T(s)]; and every Gaussian atom of the
discovery branch (the neighbour subtraction, both width fits, the recovery
residual, the enclosed fraction of the aperture intensity, the valid_corr
render) replaced by K. What it measured: on the fixtures the correlation
cut zeroed the transfer from 1.68 A on, where the fixture's own transfer was
still above 0.3, and on the real map also at 3.3 to 7 A, the gap between the
particle envelope and the first lattice reflections; the alloy's fitted
intensity ratio came out 52% low with the cut and 37% low without it
(against 25% with the Gaussian atoms of phase 5), with surface Ni atoms
called Pt; without the cut the core's radial bias was removed (Ni intensity
flat with radius, every label right); the real map's class spread became 77%
of its mean with the cut and 42% without, against 21% in phase 5. Why it was
withdrawn: the transfer estimate, the kernel table and their parameters add
failure modes to a method that works, to correct a secondary output, the
intensity ratio; the labels are right but for one centre atom of the core
case, and the classes of real HAADF contrast are far apart. The probable
cause of the failure: a free transfer estimated against an incomplete model
(the level-1 atoms only) absorbs the unseen atoms' density at the lattice
frequencies, so the kernel carries density that belongs to neighbouring
sites.
10.8 After these phases (not part of a run yet)¶
Validation beyond the element model: particles passed through the
reconstruction's low-pass filtering and soft mask, with background and
shell-dependent noise; cross-half reproducibility of the labels on real
half maps; an A/B of detect_atoms with and without discovery on a real
Pt/Ni map at matched false-positive rate, judged by the maintainer. Then
promotion: recovered atoms into _ATMS.pdb with data-derived components in
_CC.mrc, class intensities and per-atom widths into _SIM.mrc, element
optional in the other four programs, autorefine3D_nano end to end on a
simulated two-species trajectory, atoms_stats without the lattice table.
The validation on real maps of 10.9 comes first, and so does it before the
B-factor work of atom_bfactor_model.md.
10.9 Phases 7 and 8: validation on real maps (measurement only)¶
The third run changes no source code. It runs detect_atoms in its modes on
every real map we have and measures; its products are tables and a report.
Every confidently reconstructed map is a single-species Pt particle, so on
those maps it establishes what the simulations cannot:
- the present detection still gives the stored coordinates, after everything this development changed near it;
- how often discovery reports a species that is not there, on real noise, filtering, surface disorder and partial occupancy;
- how the intensity and the fitted width of an atom depend on its coordination and radius on real maps: the coordination artefact of section 7 was measured on fixtures only, and on real maps partial occupancy of the surface works the other way. This is the evidence the B-factor work needs before it starts;
- by planting a weaker class into real maps (phase 8), a first measure of sensitivity on real backgrounds.
The first attempt (2026-10-11, arun run species_validation) stopped
being a validation in its first phase: on these unmasked maps the automatic
mask covered the box (section 7, "Mask estimate"). The present path
reproduced 33 of the 66 maps (run 4, without an element, 44), and on 11 maps
the detected atoms were background; with mskdiam set to 1.2 times the
extent of the stored coordinates every one of the 11 was found (92 to 100%
of the stored atoms within 1 A). Its other numbers, on the maps whose
particle was found, are a first look: one class on 32 of 33 maps with the
element and on 41 of 44 without; Pt,Ni inadmissible on 32 of 33; the
aperture intensity rising with coordination (+3.8% of the mean per
neighbour, median over maps) and falling with radius (1.14 to 0.87 of the
mean from the inner to the outer fifth of the atoms), and the fitted B flat
with coordination (28.9 A^2 at 6 neighbours, 28.2 at 12). Its tables stay in
that run's directory on the Dell. After the fix, phases 7 and 8 run again in
full (run species_validation_r2); the report compares the two where the
mask changed a number.
Inputs. /data/NanoX/zenodo on the Dell, read only: 66 maps
mrcs/<name>.mrc with their stored coordinates pdbs/<name>.pdb, paired by
name (names beginning ._ are macOS metadata and are skipped); 15
particles (ECT1-2, EFC1-4, ESC1-5, ESIP1-2, FC1, FCHCS1) at 2 to 8 time points
each; all Pt, 163 to 698 atoms (median 315); 0.358 A per voxel; boxes 160
(49 maps), 120 (13: ESC4, ESC5, FCHCS1) and 200 (4: EFC1). No half maps exist.
detect_atoms estimates its own mask on every map (no mskdiam), as
production does.
Build. The tree at launch, Release with tests (./compile_clean.sh,
which runs the fast gate). Before any map: species_discovery and the four
single_atoms_stats entries pass under CTest.
Phase 7: five runs per map, all with smpd=0.358, in a directory per
map and run:
| run | keys | mode |
|---|---|---|
| 1 | element=Pt |
the present detection |
| 2 | element=Pt discover_species=yes |
blind discovery with the element |
| 3 | element=Pt,Ni |
a second species asserted |
| 4 | no element | species-free level 1 |
| 5 | no element, discover_species=yes |
species-free discovery |
Measured per map, one row per map and run in validation.tsv:
- Present path (runs 1, 4). Atom count against the stored PDB; atoms
matched one to one within 1 A each way; root-mean-square and largest
distance of the matched pairs; the particle diameter the program measures
for its mask (log line
particle diameter in A:; the mask diameter is 1.2 times it) against the extent of the stored coordinates (twice the largest distance from their centroid plus one nearest-neighbour distance). - Discovery (runs 2, 3, 5), from
_species.txtand_species.csv:Kand the BIC table;admissible_K2,separation_D_1_2and the class sizes; recovered atoms kept and pruned, their radii against level 1's outermost atom and their detection z; the surface-confined flag per class; the calibrated thresholds, expected false counts and noise numbers; the single-class intensity spread againsts_I. - Intensity and width against environment (runs 2 and 5). Per
coordination number (5 to 12) and per radial fifth of the atoms: the
number of atoms, the mean aperture intensity, and the mean stage-1 and
stage-2 B; per map, the least-squares slope of B against
(r / r_max)^2and of the intensity against the coordination number. - Product identity. The five present products of runs 1, 2 and 3
identical (
cmp), and those of runs 4 and 5.
A detect_atoms that stops with an error on a map (for example discovery's
"noise region too small" on a small box) is that map's result: the message
goes into the table and the run continues with the next map.
Phase 8: planted species. On each map, after phase 7: 20% of the
level-1 atoms of run 2 that lie inside its pruning zone (prune_zone_radius
of _species.txt; the surface layer is out of reach by design, section 7),
chosen at random with a seed fixed per map. Each chosen atom keeps a
fraction r of its density, without any atom model:
- the map is multiplied by
f = 1 - (1 - r) w, wherewis 1 within0.35 d_NNof the atom centre and falls to 0 at0.5 d_NNalong a cosine (d_NNfrom_species.txt); - noise is put back so that the local noise level stays the map's: a patch
of the map's own background (centred on a random voxel at least
2 d_NNbeyond the outermost atom and inside the box, its mean over that background removed), timessqrt(1 - f^2), is added at the atom.
Levels r = 0.6 (about the Pt/Ni ratio of the potential model), 0.4 and
0.25, and a control that adds the noise of the 0.6 level (0.8 w times the
patch) without scaling anything, to show that the noise injection does not
create a class by itself. Runs 2, 3 (labels Pt,Ni) and 5 on every planted
map. Measured: recall and precision of the planted atoms among the found
atoms of class 2, false class-2 labels among unplanted atoms, K,
admissibility, D, and the fitted intensity ratio against r.
Across maps (phase 8, in the report):
- present path: the fraction of maps reproduced (98% or more of the stored atoms matched within 1 A), the rest listed with their numbers;
- false positives: the fraction of maps with
K= 1 in runs 2 and 5, withPt,Niinadmissible, the distribution ofD, of kept recovered atoms per map and where they lie, and the maps where the surface-confined flag fires; - environment: over maps, how intensity and B depend on coordination and radius, set against the fixture numbers of section 7;
- time series: per particle, whether the calls and the recovered counts stay the same across its time points;
- sensitivity: recall, precision, admissibility and ratio error against
rfor the three discovery runs, and therbelow which the planted class stops being found; - mask: the measured particle diameter against the coordinate extent, outliers listed.
Expectations, stated before the run. Not floors (no code is under test); written first so that the report compares against them:
- every map reproduced by the present path;
K= 1 in runs 2 and 5 on at least 95% of maps, andPt,Niinadmissible on at least 95%;- planted
r= 0.6 and 0.4: the planted class found with recall at least 0.9 and at most one false label per map, on at least 90% of maps; the control never reported as a second class; - the measured particle diameter within 15% of the coordinate extent on
every map (0.96 times it on
Pt_examplein a numpy copy of the method).
Products. In scratch/keep/validation/ on the Dell: validation.tsv,
environment.tsv (the per-coordination and per-shell numbers),
planted.tsv, the scripts that made them, and the detect_atoms logs. The
map outputs are deleted once their numbers are in the tables. The report is
this run's section of species_discovery_report.md: the numbers above,
compared with the expectations, readable on its own. Figures are made on the
Mac from the tables (the Dell has no plotting library).
Compute. 66 maps, five runs each in phase 7 and twelve in phase 8: about
1100 detect_atoms runs, tens of seconds each in Release, several at a time
with fewer threads each. A few hours; disk is small.
10.10 After the validation: what limits species on real maps, and two ways on¶
Proposal of 2026-10-12; the ruling is at the end of this section.
What limits it. The validation (10.9, Progress of phases 7 and 8) found no false species on single-species maps but almost no sensitivity: a class planted at 0.6 of the Pt density (about the Pt/Ni ratio) was called on 4 of 66 maps, one at 0.4 on 21. Detection is not the limit; the planted atoms were found. The limit is how much real Pt atoms differ from each other in aperture intensity (3.5):
- the spread of one class is 2.1 times its measurement noise
s_I(median over the maps; 1.7 on the pure fixture of 10.6 in the numpy copy); - most of it follows the atom's environment. The intensity rises with the number of neighbours, by 3.8% of the mean per neighbour at the median map, and falls from the centre outwards, while the fitted width does not change (section 7 and the phase 7 entry). Missing intensity without broadening is what partial occupancy of the outer sites gives; the halo effect of the fixtures runs the other way;
- a two-class fit with
D >= 3then needs a contrast of about sixs_I. A class planted at 0.6 measured 0.73 of the rest, a contrast of 0.27 of the mean, which is about fours_IonPt_example(below).
On the maintainer's Pt_example map (476 atoms) the trend is steeper: 0.72
of the mean at 5 neighbours, 1.14 at 12, 6.2% per neighbour; the spread is
2.7 s_I, and 1.5 s_I once a straight line in the coordination number is
taken out (1.3 with the radius as well; 1.6 within the atoms of 12
neighbours alone).
Option A: the environment as a term of the class fit. Each class keeps
its own mean, and every atom's intensity carries one shared term in its
coordination number c (the contacts counted for the report, 3.9):
I_i = mu_k + beta (c_i - 12) + noise, beta shared by the classes
so mu_k is the intensity of a fully coordinated atom of class k. beta
is one parameter fitted with the mixture (a one-dimensional search of the
likelihood, the extreme-deconvolution fit inside it), with no setting to
tune; a multiplicative form, I_i = mu_k (1 + gamma (c_i - 12)), behaves the
same in the checks below. The tie of stage 2 (3.7) uses the atom's own
expected intensity, mu_k + beta (c_i - 12). beta goes into
_species.txt. Risk: a species confined to low coordination (a light
species in the surface layer) is partly absorbed by beta; such a species
is not a target (section 7, ruling of 2026-10-09, fourth).
Option B: occupancy explicit. Occupancy and species are one number per
atom in a single map, so they separate only with a rule. The simple rule is
to call species on fully coordinated atoms only (12 neighbours), where full
occupancy can be assumed, and to report every other atom's intensity as an
occupancy of its likeliest class, without a species call. The full version
fits per-atom occupancy and B against the particle images in the
refinement, which is the B-factor note's preferred route
(atom_bfactor_model.md); there species and occupancy could be told apart
across the images, or across a particle's time points.
Checks (numpy, real_fit.py, classfit.py, fixture_check.py in the
arun run species_validation's numpy_checks/). On Pt_example, the
stage-1 fit and the aperture intensities of discover_species at the stored
level-1 positions, with the fixed mask and noise region, then a class
planted as 10.9 plants it into 20% of the atoms of the pruning zone, eight
seeds per level; the classes fitted to the measured intensities. A planted
class is found when the forced two-class fit is admissible; recall counts
planted atoms in class 2, false labels unplanted atoms in class 2 (for
option B only atoms of 12 neighbours, about half the atoms, are labelled).
| map | fit | admissible | recall | false labels |
|---|---|---|---|---|
| unplanted and noise control | present | 0 of 9 | ||
| option A | 0 of 9 | |||
| option B | 0 of 9 | |||
| planted at 0.6 | present | 0 of 8 | (0.96) | (203) |
| option A | 5 of 8 | 0.72 | 7 | |
| option B | 5 of 8 | 0.75 | 6 | |
| planted at 0.4 | present | 0 of 8 | (1.00) | (252) |
| option A | 8 of 8 | 0.96 | 3 | |
| option B | 8 of 8 | 0.96 | 3 |
(In brackets: the forced split of the present fit, which takes the planted
atoms together with the outer atoms of low intensity.) The fitted beta was
6.0 to 6.5% of the mean per neighbour. On the fixtures of 10.6 (emulation
arrays, seven seeds per two-species case, twelve pure), option A labels
every atom of the alloy, core and light cases right, as the present fit
does, with D higher for the alloy and the light case and 0.3 lower for the
core; on the pure particle it keeps one class (D of the forced split 0.2
to 1.2, against 1.4 to 2.1); its beta there is -1.5 to -2% per neighbour,
the halo effect, fitted from the data like the positive real one.
Recommendation. Option A, now: one parameter, all atoms classified, no
false class on the real maps or the fixtures in these checks, and the 0.4
class found on every seed instead of none. Option B's simple rule gives the
same sensitivity on the atoms it labels and labels half of them; its full
version belongs to the B-factor and occupancy work, which option A does not
preclude. The decision would rest on a phase 9 of the same shape as 10.9:
option A in fit_species_mixture and discover_species, its unit test, the
species_discovery floors kept, and runs 2, 3 and 5 with the planting on the
66 maps, against these expectations: one class on at least 95% of the
unplanted maps and Pt,Ni inadmissible on at least 95%; the class planted
at 0.4 found on at least 90% of the maps with recall of at least 0.9; at 0.6
reported.
Ruling of 2026-10-12: option A, because species are wanted soon. The
B-factor and occupancy work follows; its occupancy profile can take over the
role of beta. Option A was implemented by hand the same day (3.6, 3.7) and
is validated by phase 9 (10.11).
10.11 Phase 9: the environment term on the real maps (measurement only)¶
The fourth run (arun species_validation_coord) changes no source code. The
term of 3.6 is in the checkout, in fit_species_mixture (the optional
covariate and its slope, with the unit test test_coordination_term) and in
discover_species (the contacts counted before the class fit, the expected
intensity in the stage-2 tie, the half-map labels and the render of the
recovered atoms, and coord_slope in _species.txt); the maintainer built
and tested it before the run.
- Build and tests:
./compile_clean.sh, the fast gate,species_discoveryand the foursingle_atoms_statsentries pass; everyspecies_discoverymetric that moved against phase 7's copy is named. - The five runs of 10.9 on the 66 maps, as phase 7 ran them. Runs 1 and
4 do not touch the class fit. Since 2026-10-15, though, the size rule of
discard_atomsworks after the contact-score pass removes atoms. Before, that pass renumbered the atoms, and the size rule then read the old numbering. Their numbers against the stored coordinates may therefore differ from phase 7's, but only by atoms the size rule now removes. Every difference is named; an atom moved or added stops the run. Runs 2, 3 and 5:K, admissibility,D, the class sizes and ratios,coord_slopeper map, and the per-coordination intensities after the term is taken out. The mixture fits also stop earlier than in phases 7 and 8 (3.6), so the comparison measures both changes together. - The planting of 10.9 at 0.6, 0.4, 0.25 and the noise control, with the same seeds, so that the same atoms are planted as in phase 8 where the level-1 atoms are unchanged; runs 2, 3 and 5; recall, precision and false labels as phase 8 counts them, map by map against phase 8.
- Expectations, stated before the run: one class in runs 2 and 5 and
Pt,Niinadmissible on at least 95% of the unplanted maps; the class planted at 0.4 called (the forced two-class fit admissible) with recall of at least 0.9 on at least 90% of the maps, with false labels on at most 2% of the unplanted atoms (10.9's stricter "at most one" reported beside it); the control never a second class; 0.6 and 0.25 reported. - Products: the tables in
scratch/keep/validation/of the run, and this run's section ofspecies_discovery_report.md.
11. Relation to single_pcg_integration_completed.md / _unfinished.md¶
With pseudo-atoms the columns of G are the Gaussians of section 1, Z
drops out, and the least-squares amplitudes c = (G^T G)^-1 G^T x are the
per-atom amplitudes with neighbour overlap removed exactly. The fit of 3.4 is
a Gauss-Seidel approximation of that solve. Two points in that note need
changing for Z contrast. Its section 5, step 5 makes atoms with
c_i < 0.2 median(c) removal candidates, which would flag a whole light
species; the rule should be referenced to the noise. And its statement that
trailing reconstruction blends the simulated map away does not match the
accumulator-domain contract cited in section 0.
12. Deliberately absent¶
- Element names from the data. With two classes the intensity ratio
constrains
(Z_2 / Z_1)^nfor an exponent between about 1.5 and 2, and the fitted lattice constant with the class fractions constrains the pair through Vegard's law. Both depend on calibrations (the exponent, the pixel size) that the map does not carry. Names come from the user (section 5) or not at all. - Spatial priors on the labels (3.6).
- A lattice model. The gate and the length scales use
d_NNonly. Testing the empty sites of a fitted lattice at a lower threshold would reach weaker atoms, at the price of assuming a single crystal. - Anisotropic widths in the fit.
calc_anisotropic_dispstays inatoms_stats. - Per-atom amplitudes in
_SIM.mrc(section 4). - A bank of template widths or of element templates in detection (sections 5 and 7).
- Model-generated connected components (section 6, withdrawn).
- Fixed detection thresholds (3.2): they are calibrated from the map.
- Any change to the present products or the present pruning before the validation of 10.8.
13. Open questions¶
- Q1. Is 3-6:1 the atom ratio or the intensity ratio? And what is the signal-to-noise of the weakest atoms you can see in a current map (section 7)? Together they say whether the light species is in the regime of cases 1-4 or of cases 6 and R2.
- Q2. Class symbols in the PDB element column (
X1,X2, ...) with the class also in the chain: acceptable, or one symbol with the class in the chain only? - Q3. Radius from the centre as the radial coordinate, or depth below the surface?
- Q4. Starting volume without an element:
solve3D_nano, or the ideal-lattice start with a user-supplied lattice constant? - Q5. Is the close-packed neighbour cutoff an acceptable default until the pair-distance form is in?
- Q6. Stage 2 assumes equal integrals within a class. Is that acceptable for surface atoms, or should the stage-1 width be the reported one where the two disagree?
- Q7. The target of 0.2 expected false atoms per particle behind the calibrated thresholds, and the gate on by default: both are prototype defaults to be judged on the Pt/Ni A/B of 10.8.
14. File table¶
The files a run may change, and in which phase. A phase edits only its
files; a file the work turns out to need is added here, with its phase and
a one-line reason, before it is edited. Testers of a listed Fortran file
(*_tester.f90) are covered by its row. Phase 0 edits nothing but this
note. Phases 0 to 3 are the first run (done); 4 and 5 the second (done);
7 and 8 the third and 9 the fourth, which edit only this note and the report.
| File | What changes | Phases |
|---|---|---|
src/main/nano/simple_atoms.f90 |
pseudo-atom branch in convolve; the symbols accepted by element_exists, set_element, guess_an_element, Z_and_radius_from_name; closed-form tests in its tester (phase 1). bfac_pdb in convolve; parse_element_list; their tests (phase 4) |
1, 4 |
src/defs/simple_defs_atoms.f90 |
pseudo-atom symbols and their sentinel range in get_element_Z_and_radius |
1 |
src/main/nano/simple_nano_species.f90 |
new: mixture fit, BIC, admissibility, discover_species, enclosed fraction, threshold calibration; its tester (phases 1, 3). The mixture sized by nspecies instead of MAX_NSPECIES and its four-class test (phase 4, section 9) |
1, 3, 4 |
src/main/commanders/test/simple_commanders_test_class.f90 |
species sub-suite in suites_single |
1 |
src/main/ui/simple_test/simple_test_ui_class.f90 |
unit_single suite list |
1 |
doc/policies/test_environment_policy.md |
the unit_single row of its table of fast sub-suites names species, so the policy lists what the gate runs (phase 1); the CTest budget and the table of high-level entries name species_discovery (phase 3); the CdSeW entry (phase 4); the test's description if it changes (phase 5) |
1, 3, 4, 5 |
src/main/nano/simple_nanoparticle_utils.f90 |
optional kernel width in phasecorr_one_atom; est_nn_dist; optional d_NN in find_rMax and calc_contact_scores (phase 2); the selector as character(len=*) with the symbol derived inside, and the unit test of the compound lattice; by the ruling of 2026-10-08, one cutoff function for every crystal system, the bond-length lattice fit of the binary crystals and the strain skipped for zincblende and wurtzite (phase 4, end of section 9) |
2, 4 |
src/main/nano/simple_nanoparticle.f90 |
l_species_free and the d_NN length scales (phase 2); the residual recovery, fits, species call and the files behind l_discover_species (phase 3); species(:) for the names in _species.pdb, element_key for the lattice lookups, and by the ruling of 2026-10-08 the shared cutoff in check_neighbors_cn and the bond-based fit radius of the displacement fits for the binary crystals (phase 4); by the ruling of 2026-10-09, a clear stop when discovery has fewer than two level-1 atoms (phase 5) |
2, 3, 4, 5 |
src/main/ui/single/single_ui_atom.f90 |
element optional in detect_atoms (phase 2); discover_species, nspecies, min_nbrs, vol_even, vol_odd on detect_atoms (phase 3); pdb_bfac on simulate_nanoparticle and the list in the description of detect_atoms (phase 4) |
2, 3, 4 |
src/main/ui/simple_ui_params_common.f90 |
only if a new key has to be shared rather than declared on a program | 3, 4 |
src/main/params/simple_parameters.f90 |
discover_species, nspecies, min_nbrs, l_discover_species (phase 3); element to STDLEN, species(:), l_species_list, pdb_bfac and l_pdb_bfac (phase 4) |
3, 4 |
src/main/params/simple_parameters_parse.f90 |
registration of the new keys | 3, 4 |
src/main/params/simple_parameters_phases.f90 |
phase 2 only if the element validation at lines 937-941 needs it for an absent key; phase 3 the derived logicals and the validation of the new keys; phase 4 the list parsing and the validation of pdb_bfac |
2, 3, 4 |
src/main/commanders/simple/simple_commanders_atoms.f90 |
exec_detect_atoms: command-line validation, half maps (phases 2, 3); the list's normalisation and rules (phase 4) |
2, 3, 4 |
src/main/commanders/simple/simple_commanders_sim.f90 |
exec_simulate_nanoparticle passes bfac_pdb to convolve |
4 |
src/main/commanders/test/simple_commanders_test_single.f90 |
the high-level test species_discovery (phase 3); single_atoms_stats parameterised by the crystal system only if its assertions prove fcc-specific, and the reader of _species.csv in species_discovery taking its column count from the header, now that the table has one POST column per class, and the interior coordination number and fitted lattice constant asserted for the compound selectors (phase 4, ruling of 2026-10-08); species_discovery rebuilt on element ground truth (phase 5) |
3, 4, 5 |
src/main/ui/simple_test/simple_test_ui_highlevel.f90 |
its program entry (phase 3); its description if it changes (phase 5) | 3, 5 |
src/main/exec/simple_test_exec_single.f90 |
its router case | 3 |
production/CMakeLists.txt |
its CTest entry; SIMPLE_CTEST_BUDGET raised by one (phase 3); the single_atoms_stats entries with element=CdSeW, CdSeZ and CdSeR, budget raised by one each (phase 4); the species_discovery timeout only if Debug needs it, and its comment, which described the pseudo-atom fixtures (phase 5) |
3, 4, 5 |
src/utils/text/simple_string_utils.f90 |
the string form of list_of_ints2arr, which splits the species list (section 5) |
4 |
src/fileio/simple_fileio.f90 |
files_identical returned false for a file compared with itself, because gfortran will not open one file on two units; this failed the fast gate at the start of phase 4, before any change |
4 |
doc/implementation_notes/completed/species_discovery_report.md |
the review report: the second run's section for phases 4 to 6 (sixth ruling of 2026-10-09); the third run's section, the validation on real maps (10.9); the fourth run's, the environment term on the real maps (10.11) | 6, 8, 9 |
doc/implementation_notes/completed/species_discovery_completed.md |
this note: Progress, file-table rows, rulings | each |
15. Review of 2026-10-07 and what it changed¶
The first version of this note was reviewed on 2026-10-07 by a second reviewer and by the maintainer, who declined to approve it as written and approved a small, opt-in prototype instead. The findings, what was checked, and what the note now says:
The pipeline order broke the pruning contract. Fitting and classifying
before discard_atoms would have lost every per-atom quantity, because
pruning rebuilds the atom table (section 0, last constraint but one), and
components generated from the model would have made the size test of the
pruning circular. Confirmed from the source. Pruning now comes first and
the recovered atoms are pruned on the atom table (3.9); model-generated
components are withdrawn in favour of data-derived ones at promotion
(section 6).
The aperture intensity lacked a factor smpd^3 against the continuous
integral it is compared with. Confirmed; added (3.5).
A fixed threshold on local maxima of a z map is not statistically
controlled, the voxel standard deviation does not calibrate the maxima, and
undetected weak atoms can contaminate the noise region. Checked by
simulation (8.8): the voxel tail indeed overpredicts the number of noise
maxima six times, but the region's own maxima calibrate it to within 0.8 to
1.0, and the calibrated threshold equals the fixed one for the emulated
geometry (5.0) and differs for strongly correlated noise (4.7). The
threshold is now calibrated per map (3.2). Contamination is real for a
weak-only domain thicker than 1.5 d_NN inside a tight mask (36 to 40% on
the standard deviation) and absent for a surface shell; the half-map
difference is now the noise reference when the halves are given, and the
robust-to-plain spread ratio is reported otherwise. The existing
false-discovery-rate routine of simple_segmentation.f90 was benchmarked on
the same maps: it admits three to four times the gate's false atoms at
lower recall, so it is not adopted.
The three-neighbour gate is a lattice prior that will disadvantage surfaces, defects, interfaces and weak-only domains. Checked by simulation (8.8): at the same threshold the gate costs about six points of recall at low coordination (six to nine points); at the same false-positive rate it gains 7 to 15 points everywhere, including the low-coordination bins and a weak-only domain. Its assumptions and its blind spot are now stated (3.3), and it is a switch with its use recorded per atom.
The evidence is model-matched: the generator produces the Gaussian atoms the detector assumes, several production steps were not emulated, and some threshold numbers came from an earlier variant of the algorithm. Agreed. The numbers from the earlier variant are replaced (3.3), the independent check is described for what it is (the preamble, 8.8), and validation on an independent forward model with a real Pt/Ni comparison gates promotion (10.8).
What the review asked for and the note now does: the existing path is
unchanged and remains the production path with its regression test; the
recovery runs behind an experimental key and produces diagnostics without
feeding _SIM.mrc; components stay data-derived; pruning precedes fitting
and classification; the forward-model validation and the Pt/Ni comparison
at matched false-positive rate come before promotion.
The plan review of 2026-10-08 (phases 4 and 5)¶
The plan for the second run was first written as a separate note and reviewed. The review found seven blocking points, all accepted, and the plan was folded into this note (the repository keeps one living note per development) with these changes:
- A list could name five species where the mixture, the posterior columns
and the chains were sized for three. The review offered a cap or a
generalisation; the maintainer ruled for the latter: the list has any
length,
nspeciesis its length, and everything sized by the number of classes is sized bynspecies(section 5, section 9). - The peak-ratio check for the B factors left out the resolution blur that
convolvealways adds; the stated formula would have failed its own 1% test (0.007 against the rendered 0.243 for Pt atB= 20). Corrected (section 4, 10.5). - Eligibility for the recall floor used the predicted signal-to-noise of section 7, which depends on the fitted width, so a floor on it would have been circular on kernels that have no generating width. Eligibility is now computed by the test from the clean render and the added noise, filtered with the detection template (10.6).
- A list implied discovery only inside
parameters, after the commander had already rejected half maps given withoutdiscover_species=yes. The commander now normalises the raw command line first, and section 5 carries the truth table of every combination;nspecieswith a list is an error in every case, where the first draft contradicted itself. - Widening the utilities' element arguments would not have repaired the
compound-selector truncation:
find_rMaxuses one value for the lattice table, whereCDSEWis valid, and for the atomic radius, where it is not and stops. The repair keeps two values apart, the selector for the lattice and the symbol for radii and names, with its own regressions; first deferred, then brought into phase 4 when the maintainer asked that the present species mixtures be handled correctly (end of section 9). - Removing every pseudo-atom fixture would have removed the only
high-level coverage of the blind mode and of automatic
K. The blind mode now runs on the element-kernel maps of the alloy and light cases without an element (10.6). - Assigning symbols to classes by atomic number can mislabel: in the five-Gaussian model Pt integrates above Au, and the sentinel numbers of the pseudo-atoms would sort first. The order given is the order of decreasing expected intensity, the program does not reorder, and the pseudo-atom symbols are rejected (section 5).
A third review (same day) found three more blockers, taken: the
any-length ruling had left the mixture, the posterior columns and the
chains sized for three in the text, so the generalisation is now spelled
out with a four-class unit test and a four-symbol run (section 9, 10.5);
the phase 4 comparison runs were specified on the noiseless reference
volume, on which discovery stops, so they run on one seeded noisy copy
(10.5); and the phase 5 floors could pass while most atoms were missed, so
the strong class and the whole eligible population get recall floors,
eligibility comes from each atom's marginal signal rather than the
filtered map at its position, and the plain-versus-recovery comparison
uses one eligible set (10.6). Also: empty list entries are ignored as in
list_of_ints2arr and a list must then hold two symbols (section 5), and
the test goes through test_gate into metrics.tsv (10.6).
Also taken from the second review: the purposes of the light case and of
the half maps are floors, not Progress entries (the element=Pt run must miss Al
atoms that the list run finds; admissibility for the mixed cases; a 0.95
half-map agreement floor; product identity for every element value, not
only Pt,Ni); B_SURF is described as an added displacement variance
rather than a doubling that holds only for a standalone Gaussian; the
parser is a non-fatal helper so that its rejections are unit-testable;
the shared help text of element stays and the list is documented on
detect_atoms; pdb_bfac goes through the whole parameter lifecycle; the
test removes its fixture tree.
The rulings of 2026-10-09: phase 5's fixtures and floors, phase 6 added and withdrawn¶
Phase 5 stopped four times on its first contact with element kernels and a real map. Five rulings of 2026-10-09 (recorded in 3.9, 7, 10.6) made the fixtures look like the maintainer's real Pt map, set the floors on them, pruned recovered surface atoms by the present policy, replaced the shell case by a core case, and moved the core case's label floor to a phase 6 that the third ruling added: fitting each atom with the map-filtered kernel. That phase stopped on its floors, and the sixth ruling withdrew it (10.7): its transfer estimate and kernel table add parameters and failure modes to a method that works, to correct a secondary output. Its source changes were undone; the floors stay as phase 5 closed them, the intensity bias stays a known limitation (section 7), and phase 6 writes the run's review report.
16. Progress¶
Each phase records here: the date, the files changed, the evidence with log
paths under the run directory, and each exit item of section 10 with how it
was met. The single_atoms_stats numbers are recorded for every phase next
to phase 0's.
Phase 0, baseline (2026-10-08)¶
Files changed: this note only (this entry). No source file was touched; the
build is of the base revision 92d684c6f as handed over, with no other
difference in the working tree.
Build and environment. The machine is dell (Oracle Linux 8.10, 24 cores, no
GPU). Compiler gfortran 15.2.1 from gcc-toolset-15
(/opt/rh/gcc-toolset-15/root/usr/bin/gfortran, enabled in ~/.bashrc),
CMake 3.26.5; python3 on the path is 3.6.8, under which the three gate
scripts run clean. The build is ./compile_debug.sh: a Debug build
(-O0 -g -fbounds-check -fcheck=all) with BUILD_TESTS=ON, followed by the
fast gate and the install into build/. Every shell that ran SIMPLE set
SIMPLE_PATH to that build and took the maintainer's checkout off PATH.
Log: scratch/build_debug.log under the run directory
(/home/elmlundho/agent_runs/single_species_proto); the build, gate and
install took 41 s.
Fast gate (scripts/run_fast_gate.sh: test-registry, description and
dependency checks, then the fast and provisional CTest labels): passed,
15 of 15 entries, 5.3 s of tests. Log: repo/build/test_runs/ctest_fast.log.
single_atoms_stats (ctest -R '^single_atoms_stats$', with
SIMPLE_SEED=20260923 set by CTest), Debug build, machine otherwise idle
(load average 3.2 at the start, the tail of the build): passed in 42.6 s of
wall time, far inside its 3600 s timeout, so no Release build is needed.
Log: scratch/single_atoms_stats_p0.log. The numbers every later phase is
compared with:
| Quantity | Phase 0 |
|---|---|
atoms in the simulated model (simatms.pdb) |
285 |
atoms detected (outvol_ATMS.pdb) |
285 |
| recall within 1 A | 1.0000 |
| precision within 1 A | 1.0000 |
| root-mean-square position error | 0.0148 A |
correlation of outvol_SIM.mrc with the simulated volume |
0.9997 |
atoms_stats rows (atoms) / anisotropic atoms / diameter |
285 / 285 / 19.527 A |
Reference for the equivalence test of phase 2, kept in
scratch/keep/phase0_ref/ (script run_ref.sh, log run_ref.log, MD5 sums
of every file in md5sums.txt). Both programs are run by single_exec
(simple_exec refuses them), with SIMPLE_SEED=20260923:
single_exec prg=simulate_nanoparticle element=Pt moldiam=20 box=160 smpd=0.358 outvol=ptvol.mrc pdbout=ptatoms.pdb nthr=8
single_exec prg=detect_atoms vol1=ptvol.mrc smpd=0.358 element=Pt nthr=8
Kept: the input volume ptvol.mrc, the simulated model ptatoms.pdb (the
file section 10.1 calls simatms.pdb; it is byte-identical to the
simatms.pdb of the single_atoms_stats run, and ptvol.mrc and
ptvol_ATMS.pdb are byte-identical to that run's outvol.mrc and
outvol_ATMS.pdb), and every product of the detection (ptvol_ATMS.pdb,
ptvol_BIN.mrc, ptvol_CC.mrc, ptvol_MSK.mrc, ptvol_SIM.mrc, and the
intermediate split_ccs.mrc). Numbers, from scratch/keep/compare_pdb.py
and scratch/keep/corr_mrc.py (the same nearest-neighbour matching within
1 A and whole-box correlation as the test):
| Quantity | Reference |
|---|---|
atoms in ptatoms.pdb |
285 |
atoms in ptvol_ATMS.pdb |
285 |
| matched within 1 A, each way | 285 and 285 |
| root-mean-square position difference (maximum) | 0.0148 A (0.0340 A) |
correlation of ptvol_SIM.mrc with ptvol.mrc |
0.99969 |
| median nearest-neighbour distance, model / detected | 2.7662 A / 2.7486 A |
The detection is deterministic: run again in another directory without
SIMPLE_SEED, it wrote _ATMS.pdb, _SIM.mrc, _CC.mrc and _BIN.mrc
byte-identical to the kept ones. The median nearest-neighbour distance of the
detected atoms, the quantity phase 2 measures as d_NN, is 0.6% below the
2.766 A of the plan's exit for phase 2.
Exit items of 10.1: the fast gate passes (above); single_atoms_stats
passes with its present floors (above); the reference is kept under
scratch/keep/phase0_ref/ and its numbers are recorded here.
Phase 1, foundations that change nothing (2026-10-08)¶
Files changed: src/defs/simple_defs_atoms.f90,
src/main/nano/simple_atoms.f90, src/main/nano/simple_atoms_tester.f90,
src/main/commanders/test/simple_commanders_test_class.f90,
src/main/ui/simple_test/simple_test_ui_class.f90,
doc/policies/test_environment_policy.md (added to the file table first:
its list of the fast sub-suites of unit_single now names species), this
note; new: src/main/nano/simple_nano_species.f90 and
src/main/nano/simple_nano_species_tester.f90.
What was done.
- Pseudo-atom symbols.
X1,X2andX3are registered inget_element_Z_and_radiuswith the sentinel atomic numbers 901, 902 and 903, held in the named constantsZ_PSEUDO_FIRSTandZ_PSEUDO_LAST(clear of the 999 ofCDSE), radius 1.0 A.element_exists,set_element,set_name,guess_an_elementandZ_and_radius_from_nameall go through that table, so they accept the symbols with no change of their own. - Pseudo-atom kernel.
atoms%convolverenders an atom whose atomic number is in the reserved range asq (4 pi / B)^(3/2) exp(-4 pi^2 r^2 / B), withqfromoccupancyandBfrombeta, inside the same window and cutoff logic as the elements. Decision recorded here: the resolution blur thatconvolveadds to every element (itslpargument, by default a B of(8 smpd)^2) is not added to a pseudo-atom, whose width is itsB; the closed forms of the phase 1 exit need exactly that, and section 4 defines the kernel bybetaalone. A pseudo-atom withBof zero or less stops the program. The element branches compute what they did before: the constant of eq. B.6 now reaches the sum through a per-atom scale that holds the same value, and the same Pt volume and detection are byte-identical to phase 0 (below). The unused single-Gaussian helperegauand its two variables were deleted as dead code.atomsgained the getterget_occupancy. - PDB round trip.
readPDBandwritePDBalready carry the element column,occupancyandbeta; both numeric columns have two decimals, so a pseudo-atom PDB keepsqandBto 0.005. A fixture whose class intensity is 1/6 is therefore rendered at 0.17; phase 3 judges against the values the PDB holds. simulate_nanoparticle pdbfile=renders pseudo-atoms with no change to that commander (it reads the PDB withatoms%newand callsconvolve), and element PDBs take the unchanged branches.simple_nano_species: free procedures on arrays, no image or parameters.fit_species_mixture(x, s_meas, nspecies_in, K, labels, post, mu, var [, bic, admissible])fits the one-dimensional Gaussian mixture of 3.6 by expectation-maximisation forK= 1 to 3, each component variance floored ats_meas^2, from the sorted-quantile and the largest-gap starts, keeping the start of higher likelihood;BIC = -2 ln L + (3K - 1) ln N; aKabove 1 is admissible when every class holds at leastmax(8, 0.02 N)atoms (counted by largest posterior) and adjacent classes are separated byD >= 3; the admissibleKof lowest BIC is taken, ornspecies_inwhen it is positive (then even an inadmissibleK); classes are numbered by decreasing mean. Alsoclass_separation(D),enclosed_fraction(Fof 3.5),maxima_shape((u^2 - 1) exp(-u^2 / 2)),calibrate_thresholdandexpected_false_count. The calibration takesCas the summed region counts over the summed model shape, scaled by the search-to-region volume ratio, which is the estimator that reproduces theCof 2105 in 8.8, and findskby bisection abovesqrt 3, where the shape falls monotonically.
Tests. simple_test_exec test=unit_single suite=species: 36 assertions,
all pass (log scratch/p1_unit/species.log under the run directory
/home/elmlundho/agent_runs/single_species_proto). The samples are drawn at
fixed seeds from the generating parameters each test states, and the fits
are judged against them:
- one class of 400 at spread 0.05:
K= 1, every label 1, the mean within four standard errors,BIC(1)equal to the closed form-2 ln L + 2 ln Ncomputed in the test,BIC(1)the lowest;nspecies= 2 forcesK= 2; - two classes of 200: at
D= 2.5 the two-class fit is inadmissible andK= 1; atD= 4 it is admissible,K= 2,BIC(2) < BIC(1), at least 95% of labels right (the Bayes error is 2.3%), means within 0.02; - size floor at
N= 400: a distinct class of 5 atoms is inadmissible andK= 1, a class of 8 (the floor) is admitted with every label right; - three classes (case 12: 264, 132, 132 atoms at 1, 0.5, 0.167, drawn in a
shuffled order):
K= 3,BIC(3) < BIC(2) < BIC(1), every label right, the class intensities within 0.02; enclosed_fractionequal to a Simpson integral of the radial density to 1e-5;- calibration from the white-noise region counts of 8.8 (154.5, 38.0, 7.2
above 2.5, 3.0, 3.5; volume ratio 3.628):
C= 2105.3,k= 4.99, within 0.1 of 5.0 as the exit asks; the expected false count atkequals the target; counts that follow the model return itsC; a doubled search volume raisesk.
suite=atoms: 48 assertions, all pass (log scratch/p1_unit/atoms.log),
of which the new ones: the three symbols exist, have distinct Z in the
reserved range and radius 1; one pseudo-atom (q = 2, B = 13.9 A^2,
0.358 A voxels) peaks at q (4 pi / B)^(3/2) to 1e-4, reaches 1.43 A and
stops before 2.03 A at a cutoff of 4 sigma = 1.68 A; off the grid its voxel
sum times smpd^3 is q within 1%; lp does not change a pseudo-atom; two
overlapping pseudo-atoms (B 13.9 and 20, 2.4 A apart) render as the sum of
the two rendered alone and integrate to q1 + q2 within 1%; a PDB of X1,
X2, X3 written by writepdb and read by atoms%new keeps symbol,
atomic number, occupancy and B (to 0.005) and coordinates (to 1e-3 A).
End to end (scratch/p1_e2e/): simulate_nanoparticle pdbfile= on a
three-pseudo-atom PDB (box 64, 0.358 A) gave a map whose integral is the sum
of the q (1.67000 against 1.67, relative difference -1.1e-7) and whose value
at X1 is the closed form including the neighbours' tails (0.859593 against
0.859592); its pdbout keeps the symbols, occupancies and B. The phase 0
commands (scratch/keep/phase0_ref/run_ref.sh) run with this build gave
ptatoms.pdb, ptvol.mrc and all five detection products byte-identical
to phase 0.
A second reader reviewed the diff against this note and found no defect;
its minor points were taken: the log-likelihood returned when the EM
iteration cap is reached now belongs to the returned parameters, a forced
nspecies that leaves a class empty is documented at the routine, the
calibration comment states the estimator, and the cutoff check samples a
voxel inside the atom's window.
Noted for phase 3, not changed: atoms%extract_atom copies beta but not
occupancy, so a pseudo-atom extracted with it renders with q = 0.
Build and gates. ./compile_debug.sh (clean Debug build with tests, fast
gate, install): passed, 15 of 15 fast entries, unit_single 0.6 s (log
scratch/p1_build_debug2.log; gate log repo/build/test_runs/ctest_fast.log).
scripts/check_test_registry.py and scripts/check_descr.py clean; no
compiler warning from the new or touched files; no mode change in
git diff --summary.
single_atoms_stats on the final build (log scratch/single_atoms_stats_p1.log,
load average 4.0 at the start, the tail of the build), against phase 0:
| Quantity | Phase 0 | Phase 1 |
|---|---|---|
| atoms simulated / detected | 285 / 285 | 285 / 285 |
| recall within 1 A | 1.0000 | 1.0000 |
| precision within 1 A | 1.0000 | 1.0000 |
| root-mean-square position error | 0.0148 A | 0.0148 A |
_SIM.mrc correlation |
0.9997 | 0.9997 |
atoms_stats atoms / diameter |
285 / 19.527 A | 285 / 19.527 A |
| wall time (Debug) | 42.6 s | 32.8 s |
Exit items of 10.2: unit tests on one and two pseudo-atoms against the
closed forms (peak, voxel sum within 1% at 4 sigma, linear addition) pass;
the PDB round trip preserves symbol, occupancy and B; the mixture returns
the right K, labels and BIC ordering on the fixed samples (one class; two
classes at D 2.5, inadmissible, and 4; a class below the size floor; three
classes); the calibration returns 4.99 from the counts of 8.8; the species
sub-suite is registered and scripts/check_test_registry.py is clean; the
fast gate passes; single_atoms_stats is unchanged against phase 0.
Phase 2, level 1 without an element (2026-10-08)¶
Files changed: src/main/nano/simple_nanoparticle.f90,
src/main/nano/simple_nanoparticle_utils.f90,
src/main/ui/single/single_ui_atom.f90, this note. Not needed in this
phase, so not touched: simple_parameters_phases.f90 (its element check
runs only when the key is given) and simple_commanders_atoms.f90 (with
element absent there is nothing to normalise before params%new; the
validation of the new keys comes with them in phase 3).
What was done.
elementis optional indetect_atomsonly (required_override=.false.). The other programs that take it still require it.nanoparticle%newsetsl_species_freewhenelementis empty. It then looks up no atomic number, names the atomsX1(the pseudo-atom symbol of phase 1) and leaves the atom radius unset until the nearest-neighbour distance is measured. With an element,newruns exactly as before.- Template.
phasecorr_one_atomtakes an optional B factor and, when it is given, correlates with a unit pseudo-atom of that width instead of the element; the species-free path passesB_ref= 13.9 A^2 (sigma 0.42 A). In the threshold search of the binarisation (t2c), which writes the trial centres to a PDB and renders them, the species-free path sets the B column of the re-read atoms toB_ref, becausewrite_centersputs the per-atom correlation there;simulate_atomsdoes the same, so_SIM.mrcof a species-free run is the equal-atom simulation at the reference width, as section 6 states. - Length scales. After the first binarisation and before
discard_small_ccs, the species-free path measuresd_NN, the median over atoms of the distance to the nearest other centre (est_nn_dist, new in the utilities), and sets the atom radius to0.4 d_NN. The neighbour cutoff of the contact scores is1.267 d_NN(an optionald_nnargument offind_rMaxandcalc_contact_scores, which replaces the lattice lookup when present), and the contact-score ceiling ofdiscard_atomsis 12, the close-packed value. The exclusion radius of the splitting step is0.21 d_NNin Angstroms, as decided for this run (section 2: today's effective value; the element path's test multiplies squared voxel distances bysmpdonce wheresmpd^2is meant, so its written0.9 racts as 0.59 A for Pt at 0.358 A). Both paths now take the squared radius from one variable set at the top ofsplit_atoms; for an element it is(0.9 r)^2, the same expression as before, so the comparisons are the same floating-point operations. killresets the two new fields.conv_denoise,identify_lattice_paramsandfillin_atominfo, which only the programs that still requireelementreach, stop with a message if they are ever called without one, instead of falling back silently to the default lattice (fcc,a= 3.76 A) for the symbolX1.
Equivalence test (section 10.3), run by hand on the phase 0 input volume
scratch/keep/phase0_ref/ptvol.mrc with the final build, in
scratch/keep/phase2/ (script run_phase2.sh, logs with_pt/detect.log
and no_element/detect.log, the two _ATMS.pdb kept, comparisons in the
cmp_*.txt and corr_*.txt files), with SIMPLE_SEED=20260923:
single_exec prg=detect_atoms vol1=ptvol.mrc smpd=0.358 element=Pt nthr=8
single_exec prg=detect_atoms vol1=ptvol.mrc smpd=0.358 nthr=8
| Exit item | Required | Measured |
|---|---|---|
element=Pt: _ATMS.pdb against phase 0 |
same count, positions within 1e-3 A | byte-identical file (285 atoms); _BIN, _CC, _MSK and _SIM.mrc byte-identical too |
no element: atom count against the reference (285) |
within 1% | 285 |
no element: positions against the reference _ATMS.pdb |
matched within 0.5 A, root mean square at most 0.1 A | 285 of 285 matched each way, root mean square 0.0139 A, largest 0.036 A |
no element: _SIM.mrc correlation with the input against the reference's 0.99969 |
within 0.01 | 0.99488 (difference 0.0048) |
measured d_NN against 2.766 A (Pt, a = 3.912) |
within 2% | 2.7498 A (0.6% below) |
Against the generating model ptatoms.pdb the species-free detection
matches all 285 atoms with a root-mean-square error of 0.0121 A (largest
0.026 A); the element path's is 0.0148 A. The step counts agree on both
paths: no atom split, 285 after splitting, none discarded by contact score
or size, 285 final. The binarisation chose a slightly different threshold
(0.01916 against 0.01929 in map units, a different template), and the
correlation of the trial simulation with the map was 0.867 against 0.861.
The species-free _SIM.mrc correlates a little less with the input
(0.9949 against 0.9997) because the input was rendered with the Pt
five-Gaussian kernel and the species-free simulation uses one Gaussian.
The neighbour cutoff came out at 3.484 A against the element's 3.504 A.
A second reader reviewed the diff against this note: the element path
executes as before, nothing on the species-free path reads a lattice or an
atomic number for X1, and the radius is set before its first use. Its one
point, that a program still requiring element would silently use the
default lattice if it ever got none, was closed by the three stops above;
the equivalence runs were repeated after that change with the same files.
Build and gates. ./compile_debug.sh on the final source: passed, 15 of 15
fast entries (log scratch/p2_build_debug2.log);
scripts/check_test_registry.py and scripts/check_descr.py clean; no
compiler warning from the touched files; no mode change.
single_atoms_stats on the final build (log scratch/single_atoms_stats_p2.log,
load average 4.3 at the start, the tail of the build):
| Quantity | Phase 0 | Phase 2 |
|---|---|---|
| atoms simulated / detected | 285 / 285 | 285 / 285 |
| recall within 1 A | 1.0000 | 1.0000 |
| precision within 1 A | 1.0000 | 1.0000 |
| root-mean-square position error | 0.0148 A | 0.0148 A |
_SIM.mrc correlation |
0.9997 | 0.9997 |
atoms_stats atoms / diameter |
285 / 19.527 A | 285 / 19.527 A |
| wall time (Debug) | 42.6 s | 41.7 s |
Exit items of 10.3: the species-free count equals the reference's (285,
within 1%); positions matched within 0.5 A with a root-mean-square
difference of 0.014 A (at most 0.1 A); the _SIM.mrc correlation is
within 0.0048 of the reference's (0.01 allowed); element=Pt reproduces
the reference _ATMS.pdb byte for byte; d_NN is 2.7498 A, 0.6% from
2.766 A; the fast gate passes; single_atoms_stats is unchanged.
Phase 3, residual recovery and species call, diagnostics only (2026-10-08)¶
Files changed: src/main/nano/simple_nanoparticle.f90 (the discovery),
src/main/nano/simple_nano_species.f90 and its tester (the width fit, the
separable Gaussian filter, local maxima, robust spread, with tests),
src/main/params/simple_parameters.f90, simple_parameters_parse.f90,
simple_parameters_phases.f90 (the keys discover_species, nspecies,
nn_gate and the logicals l_discover_species, l_nn_gate),
src/main/ui/single/single_ui_atom.f90 (the three keys and vol_even,
vol_odd on detect_atoms), src/main/commanders/simple/simple_commanders_atoms.f90
(exec_detect_atoms), the test files simple_commanders_test_single.f90,
simple_test_ui_highlevel.f90, simple_test_exec_single.f90,
production/CMakeLists.txt (CTest entry, SIMPLE_CTEST_BUDGET 34 to 35),
doc/policies/test_environment_policy.md (its file-table row extended to
phase 3 first: the budget count and the table of high-level entries), and
this note. simple_ui_params_common.f90 was not needed: the new keys are
declared on detect_atoms itself.
What was built. With discover_species=yes, detect_atoms runs the present
detection and writes its five products exactly as without the key; only then
does discover_species (a type-bound procedure of the nanoparticle whose
steps are internal procedures named as in section 9: fit_atoms_joint,
build_region/noise_stats for the noise region, calibrate,
detect_residual_level, prune_recovered, calc_aperture_int,
assign_species, write_species_report, write_radial_profiles) work on
a copy of the level-1 atom table and the map. The recovered atoms are a
second table (recovered(:) of atom_stats, freed by kill); the level-1
atoms get the new discovery fields in atominfo after the products are
written. Nothing reaches _ATMS.pdb, _BIN, _CC, _MSK or _SIM.mrc.
Its three files are <map>_species.csv (one row per atom, level-1 and
recovered: position, radius, coordination, stage and level, detection z,
amplitude, B of stage 1 and stage 2, aperture intensity and its
signal-to-noise, class and class posteriors, valid_corr, whether the gate
accepted it), <map>_species_radial.csv (the profiles of 3.8 per class and
equal-count shell, with the predicted detection signal-to-noise and a flag
below 6.5) and <map>_species.txt (the report of section 6 as key = value
lines: K, class intensities, ratios, fractions and spreads, D, the BIC
table with admissibility, the expected misclassification, d_NN, B_ref
and the stage-1 median B of the strong atoms with its ratio to B_ref,
the noise source, sigma_n, s_A, s_I, the robust-to-plain spread ratio,
the region size, k_A, k_B, the search volumes and the expected false
counts, atoms added per stage and level, pruned atoms, the interior
coordination and its deficit, flagged shells, and with half maps the label
agreement and intensity correlation of the two halves).
Decisions taken where the plan leaves the detail open, each recorded here:
- Order. Discovery runs after the present output block rather than before it (section 9 lists it before): the products are on disk before discovery starts, so their identity with and without the key holds by construction.
- Half maps.
parametersrefusesvol1together withvol_evenandvol_odd, soexec_detect_atomschecks the combination (the three discovery keys and the half maps needdiscover_species=yes; both half maps or neither), takes the half maps off the command line beforeparams%newand hands them to the nanoparticle (set_half_maps). They are masked as the map is. d_NNon the element path. With an element anddiscover_species=yes,d_NNis measured at the same point as on the species-free path (after the first binarisation) without touching the atom radius.- Positions are held fixed, as in the emulation: level-1 atoms at the present centres, recovered atoms at the centroid of the positive residual found at detection (section 3.4 suggests moving them each sweep; not done).
- Width prior. Before any fit there are no strong atoms, so the first
stage-1 sweep uses a prior centred on
ln B_refwith spread 0.5; later sweeps use the median and robust spread ofln Bof the strong atoms (amplitude above10 s_A) withind_NNin radius, all strong atoms when fewer than five qualify. - Noise. The region is the voxels of full mask weight (the same
mask3D_softcall asnanoparticle%new, on a unit volume) farther than1.5 d_NNfrom every atom, rebuilt before each level; the program stops below 20 000 voxels. With half mapssigma_n, the standardisation of the z map and the calibration counts come from the half-map difference over the region, as 3.2 says;s_Aands_Ialways come from 1 000 phantom sites of the map's region, taken at a fixed stride rather than at random so that the run stays deterministic. A map without noise stops with a message. - Calibration once per map, after the level-1 fit, from the plain local
maxima of the noise field in the region above 2.5, 3.0 and 3.5 (the
candidates themselves need 3 of their 27 voxels above the threshold, so
the calibrated count is conservative);
k_B = k_A - 1. - Gate. Stage B with the gate counts the atoms accepted before the level,
so a level adds one shell; without the gate stage B uses the
0.7 d_NNexclusion of stage A.gate_usedmarks the atoms accepted through the gate at stage B. - Pruning: the contact-score rule of
discard_atoms(its neighbour cutoff and ceiling, the outer 15% by distance from the centre of the atom positions, fewer than threshold minus one contacts), one pass, on the recovered atoms only. - Predicted detection signal-to-noise (section 7): the amplitude of an atom
of the class intensity and the shell width over
s_A, scaled from the template width to the atom's as(sigma / sigma_ref)^(3/2), so that it goes asI sigma^(-3/2); this reproduces the values of the table in 8.2. The first version of the code used the amplitude overs_Aalone, which goes asI sigma^(-3); that was found on reading the first test run (it held only 25 of the 71 light atoms of R6 to the recall floor) and corrected in the code and the test before any further run. The floors were not touched.
The test species_discovery (label highlevel, its own CTest entry
as section 10.4 asks). It simulates the Pt lattice of phase 0 (285 atoms,
d_NN 2.766 A) and builds four pseudo-atom models on it: case 2 (a random
quarter of the atoms light at intensity 1/6, sigma 0.35 A with 5% scatter,
noise 0.03 of the peak of a core strong atom), case 9 (single species, noise
0.05), R3 (single species, variance growing with the square of the radius to
twice its central value at the surface, noise 0.05) and R6 (case 2 with that
radial growth and the light class at 1.3 times the variance of the heavy one
at every radius, noise 0.03). Each model is written as a PDB (X1/X2,
occupancy the intensity, B column 8 pi^2 sigma^2; the PDB keeps two
decimals, so the light intensity is 0.17), rendered by
simulate_nanoparticle pdbfile=, and given Gaussian noise in process at a
fixed seed: two half maps with independent noise of sqrt 2 times the
target, whose average is the map. detect_atoms (no element) runs three
times per case in directories of its own: plain, with discover_species=yes,
and with the half maps as well. The generating model is the PDB as written;
a found atom matches the nearest generating atom within 0.3 d_NN, an
unmatched found atom or a second found atom on one site is false. The
floors of 10.4 are named constants written before the first run.
A defect of the present detection met on the way, not fixed. In the second
run of the test two cases (case 9 with half maps, R3 with discovery) wrote
an _ATMS.pdb and _SIM.mrc that differed from the plain run's: one atom
centre moved by 0.29 A in case 9 and by 0.02 A in R3, while _BIN and _CC
were identical. The centres come from nanoparticle%find_centers, whose
OpenMP loop adds every voxel into the shared sums m(:,i) and sum_mass(i)
of its component without a reduction (the same loop at the base revision);
threads that share a component lose updates. The code that runs before the
products are written is the same with and without discover_species, so
this is the present detection disagreeing with itself at 24 threads.
Six further plain runs at 24 threads agreed with each other (the race is
intermittent), and runs at 8 and at 24 threads differ in atom order and by
up to 0.034 A in position (scratch/p3_race/). Fixing the loop would change
an existing routine for its existing callers, which this run does not do;
the test runs detect_atoms on one thread, where the comparison isolates
the effect of discover_species. Recorded for the maintainer. (Fixed on the
Mac after the run, 2026-10-08: the loop carries reduction(+:m,sum_mass)
and the test runs detect_atoms with its thread count again; the report
has the details.)
Results of the final CTest run (ctest -R '^species_discovery$',
Debug, 505 s of wall time, load average 4.3 at the start, the tail of the
build; log scratch/species_discovery_ctest.log; the species files
of every run and the generating PDBs in scratch/p3_final_evidence/):
| Fixture, run | Level 1 / recovered (stage A, B) | False | K | Weak recall where predicted SNR >= 6.5 | Ratio (generating 0.170) | Strong shells, largest width error | Light shells, largest width error |
|---|---|---|---|---|---|---|---|
| case 2, map | 212 / 73 (73, 0) | 0 | 2 | 71 of 71 = 1.000 | 0.1715 | 0.25% | 1.8% |
| case 2, half maps | 212 / 73 (73, 0) | 0 | 2 | 71 of 71 = 1.000 | 0.1715 | 0.25% | 1.8% |
| case 9, map | 285 / 0 | 0 | 1 | - | - | - | - |
| case 9, half maps | 285 / 0 | 0 | 1 | - | - | - | - |
| R3, map | 285 / 0 | 0 | 1 | - | - | - | - |
| R3, half maps | 285 / 0 | 0 | 1 | - | - | - | - |
| R6, map | 207 / 76 (66, 10) | 0 | 2 | 59 of 60 = 0.983 | 0.1699 | 0.47% | 2.5% |
| R6, half maps | 207 / 74 (59, 15) | 0 | 2 | 63 of 66 = 0.955 | 0.1687 | 0.41% | 3.4% |
Every found atom of the two-species fixtures carries the right label. The
level-1 detection found the strong class only (212 of 214 in case 2, 207 of
214 in R6, the rest of the strong class recovered at stage A) and none of
the light class, as section 3.1 says. Over all light atoms, whatever their
predicted signal-to-noise, 71 of 71 were found in case 2 and 69 and 67 of 71
in R6 (map, half maps); in R6 stage B (the gate) added 10 and 15 of them. The light-class widths come out up to
3.4% low in the outermost shell of R6, where the broadest light atoms are
the ones missed (section 7). The calibrated k_A was 5.30 to 5.32 on every
map (search volume 2.14 million voxels against a region of about 1.9
million), k_B 4.30 to 4.32; the expected number of noise maxima above
k_B in the gated stage-B volume before the gate is applied was 1.1 to 1.2.
sigma_n matched the noise put in (0.0444 and 0.0740 against 0.04443 and
0.07405), the robust-to-plain spread ratio was 1.000 to 1.002, the stage-1
median B of the strong atoms over B_ref was 0.70 for the narrow fixtures
(generating B 9.67 A^2 against 13.9) and 1.10 for the radial ones, the
interior coordination 12.0 (11.98 in R6), and with half maps the labels of
the two halves agreed for every atom (intensity correlation 0.98 in the
two-species cases). The five present products were identical with and
without discover_species in every fixture and both runs.
A further run with element=Pt discover_species=yes nn_gate=no nspecies=2
(the gate switch was renamed min_nbrs on 2026-10-08, nn_gate=no being
min_nbrs=0)
on a noisy case 2 map (scratch/p3_smoke2/) found the same 212 level-1
atoms, added 73 atoms at stage A and 5 at stage B without the gate, pruned
those 5 by contact score and returned K = 2 with ratio 0.173;
nspecies=2 without discover_species=yes stops with
nspecies needs discover_species=yes.
A second reader reviewed the code against this note and found no defect
that changes a result; its points were taken before the final runs: the
gate counted atoms accepted earlier in the same level (now only those of
earlier levels), the pruning used the close-packed ceiling with an element
(now that of discard_atoms), non-maximum suppression acted on centroids
(now on the maxima), the voxel count of a candidate excluded the maximum
(now 3 of the 27 voxels), and the test could skip the recall floor when no
light atom reached the predicted signal-to-noise and did not check which
noise source a run used (both now fail the test).
Build and gates. ./compile_debug.sh on the final source: passed, 15 of 15
fast entries, unit_single 0.6 s, the species sub-suite 48 assertions
(log scratch/p3_build_debug.log); 35 CTest entries, matching the budget;
scripts/check_test_registry.py and scripts/check_descr.py clean; no
compiler warning from the touched files; no mode change.
single_atoms_stats on the final build (log scratch/single_atoms_stats_p3.log,
load average 0.9):
| Quantity | Phase 0 | Phase 3 |
|---|---|---|
| atoms simulated / detected | 285 / 285 | 285 / 285 |
| recall within 1 A | 1.0000 | 1.0000 |
| precision within 1 A | 1.0000 | 1.0000 |
| root-mean-square position error | 0.0148 A | 0.0148 A |
_SIM.mrc correlation |
0.9997 | 0.9997 |
atoms_stats atoms / diameter |
285 / 19.527 A | 285 / 19.527 A |
| wall time (Debug) | 42.6 s | 33.0 s |
Exit items of 10.4: for the two-species fixtures the recall of the weak
class is at least 0.90 where its predicted signal-to-noise is 6.5 or more
(1.000, 1.000, 0.983, 0.955), no more than one false atom per particle (0
everywhere), K = 2, every label of a found atom right, the intensity ratio
within 10% (largest error 0.9%), the per-shell width of the strongest class
within 3% (largest 0.47%) and of the light class within 10% (largest 3.4%);
for the single-species fixtures K = 1 and no recovered atom; for every
fixture the five present products identical to the run without
discover_species; the fast gate passes; single_atoms_stats is unchanged.
Phase 4, B factors in the element kernels and the species list (2026-10-08)¶
Files changed: src/main/nano/simple_atoms.f90 and its tester,
src/main/nano/simple_nano_species.f90 and its tester,
src/main/nano/simple_nanoparticle.f90,
src/main/nano/simple_nanoparticle_utils.f90,
src/main/params/simple_parameters.f90, simple_parameters_parse.f90,
simple_parameters_phases.f90, src/main/ui/single/single_ui_atom.f90,
src/main/commanders/simple/simple_commanders_atoms.f90,
src/main/commanders/simple/simple_commanders_sim.f90,
src/main/commanders/test/simple_commanders_test_single.f90,
production/CMakeLists.txt (three CTest entries, SIMPLE_CTEST_BUDGET
35 to 38), doc/policies/test_environment_policy.md, this note; and, added
to the file table first, src/utils/text/simple_string_utils.f90 (the
string form of list_of_ints2arr) and src/fileio/simple_fileio.f90 (see
below). Every path below is under the run directory
/home/elmlundho/agent_runs/species_element_model.
Build and environment as in phase 0: dell, gfortran 15.2.1
(gcc-toolset-15), CMake 3.26.5, ./compile_debug.sh (Debug, tests built,
fast gate, install into build/), every shell with SIMPLE_PATH on that
build and the maintainer's checkout off PATH. No numpy is installed for
either Python, so the comparison tools of this phase are plain Python 3.12
(scratch/keep/tools/compare_pdb.py, mrc.py, label_check.py); the noisy
copies are made by a small Fortran program linked against the SIMPLE library,
scratch/keep/tools/addnoise, which adds image%gauran noise at a fixed
seed with a standard deviation that is a given fraction of the largest voxel
within 3 A of the box centre (the peak of a core atom).
A defect met before any change. The fast gate failed on the unchanged
checkout: files_identical (added in the last commit) returned false for a
file compared with itself, because gfortran will not connect one file to two
units, and the unit test asserts the opposite (scratch/build_base.log).
Fixed: when the second open fails, the function asks which unit the second
name is connected to and returns true if it is the first file's unit. Its
tester passes (116 assertions).
What was done.
- B factors in the element kernels (section 4).
convolvetakes an optional logicalbfac_pdb, default false: when true, an element atom'sbetais added to everyb_jbeside the resolution blur, and a negativebetastops the program; pseudo-atoms ignore it.simulate_nanoparticlepasses the new keypdb_bfac(yes|no, defaultno, accepted only withpdbfile), which goes through the whole parameter lifecycle. Both existing calls ofconvolvein that commander now pass the key's logical, which is false unless the key is given, so they render as before. - The species list (section 5).
parse_element_list(str, symbols, selector, errmsg)insimple_atoms(non-fatal) accepts one symbol, one of the compound selectorsCdSeR,CdSeW,CdSeZ(its two symbols in the order written, and the selector), or a comma list of two or more distinct physical symbols in the order given, written capitalised; it splits with the newlist_of_strs2arrofsimple_string_utils(blanks and empty entries ignored, as inlist_of_ints2arr).parameters%elementischaracter(len=STDLEN);parametersgainedspecies(:),l_species_listandpdb_bfacwithl_pdb_bfac. A value with a comma is parsed invalidate_parameter_consistency: a program other thandetect_atomsstops;species,nspecies,l_species_listandl_discover_speciesare set andelementbecomes the first symbol. A compound selector is parsed only underdiscover_species=yes(speciesthe two symbols,nspecies= 2,nspeciesgiven is an error), so the present path does not run the parser.exec_detect_atomsnormalises the command line first: a list setsdiscover_species=yes, rejectsdiscover_species=noand rejectsnspecies. - Sizing by
nspecies.fit_species_mixtureallocates its arrays forkmaxclasses,kmaxbeingnspecies_inwhen it is positive andMAX_NSPECIES(3) for the automatic search; its optionalbicandadmissibleare allocatable results of sizekmax. The posteriors leftatom_statsfor an allocatable(n, K)array of the nanoparticle,species_post._species.csvhas the columnsPOST1toPOSTK(the header is written forK),_species.txtthe BIC table up tokmax, and_species.pdbthe symbols of the list or selector in its element column (X1,X2,X3in the blind mode), with chainsAtoZand then0to9by class (more than 36 classes stop the program). - The compound selectors (end of section 9). The nanoparticle holds
element, the two-letter symbol of the first species (template, radius, atom names: the atom name of aCdSeWrun is nowCDinstead ofCDSE), andelement_key, the value as given, which every lattice lookup takes. The utilities take the element ascharacter(len=*)and derive the symbol as its first two characters (el_symbol) for radii and PDB names. - The maintainer's ruling of 2026-10-08 on the lattice analysis of the
compound crystals (recorded at the end of section 9). Phase 4 first
stopped on it: with the selector,
atoms_statsgave theCdSeWatoms coordination numbers of 24 to 76, where the code before the change gave 1 to 4, becausefit_latticefitted a cubic grid inside the wurtzite cutoff (lattice constant 6.1 to 6.5 A) and the wurtzite branch ofrun_cn_analysiscounted out to about 8 A; the zincblende branch was dimensionally wrong. Under the ruling: one function,lattice_cutoff, gives the first-shell cutoff of every crystal system (the midpoint between the bond and the second shell; for the binary crystals the bond between the two species, wurtzite(u c + a) / 2withu= 3/8), used byfind_rMax,run_cn_analysisandcheck_neighbors_cn(a third copy of the formulas, in the nanoparticle). Its fcc, bcc and rocksalt branches are the expressions the three copies had, so the Pt numbers do not move.fit_latticederives the lattice of a binary crystal from the median nearest-neighbour distance and writes nonnbondl_*.csvfor it (those files are distances along the cubic directions of the fitted grid, which a binary crystal no longer gets).strain_analysisruns for rocksalt with the fitted lattice and is skipped for zincblende and wurtzite with a logged message; their strain columns inatoms_stats.csvstay 0, the values the array is initialised with, which every reader of the file accepts (decision: zero rather than a not-a-number marker, which would break the statistics and the parsers). One more use of the lattice the ruling does not name was changed with it: the isotropic and anisotropic displacement fits take their radius as half the fcc nearest-neighbour distance,a / (2 sqrt 2); for a binary crystal that is now half the bond and the search window keeps its fcc proportion to it (sqrt 2times), because with the binary crystal's ownathe fcc formula would have reached into the neighbours (1.8 A against a half bond of 1.3 A in wurtzite).PbSefollows the same rules asCdSeR.
Decisions taken where the plan leaves room, recorded here:
- A compound selector is one of the three values
get_lattice_paramsknows (five characters). Four-character two-element values such asCdSeorPbSestay on their present path: the parser does not name their species, and withdiscover_species=yesthey run the blind mode. - The bound
nspeciesof 0 to 3 stays on the key, that is in the blind mode, as the truth table of section 5 says ("0 or 1 to 3"); the blind classes are named by the three pseudo-atom symbols. A list setsnspeciesafter that check, so a list of any length is accepted (section 9 says the bound goes; it no longer limits the list). - The phase 3 test
species_discoveryreads the column count of_species.csvfrom its header (file-table row extended), since the number ofPOSTcolumns now followsK.
Exit items of 10.5, with the evidence:
simple_atoms_tester(scratch/p4_unit/atoms_s2.log, 99 assertions, all pass): a Pt atom rendered withbfac_pdbatB= 0 equals the default render; atB= 20 A^2 its voxel sum is kept within 1% and its peak falls by the closed form within 1% (the ratio is 0.2429, asserted to be 0.243); without the flag abetaof 20 renders the same voxels as 0; a pseudo-atom is unchanged by the flag.parse_element_list:Pt,NigivesPt,Ni;Ni,PtgivesNi,Pt;pt , NIgivesPt,Ni;Ptis one symbol and no selector; a list of five symbols gives five;Pt,Pt,Pt,,,Pt,Pt,Xx,Pt,X1,CdSeW,PtandPt,Pt2are rejected with a message,Pt,as a list of fewer than two symbols,X1as not a physical element;CdSeWgivesCd,Seand the selector, andCdSeWxis not a selector. The lattice:get_lattice_params('CDSEW')is wurtzite witha= 4.2985 andc= 7.0152 A;find_rMax('CdSeW')is the wurtzite first-shell cutoff plus the Cd radius term;lattice_cutoffequals the closed forms of the ruling for fcc, bcc, rocksalt, zincblende and wurtzite, andlattice_bondgives 2.745, 2.631 and 2.631 A for CdSe in rocksalt, zincblende and wurtzite (the ruling's 2.75, 2.63, 2.63).simple_nano_species_tester(57 assertions, all pass): four classes of 100 at 1, 0.6, 0.35, 0.2 with spread 0.02 andnspecies_in= 4 giveK= 4, every label right, the means within 0.02,bicandadmissibleof size 4 and four posterior columns; withnspecies_in= 0 the search returnsK= 3, its ceiling, withbicof size 3.simulate_nanoparticle pdbfile= pdb_bfac=yeson three Pt atoms atB= 0, 10 and 20 A^2, 11.5 A apart in a box of 96 at 0.358 A (scratch/p4_bfac/run_bfac.sh,run_bfac.log): peaks 407.16, 166.92 and 98.89, in that order (ratios 0.4100 and 0.2429, as the closed form predicts), voxel sums within the 4.3 A cutoff 11278.3, 11277.9 and 11276.9 (equal to 0.013%); without the key all three peaks are 407.16 and all three sums 11278.3.- The phase 0 reference regenerated (
scratch/keep/run_ref.sh; kept inscratch/keep/ref/for phase 5): 285 atoms simulated and detected, all matched within 1 A each way, root-mean-square 0.0148 A (largest 0.0340 A),_SIM.mrccorrelation 0.99969, as in phase 0. The same script run with a build of the unchanged checkout (scratch/keep/ref_base/, MD5 sums kept) and with the final build of this phase gave all 13 files (the input volume, the model, the noisy copy, the five products of the clean and of the noisy detection) byte-identical. The noisy copy: core peak 377.26, noise standard deviation 18.86 (0.05 of it), seed 20261008. On it (scratch/p4_runs/run_lists.sh,run_lists_s2.log; 24 threads against the reference's 8),element=Pt,element=Pt discover_species=yes,element=Pt,Niandelement=Pt,Ni,Al,Siwrite the five present products byte-identical to the reference (20 of 20 files).element=Pt,Niwrites_species.pdbwithPT(257 atoms, chainA) andNI(28 atoms, chainB) in the element column,_species.csvwithPOST1andPOST2, and reports the two-class fit inadmissible (D= 1.75), with no recovered atom.element=Pt,Ni,Al,SiwritesPOST1toPOST4,K= 4 and every fit with more than one class inadmissible; its fourth class holds no atom on this single-species particle (a class fixed by the list may be empty, section 9), so the file holds chainsA,BandConly. To show the four chains written, a fixture of the same lattice with W, Pt, Ag and Ni at random (71 or 72 atoms each, element kernels, noise 0.05 of the core peak;scratch/p4_four/run_four.sh) run withelement=W,Pt,Ag,Niwrites chainsAtoDwith the four symbols (143, 28, 43, 71 atoms). Its labels are not right (99 of 285 wrong: W and Pt, whose integrals differ by 16%, fell into one class and Ag was split); that is the species call on element kernels, which phase 5 tests, and nothing here depends on it. - The truth table of section 5, every fatal row by hand
(
scratch/p4_truth/run_truth.sh, messages intruth_messages.txt):nspecieswithout discovery (withelement=Pt, withoutelement, and withdiscover_species=no) stops with "nspecies needs discover_species=yes";min_nbrsand the half maps without discovery stop with their own messages; a list withdiscover_species=nostops with "a species list needs discover_species=yes, which it implies"; a list withnspecies(with or withoutdiscover_species=yes) stops with "nspecies is the length of the species list";CdSeWwithdiscover_species=yes nspecies=2stops with "nspecies is set by the compound selector";simulate_nanoparticleandatoms_statswithelement=Pt,Nistop with "a list of elements is accepted by detect_atoms only"; the parser's rejections stop the program with their messages; a list with only one half map stops;pdb_bfac=yeswithoutpdbfileandpdb_bfac=maybestop. The non-fatal row with half maps:element=Pt,Niwith two half maps runs discovery on the half-map noise (noise_source = half_maps), with the present products identical to the plain run (scratch/p4_runs/run_halves.sh). - Compound selectors: the unit tests above;
single_atoms_statswithelement=CdSeWis a second CTest entry, and by the rulingCdSeZandCdSeRare a third and a fourth, each asserting the coordination number of the interior atoms (the inner 30% by distance from the centre) and the fitted lattice constant within 2% of the table (logsscratch/single_atoms_stats_cdse?_s2.log, machine idle, load 0.3):
| Quantity | Pt (phase 0) | Pt (phase 4) | CdSeW | CdSeZ | CdSeR |
|---|---|---|---|---|---|
| atoms simulated / detected | 285 / 285 | 285 / 285 | 147 / 147 | 154 / 154 | 199 / 193 |
| recall / precision within 1 A | 1.0000 / 1.0000 | 1.0000 / 1.0000 | 1.0000 / 1.0000 | 1.0000 / 1.0000 | 0.9698 / 1.0000 |
| root-mean-square position error | 0.0148 A | 0.0148 A | 0.0140 A | 0.0146 A | 0.0132 A |
_SIM.mrc correlation |
0.9997 | 0.9997 | 0.9911 | 0.9910 | 0.9802 |
atoms_stats atoms / diameter |
285 / 19.527 A | 285 / 19.527 A | 147 / 19.673 A | 154 / 18.904 A | 193 / 19.566 A |
| fitted lattice (table) | 4.2786, c 6.9869 (4.2985, 7.0152) | 6.0493 (6.077) | 5.4680 (5.49) | ||
| interior atoms with the first-shell coordination | 44 of 44 at 4 | 49 of 49 at 4 | 60 of 60 at 6 | ||
| wall time (Debug) | 42.6 s | 33.0 s | 21.6 s | 21.0 s | 27.0 s |
The coordination numbers of all CdSeW atoms are 1 to 4 (9, 25, 41 and
72 atoms), the distribution the code before the change gave; rocksalt
peaks at 6. element=CdSeW discover_species=yes on that fixture with
noise at 0.05 of its core peak (scratch/p4_cdse/run_cdse.sh) writes a
_species.pdb with CD (70 atoms, chain A) and SE (77, chain B),
the model's counts, every one of the 147 labels right
(label_check.py), the two-class fit admissible (D = 6.8), and the five
present products identical to the run without the key. On the same noisy
map detect_atoms element=CdSeW with the code before the change wrote the
same four maps and an _ATMS.pdb that differed only in the atom name.
- The checks of 10.0: ./compile_debug.sh on the final source passes, 15
of 15 fast entries (log scratch/build_debug_p4s2.log), 38 CTest
entries against the budget of 38; scripts/check_test_registry.py and
scripts/check_descr.py clean; no compiler warning from the touched
files; no mode change in git diff --summary; single_atoms_stats is
unchanged against phase 0 (table above, log
scratch/single_atoms_stats_s2.log). The phase 3 test
species_discovery, whose reader of _species.csv changed, passes on
the final build (253 s, log scratch/species_discovery_p4.log).
A second reader reviewed the diff against this note before the ruling and
found no defect that changes a result; its points were taken (the list
also sets l_discover_species in parameters, as section 5 says; the
tester checks sizes before indexing; only a value of five characters can be
a selector), and it noted that PbSe reaches its rocksalt table entry too,
which the ruling then covered.
Outside this phase, recorded: single_workflow_wurtzite, which runs
element=CdSeW through analysis2D_nano and autorefine3D_nano, fails at
the base revision as well. Both the unchanged code
(scratch/single_workflow_wurtzite_base.log) and the phase 4 build of
before the ruling (scratch/single_workflow_wurtzite_p4.log) crash in
refine3D at simple_strategy3D_srch.f90:211 (an index of 709 and 729
into subspace_inds of size 500), and the two runs already differ in the 2D
stage, before any detect_atoms, so the workflow is not reproducible from
run to run. By the ruling it is not fixed here.
Phase 5, the species test on element ground truth (2026-10-08 and 2026-10-09)¶
Files changed: src/main/commanders/test/simple_commanders_test_single.f90
(the test species_discovery rebuilt), src/main/nano/simple_nanoparticle.f90
(row extended to phase 5 first: the clear stop of discovery with fewer than two
level-1 atoms, and the pruning of recovered atoms of the second ruling below),
src/main/ui/simple_test/simple_test_ui_highlevel.f90 (the test's
description), production/CMakeLists.txt (the comment of the test's entry,
row extended first; its name, label, timeout and the budget are unchanged),
doc/policies/test_environment_policy.md (the test's row), this note. Every
path below is under the run directory
/home/elmlundho/agent_runs/species_element_model.
The phase stopped four times. Each stop was answered by a ruling of the
maintainer (in spec/rulings.md, each recorded in this note where it
belongs: sections 3.9, 7, 10.6 and 10.8, the last then numbered 10.7), and the phase closed under them:
- First run, on the fixtures as 10.6 wrote them (Pt lattice, element
kernels,
B_i = 10 (r / r_max)^2, white noise at 0.05 of the single-Pt peak): level 1 of the present detection found 3 of 285 atoms of the pure case at the test's seed (scratch/species_discovery_p5_run1.log). Its threshold search (Otsu andsortmeanscandidates, then a bisection that moves up only when the correlation improves) lands on a plateau where the whole particle is one connected component; with these fixtures the outcome flips with the noise seed (2 of 5 seeds fail at every noise level from 0.03 to 0.05; without B factors 15 of 15 pass;scratch/p5/dbg/grid.log). By hand, the fitted intensity ratio missed its 10% floor (Pt/Al 18.7%, Pt/Ni 10.2% low;scratch/p5/hand/). Ruling of 2026-10-09: level 1 is not changed; the fixtures take the measured properties of a real Pt map; the ground-truth intensity is the isolated atom's aperture intensity; real data by hand; a clear stop of discovery with fewer than two level-1 atoms. - Second run, on those fixtures (
scratch/species_discovery_p5_run2.log): level 1 worked on every seed, but runs without discovery missed 7 or 8 surface Pt atoms on mixed particles (the present contact-score pruning removes Pt atoms whose light neighbours level 1 cannot see), and the fitted ratio was 22% (Pt/Ni) and 29% (Pt/Al) low. On the real map discovery recovered an outer shell of 240 atoms. Second ruling: the Pt floor applies with discovery and in the pure case; the ratio is reported and the class order floored; recovered atoms are pruned by the present policy (3.9); eligibility follows that policy; a surface-confined class is flagged. - Third run (
scratch/species_discovery_p5_run3.log): the pruning removed the Ni shell of the shell case (74 of 75 recovered atoms), so its two-class fit was inadmissible. Fourth ruling: a light species confined to the surface layer is not a target (section 7); the shell case is replaced by a core case. - Fourth and fifth runs (
scratch/species_discovery_p5_run4.log,_run5): one Ni atom at the centre of the core case (1.7 A from it) was called Pt, from the radial bias of the aperture intensity (Ni at 154 between 5 and 7 A, 188 between 3 and 5 A, 215 inside 3 A;scratch/p5/proto/core*). Fifth ruling: that case's label check is reported in phase 5 and floored again in phase 6.
What the test is now. species_discovery (label highlevel, its CTest
entry unchanged) builds four fixtures on the Pt lattice that
simulate_nanoparticle element=Pt moldiam=20 box=160 smpd=0.358 writes (285
atoms): pure Pt; Pt with a random quarter Ni (alloy); Pt with the innermost
quarter Ni (core); Pt with a random quarter Al (light). Every atom gets
B = 12.8 + 6 (r / r_max)^2 A^2 in the B column, the PDB is rendered with
simulate_nanoparticle pdbfile= pdb_bfac=yes (the five-Gaussian element
kernels, no pseudo-atom anywhere), the render is multiplied in Fourier
space by the measured signal transfer of the real map, and noise is white
Gaussian noise shaped by the real map's background spectrum, scaled so that
the mean peak of the core Pt atoms is 17 standard deviations of the noise
measured outside 18 A; the alloy case also has two half maps (independent
noise at sqrt 2 times, averaged into the map). The ground truth is one
isolated atom of each element at the core B, rendered and filtered the
same way, whose aperture intensity is measured as discover_species
measures it (the voxel sum within d_NN / 2 times smpd^3 over the
enclosed fraction of the Gaussian fitted in that sphere). An atom is
eligible for the recall floors when its own kernel, rendered alone and
filtered with the signal transfer and the detection template, peaks at 6.5
or more standard deviations of the added noise filtered with the template,
and when the pruning of 3.9, computed on the generating model, would keep
it. Sixteen detect_atoms runs (pure: Pt, Pt with the key, Pt,Ni,
none, none with the key; alloy: Pt, Pt,Ni, Pt,Ni with half maps,
none, none with the key; core: Pt, Pt,Ni; light: Pt, Pt,Al, none,
none with the key) are judged against the generating model through
test_gate, which writes every check and metric into metrics.tsv in the
test's directory; the fixture tree is removed at the end, pass or fail.
The floors were written into the code before each run and only changed by a
ruling.
Decisions taken where the rulings leave room, recorded here:
- The Fourier filters act on the continuous spatial frequency
|hkl| / (box smpd), through the image's Fourier loop, rather thanimage%apply_filter, whose integer shells give only two shells beyond 20 A in this box and which gives the zero frequency the filter's maximum. Shell centres are the midpoints of the shell bounds in frequency; beyond the outer centres the profiles are constant. - The noise is scaled from its first draw; the core atoms are the inner 30% of the Pt atoms by radius, their peak the value of the filtered clean render at the nearest voxel.
- The isolated atoms of the ground truth are rendered at
B= 12.8 A^2, the core value of the B profile (in 10.6 as first written the core value was 0, which is why it saidB= 0); their width for the enclosed fraction is fitted with a flat prior and no background, since an isolated, noiseless atom has neither neighbours nor background. - Eligibility by the pruning policy uses the mean of the Pt positions as the centre and the fcc cutoff of Pt; the excluded atoms are reported per case.
- The phase 3 test read a fixed number of columns; the rebuilt test reads every table by its header.
The real map (scratch/keep/pt_real/recvol_state01_iter005.mrc, by hand,
no floors; scratch/p5/real/ before and scratch/p5/real_s3/ after the
pruning of the second ruling):
| before the second ruling | after it | |
|---|---|---|
element=Pt atoms, against the supplied _ATMS.pdb (476) |
476; 474 matched within 1 A, root mean square 0.016 A, largest 0.108 A | the same |
discover_species=yes: recovered, pruned, kept |
267, 27, 240 (an outer shell at 11.2 to 15.3 A) | 267, 249, 18 (all within 11.2 to 12.8 A, level 1 ends at 12.82 A) |
| detection z of the kept recovered atoms | 4.4 to 15.5, median 7.2 | 7.2 to 13.6 |
K with the key |
2, admissible, 195 atoms at intensity ratio 0.43 | 1 |
element=Pt,Ni: two-class fit |
admissible | inadmissible (D = 1.80) |
| present products across the three runs | identical | identical |
The supplied _ATMS.pdb writes the atom name as PT where this build
writes PT, so it came from another build; the two unmatched atoms are
likely that build's difference. The supplied _even and _odd maps
correlate 0.492 with the map and 0.964 with its _SIM.mrc: they are not
half reconstructions of this map and were not used. The ruling's measured
properties of the real map against the fixture, with one definition applied
to both (scratch/p5/proto/props.py): core peak over the noise 15.4 against
17.1; surface over core peak 0.77 against 0.91; between atoms inside the
particle -1.33 against +0.01 noise standard deviations. The fixtures carry
the real map's signal-to-noise and transfer but not all of its surface
broadening nor its negative wells.
Results of the final CTest run (ctest -R '^species_discovery$' on the
clean Debug build of ./compile_debug.sh, 304.2 s; the run before it, 281.6
s at load 0.07; the two runs wrote identical metrics.tsv files, kept as
scratch/keep/p5_evidence/species_discovery_metrics.tsv; logs
scratch/species_discovery_p5final.log and
scratch/species_discovery_p5_run6.log):
| Ground truth | Pt | Ni | Al |
|---|---|---|---|
| aperture intensity (ratio to Pt) | 445.6 | 250.1 (0.561) | 208.6 (0.468) |
| peak (ratio to Pt) | 129.5 | 66.1 (0.510) | 44.1 (0.341) |
| Case | noise sdev | eligible Pt / second | excluded by the pruning policy (Pt / second) |
|---|---|---|---|
| pure | 5.58 | 270 / - | 15 / - |
| alloy | 5.72 | 193 / 68 Ni | 21 / 3 |
| core | 5.41 | 202 / 71 Ni | 12 / 0 |
| light | 5.74 | 196 / 63 Al | 18 / 8 |
| Run | false | Pt recall | second recall | all eligible | K | labels | fitted ratio (error) | B rise |
|---|---|---|---|---|---|---|---|---|
pure Pt / none |
0 / 0 | 1.000 / 1.000 | ||||||
pure Pt + key, none + key |
0 | 1.000 | 1.000 | 1, nothing recovered | 1.41, 1.42 | |||
pure Pt,Ni |
0 | 1.000 | 1.000 | 2, inadmissible, nothing recovered | 1.36 | |||
alloy Pt / none (reported) |
0 | 1.000 | 0 | |||||
alloy Pt,Ni, with half maps |
0 | 1.000 | 1.000 | 1.000 | 2, admissible | all right, order right | 0.423 (24.6%) | 1.28 |
| alloy none + key | 0 | 1.000 | 1.000 | 1.000 | 2 | all right, order right | 1.30 | |
core Pt (reported) |
0 | 1.000 | 0 | |||||
core Pt,Ni |
0 | 1.000 | 1.000 | 1.000 | 2, admissible | one Ni at the centre called Pt (reported), order right | 0.489 (12.8%) | 1.41 |
light Pt / none (reported) |
0 | 1.000 | 0 | |||||
light Pt,Al, none + key |
0 | 1.000 | 0.952 | 0.988 | 2, admissible | all right, order right | 0.288 (38.4%) | 1.31, 1.33 |
The half-map run of the alloy reports noise_source = half_maps and a
label agreement of 1.00 between the halves. In the light case Pt,Al
found 60 of the 63 eligible Al atoms (61 Al atoms in all: 58 at the first
level of residual stage A, 3 at the first level of stage B), and
element=Pt found none of them, so the fixture tests the recovery; in the
alloy and core cases the Ni atoms were found at the first level of stage A
(70 and 71).
Within every case the five present products are identical across the runs
with the same first element.
Exit items of 10.6 as the rulings amended them: product identity within
each case (met); the pure case's K = 1 and no recovered atom with the key,
no recovered atom and an inadmissible two-class fit with Pt,Ni (met); Pt
recall of at least 0.98 over the eligible atoms in every run with discovery
and in the pure case, recall of at least 0.95 over all eligible atoms with
discovery, at most one false atom in every run (met: 1.000, 0.988 or more,
0); with the list in the alloy, core and light cases, every found atom
carrying its element (met in alloy and light; reported in the core case by
the fifth ruling, one wrong label), the two-class fit admissible, the
classes in the right order, the second element's recall at least 0.90
(met: 1.000, 1.000, 0.952), the ratio reported; _species.pdb with one atom
per table row and the element column the class's symbol (met); the light
case's element=Pt finding fewer than 90% of the eligible Al (0%) and
Pt,Al at least 90% (95%); the blind runs of alloy and light with K = 2,
every label right and class 1 Pt (met); the B rise between 0.5 and 1.5 of
the generated rise (1.28 to 1.42); half maps with noise_source =
half_maps and agreement at least 0.95 (1.00); every check through
test_gate into metrics.tsv, the fixture tree removed (met); wall time
far inside the 3600 s timeout in Debug, so the timeout is unchanged.
Checks of 10.0 on the final source: ./compile_debug.sh passes, 15 of 15
fast entries, 38 CTest entries against the budget of 38 (log
scratch/build_debug_p5.log); scripts/check_test_registry.py and
scripts/check_descr.py clean; no compiler warning; no THROW macro
continued across lines; no mode change. single_atoms_stats is unchanged
against phase 0 (285 atoms simulated and detected, recall and precision
1.0000, 0.0148 A, correlation 0.9997, 285 atoms and 19.527 A in
atoms_stats, 43.2 s), and its three compound entries are unchanged against
phase 4 (logs scratch/single_atoms_stats*_p5final.log).
The review report: the run's instructions gave it to the last phase; the third ruling added a phase 6 to this run and gave the report to it, so phase 5 does not write it.
Phase 6, fitting atoms with the map-filtered kernel: withdrawn (2026-10-09)¶
Files changed, at the end of the phase: this note (section 7's intensity
bias, the phase 6 section 10.7 recording the withdrawal, the later work
renumbered 10.8, the ruling paragraphs of 10.6, a section 15 entry, a
file-table row for the report, this entry) and
doc/implementation_notes/completed/species_discovery_report.md (this run's
section). No source file differs from the end of phase 5. Every path below
is under the run directory /home/elmlundho/agent_runs/species_element_model.
What happened. The third ruling of 2026-10-09 added the phase. It was
implemented as written:
- a new module simple_atom_kernel.f90 with the kernel table;
- estimate_transfer in simple_nanoparticle_utils.f90;
- fit_gauss_width taking the table;
- the discovery branch fitting through it;
- unit tests, all passing: the table equals the Gaussian at its nodes to
1e-5, the aperture integral equals enclosed_fraction to 1e-4, a known
transfer is recovered within 5%;
- the phase 6 floors in species_discovery.
The test failed (scratch/species_discovery_p6_run1.log):
- On the pure fixture the estimated transfer matched the noise-free one
within 1 to 2% out to 1.8 A (scratch/keep/transfer_pure.txt). From 1.68
A on, the noisy map's shell correlation fell below the ruled 0.2, and the
cut zeroed every shell beyond, where the fixture's transfer was still above
0.3 and the ruled check required a match.
- The alloy's fitted intensity ratio was 0.279 against the isolated atoms'
0.579 (52% low; phase 5: 25%). 10 to 14 surface Ni atoms were called Pt.
- The B-rise floor failed (1.8 to 2.9).
- On the real map the Pt class's spread became 77% of its mean (phase 5:
21%), with the shells at 3.3 to 7 A also zeroed.
A diagnostic copy without the correlation cut
(scratch/p6/species_discovery_nocut.log, the repository unchanged):
- It removed the core case's radial bias (Ni intensity 0.572, 0.553 and
0.546 inside 3 A, at 3 to 5 A and at 5 to 7 A; no wrong label).
- It still left the alloy ratio 37% low and the light ratio 42% low, Al
recall at 0.71 and the B rise near 1.9.
- The real map's class spread was 42%.
The sixth ruling withdrew the phase. The changes were undone by restoring
the five changed source files from the driver's snapshot at the start of
the phase (state/phase_6.start) and deleting the new module. Every file
but this note was then byte-identical to that snapshot, which is the end of
phase 5 (review/full_after_5.diff). The note was restored from the same
snapshot and then edited as the ruling asks.
Exit items of the sixth ruling and how they were met:
- Source undone. Every source file is identical to the end of phase 5
(checked with cmp against the snapshot); no untracked file;
simple_atom_kernel.f90 deleted. The test suites and CTest budget are as
phase 5 left them.
- Note. Section 10.7 records what was tried, what it measured, why it
was withdrawn and the probable cause. Section 7 keeps the intensity bias
as a known limitation with the phase 5 numbers. Section 15 has the entry.
The floors are as phase 5 closed them.
- Report. This run's section was appended to the report.
- Checks.
- ./compile_debug.sh passes: 15 of 15 fast entries, 38 CTest entries
against the budget of 38 (log scratch/build_debug_p6.log).
- scripts/check_test_registry.py and scripts/check_descr.py are
clean, and there is no mode change.
- single_atoms_stats is unchanged against phase 0: 285 atoms simulated
and detected, recall and precision 1.0000, 0.0148 A, correlation 0.9997,
285 atoms and 19.527 A in atoms_stats (log
scratch/single_atoms_stats_p6final.log).
- Its compound entries are unchanged against phases 4 and 5: CdSeW 147
atoms with interior coordination 4 and a 4.279 A; CdSeZ 154, 4 and
6.049 A; CdSeR 193 of 199, 6 and 5.468 A (logs
scratch/single_atoms_stats_cdse?_p6final.log).
- species_discovery passes with the phase 5 floors in 306.9 s (log
scratch/species_discovery_p6final.log). Its metrics.tsv is
byte-identical to phase 5's
(scratch/keep/p5_evidence/species_discovery_metrics.tsv).
Phase 7, five runs of detect_atoms on the 66 real Pt maps, after the mask fix (2026-10-11)¶
Files changed: this note only (this entry). No source file was touched; the
build is of the checkout as handed over (c28bfc101, which carries the fix
of the automatic mask, section 7, and the noise region taken from the map as
read, section 3.2). Every path below is under the run directory
/home/elmlundho/agent_runs/species_validation_r2; the tables, scripts and
detect_atoms logs are in scratch/keep/validation/. The first attempt of
this validation (run species_validation, paragraph in 10.9) is called "the
first attempt" below; its numbers come from its tables in
~/agent_runs/species_validation/scratch/keep/validation/, read only. Its
scripts were reused with the paths changed and two log lines added, so that
both runs measure the same way. No ruling was given for this run.
Terms used below. detect_atoms first runs the present detection ("level
1": a correlation with an atom template, a threshold, connected components,
splitting and pruning by contact score), which writes the five present
products (_ATMS.pdb, the atoms; _BIN.mrc, _CC.mrc, _MSK.mrc,
_SIM.mrc, the binary map, its components, the mask and the simulated map).
With discover_species=yes it then looks for further atoms in the residual
map in two stages (stage A at a threshold k_A calibrated on the map's own
noise, stage B at k_B = k_A - 1 with a neighbour requirement), removes the
recovered atoms in the outer zone of the particle that have too few level-1
neighbours (the pruning zone, section 3.9), fits every atom with a Gaussian
(stage 1 a free width B, stage 2 a width tied to the atom's class), measures
each atom's aperture intensity (the density summed in a sphere of half the
nearest-neighbour distance, section 3.5, with s_I its noise), and fits one
to three intensity classes (section 3.6). The noise is measured in the noise
region, the voxels of the map as read inside the box's inscribed sphere and
away from every atom (section 3.2). A class whose atoms all lie in the outer
zone is flagged as surface-confined. single_atoms_stats is the regression
test of the present detection on a simulated Pt particle (and on simulated
CdSe crystals of the wurtzite, zincblende and rocksalt lattices, whose
lattice constants are a and c); species_discovery is the test of
discovery on simulated particles: pure Pt, Pt with a random quarter Ni
(alloy), Pt with a Ni core (core), Pt with a random quarter Al (light). The
fast gate is the set of quick unit tests every build runs before installing.
Build and environment as in the earlier phases: the maintainer's Dell build machine (24 cores),
gfortran 15.2.1 from gcc-toolset-15, CMake 3.26.5, no modules; every shell
set SIMPLE_PATH to this checkout's build/ and took the maintainer's
checkout off PATH (scratch/env.sh). ./compile_clean.sh (Release, tests
built, fast gate, install) passed, the fast gate 15 of 15 entries, among them
the two new checks of the mask estimate in unit_image: the nano-mask
sub-suite (test_estimate_spher_mask_diam, 29 checks) and the binary-image
sub-suite (test_diameter_cc_3D among 58 checks) (log
scratch/build_release.log, the gate's output
scratch/fast_gate_LastTest.log).
The CTest entries, run one after another on an idle machine (load average
0.0) before any map (ctest -R '^(species_discovery|single_atoms_stats.*)$',
log scratch/ctest_p7.log, full output
scratch/keep/validation/evidence/ctest_p7_LastTest.log): all five pass.
| Entry | Wall time (Release) | Numbers |
|---|---|---|
single_atoms_stats (Pt) |
21.7 s | 285 atoms simulated and detected, recall and precision 1.0000, 0.0148 A, correlation 0.9997, 285 atoms and 19.527 A in atoms_stats: phase 0's numbers |
single_atoms_stats_cdsew |
12.3 s | 147 of 147, 0.0140 A, 0.9911, a 4.2786 and c 6.9869 A: phase 4's |
single_atoms_stats_cdsez |
10.0 s | 154 of 154, 0.0146 A, 0.9910, a 6.0493 A: phase 4's |
single_atoms_stats_cdser |
15.6 s | 193 of 199 (recall 0.9698), 0.0132 A, 0.9802, a 5.4680 A: phase 4's |
species_discovery |
105.5 s | 278 checks and metrics (274 distinct names), none failed |
On these simulated particles the program now measures a particle diameter of
21.2 A (Pt) and 21.2 to 22.6 A (CdSe) and masks at 1.2 times it, where
before the fix the mask covered the box. species_discovery's metrics.tsv
(copy evidence/species_discovery_metrics_p7.tsv) against the first
attempt's copy, every metric that moved
(evidence/metrics_compare.txt, made by compare_metrics.py): the stage-2
B of the Pt class in the inner and outer radial shells of every
discovery run, by 0.6% or less; the fitted-over-generated rise of B, by
2.0% or less (pure 1.320 to 1.295, alloy 1.214 to 1.200, core 1.404 to 1.422,
light 1.241 to 1.257, and the blind runs alike), and the generated rise
itself by 0.4% or less, since the shells are formed from the found atoms
(on the pure particle with element=Pt,Ni 4.551 to 4.535, its
ratio 1.2914 to 1.2907); on the pure particle with element=Pt,Ni, the size of the forced
second class (124 to 110 atoms) and its separation D (1.756 to 1.769,
still inadmissible); the fitted intensity ratios (alloy 0.4350 to 0.4324,
light 0.2863 to 0.2847, core 0.5119 to 0.5113; their relative errors
against the isolated-atom ratio 22.5 to 23.0%, 38.8 to 39.2% and 8.8 to
8.9%); in the core case, the
present detection with element=Pt found 215 atoms instead of 214, one of
them a Ni atom (Ni recall 0.014 instead of 0; the discovery run correspondingly
records one Ni atom at level 1, the metric "found at stage 0, level 0",
which the first attempt did not have because no Ni atom was found there, and
70 instead of 71 recovered); in the light case, the Al atoms found at the
first level of residual stage A went from 58 to 60 and of stage B from 3
to 1. These follow from the two changes the checkout carries: the mask, which
now cuts the fixture box at about 1.2 times the particle's diameter instead
of leaving it whole (the core case's extra level-1 atom is the present path
on a differently masked map), and discovery's noise region, now taken from
the map as read. No floor or check changed state.
The inventory, as the first attempt checked it (inventory.py,
inventory.tsv, identical to the first attempt's file): 66 maps of
/data/NanoX/zenodo/mrcs paired by name with their stored coordinates in
pdbs/, no unpaired file; 15 particles at 2 to 8 time points; boxes of 160
voxels (49 maps), 120 (13: ESC4, ESC5, FCHCS1) and 200 (4: EFC1); every map
stored as 32-bit reals (MRC mode 2) at 0.358 A per voxel; every stored atom Pt; 163 to 698 atoms per
map, median 313 (10.9's 315 is the upper of the two middle values).
The runs. Each map was run five times as 10.9's table defines them,
single_exec prg=detect_atoms vol1=<map> smpd=0.358 nthr=4 with the keys of
the run and nothing else (no mskdiam): run 1 element=Pt (the present
detection), run 2 element=Pt discover_species=yes (blind discovery with the
element), run 3 element=Pt,Ni (a second species asserted), run 4 no element
(species-free level 1), run 5 no element with discover_species=yes. Six
maps at a time, all 330 runs in 13 minutes (run_map.sh, log
logs/run_all_phase7.log, one log per map and run in logs/); the median
run took 10.6 to 13.3 s, depending on the run. No run stopped with an error. Run 2's _species.txt,
_species.csv and _ATMS.pdb of every map are kept in
scratch/keep/validation/maps/<name>/ for phase 8; the volumes were deleted
once the products had been compared. The tables (analyze.py):
validation.tsv, one row per map and run, and environment.tsv, the
per-coordination and per-radial-fifth numbers; summary.py writes the
numbers over maps below to summary_phase7.txt, and compare_first.py sets
them map by map against the first attempt (compare_first.tsv).
Stop conditions of the run (more than five maps failing in one run,
product differences on any map, the measured diameter more than 25% off the
coordinate extent on more than five maps), none met: no map failed in any run; the five
present products (_ATMS.pdb, _BIN.mrc, _CC.mrc, _MSK.mrc,
_SIM.mrc) are byte-identical (cmp) between runs 1, 2 and 3 and between
runs 4 and 5 on all 66 maps; the measured particle diameter is more than 25%
off the coordinate extent on one map only.
The mask. The particle diameter the program measures (log line particle
diameter in A:) over the extent of the stored coordinates (twice their
largest distance from their centroid plus one nearest-neighbour distance):
0.906 to 1.271, median 1.000, quartiles 0.974 and 1.028; the same in every
run of a map. Two maps lie outside 15%: EFC2_time18s (29.5 A against 24.8 A,
1.19; reproduced all the same) and EFC2_time39s (27.1 A against 21.3 A,
1.27). The first attempt's mask diameter was 2.9 to 4.0 times the extent on
every map. The mask, 1.2 times the measured diameter, cuts no stored atom on
the maps the present path did not reproduce: their stored atoms reach at
most 0.82 of the mask radius from the box centre (mask_cut.py,
mask_cut.tsv).
The present path (runs 1 and 4), against the stored coordinates, each stored atom matched one to one to a detected atom within 1 A (a map is reproduced when 98% or more of its stored atoms are matched):
| this run | first attempt | |
|---|---|---|
| run 1: reproduced / 50 to 98% matched / below 50% | 56 / 10 / 0 | 33 / 22 / 11 |
| run 4: the same | 47 / 19 / 0 | 44 / 14 / 8 |
| run 1: fraction of stored atoms matched, lowest and median | 0.849, 0.994 | 0.005, 0.980 |
| run 1: root-mean-square distance of the matched pairs, median (largest) | 0.034 A (0.083) | 0.061 A (0.208) |
| detected atoms outside the particle (stored radius plus 1.5 A), largest per map | 0 | 1870 |
The ten maps run 1 does not reproduce, with the fraction matched: ESC1_time28s
0.849 (496 atoms found of 569; run 4 finds 594 and matches 0.989, and the
first attempt's diagnostic with mskdiam of 37.8 A matched 568, against
this mask of 40.1 A), FCHCS1_time23s 0.923 (reproduced in the first attempt,
0.996), ESC4_time04s 0.947, EFC2_time39s 0.956, FC1_time21s 0.960,
EFC1_time29s 0.961, ESIP2_time27s 0.966, ECT2_time15s 0.973, ECT2_time22s
0.977, ESIP1_time03s 0.979. In each, detected atoms are fewer than stored
(6 to 86 stored atoms unmatched). On seven of them the median unmatched
atom lies 8.9 to 12.2 A from the box centre, 0.1 to 2.3 A inside the
largest stored radius, near the surface; on ESIP2_time27s, FCHCS1_time23s and
EFC1_time29s it lies 6.3 to 8.1 A from the centre, inside the particle.
Over all maps, the largest distance of a matched pair has median 0.141 A
(largest 0.517 A, ESC1_time28s), and run 1 finds 0.872 to 1.067 times the
stored atom count (median 0.997). Run 4's matched pairs have a
root-mean-square distance of median 0.049 A (largest 0.084 A). Run 4
misses 19 maps at 0.876 to 0.979, among them eight that the first attempt
reproduced at 0.98 to 1.00 (EFC3_time03s, EFC3_time16s, EFC4_time30s,
ESC2_time13s, ESC3_time26s, ESIP1_time03s, ESIP1_time24s, FC1_time14s, now
0.960 to 0.979). Of the first attempt's 33 maps reproduced by run 1, 32
still are. 10.9 expects every map reproduced; 56 of 66 are.
Discovery (runs 2, 3, 5), from _species.txt and _species.csv. K is
the number of intensity classes chosen; a two-class fit is admissible when
each class holds at least max(8, 0.02 N) atoms and the separation D
(the distance of the class means over their pooled spread) is 3 or more:
| this run | first attempt | |
|---|---|---|
K = 1, run 2 |
63 of 66 (95.5%) | 62 of 66 |
K = 1, run 5 |
64 of 66 (97.0%) | 62 of 66 |
Pt,Ni two-class fit inadmissible, run 3 |
62 of 66 (93.9%) | 61 of 66 |
D of the forced two classes, run 3: quartiles (range) |
1.19, 1.92, 3.59 (0.01 to 7.72) | 1.16, 1.95, 3.10 (0.03 to 6.27) |
| recovered atoms kept per map, run 2: median (range) | 12.5 (0 to 117) | 8 (0 to 606) |
| recovered atoms pruned per map, run 2: median (range) | 74.5 (1 to 300) | 73 (0 to 370) |
calibrated stage-A threshold k_A, run 2 |
4.56 to 4.94 | 4.97 to 5.55 |
k_B, run 2 |
3.56 to 3.94 | 3.97 to 4.55 |
expected noise maxima above k_A in the stage-A volume, run 2 |
0.2 on every map (the target) | 0.2 on every map |
expected noise maxima above k_B in the stage-B volume, run 2 |
2.0 to 4.4 | 0.7 to 17.6 |
| BIC(2) - BIC(1), run 2: median (range); positive prefers one class | 6.6 (-49.6 to 17.4) | 4.6 (-723.6 to 20.9) |
| recovered at stage A / stage B per map, run 2: median | 69 / 18 | 84 / 14 |
| recovered atoms kept per map, run 5: median (range) | 11 (0 to 121) | 8 (0 to 612) |
| median detection z of the kept recovered atoms per map, runs 2 and 5: median | 7.0 and 6.7 | 8.2 and 8.0 |
noise region (region_voxels), run 2, boxes 120 / 160 / 200, median |
278,000 / 1,014,000 / 2,426,000 | 720,000 / 1,884,000 / 514,000 |
| robust over plain spread of the region, run 2 | 0.80 to 1.18, median 0.991 | 0.64 to 1.15, median 0.982 |
aperture-intensity spread over s_I (its measurement noise), run 2, median |
2.14 | 2.39 |
sigma_n (map noise), s_A (noise of the matched amplitude), s_I, run 2: medians |
0.0056, 0.0104, 0.0254 |
The noise region now lies in the map as read, inside the box's inscribed
sphere and away from the atoms, so its size follows the box (227,000 to
317,000 voxels in boxes of 120, 833,000 to 1,098,000 in 160, 2,386,000 to
2,458,000 in 200); region_voxels per map is in validation.tsv.
The maps with a second class. Run 2: EFC4_time03s (22 atoms at 0.48 of the
first class's intensity, D 4.64) and ESC4_time01s (11 atoms at 0.40, D
4.64), both with every class-2 atom in the outer zone of the pruning and the
surface-confined flag set, and ESIP2_time05s (K = 2 with 12 atoms in the
brighter class, 0.67 ratio, D 3.68). Run 5: ESC4_time01s and ESIP2_time05s
(D 4.64 and 4.07). Run 3 admissible: those three and ESIP1_time08s
(8 atoms in the brighter class, D 3.59). The surface-confined flag fires on
11 maps in run 3 (all on class 2), on 2 in run 2 and on 1 in run 5. 10.9
expects K = 1 in runs 2 and 5 and Pt,Ni inadmissible on at least 95% of
the maps: met for runs 2 and 5, missed by one map for Pt,Ni (93.9%).
Where the kept recovered atoms lie, against the stored coordinates
(recovered_vs_stored.py, recovered.tsv, recovered_where.txt; a measure
the first attempt did not take). Over all maps, run 2 keeps 1534 recovered
atoms: 187 sit on a stored atom that level 1 missed (within 1 A; level 1
missed 284 stored atoms in all, and 97 remain missed after recovery), and
1347 sit on no stored atom, at a median distance of 2.57 A (2.33 to 2.76 A
for 80% of them) from the nearest stored atom, that is one bond length, with
a median of 7 stored atoms within 3.5 A (a close-packed interior site has
12); their detection z (the residual peak in noise standard deviations) has
median 6.4 (4.8 to 9.5 for 80%). Their radius over the outermost level-1
atom's is 0.87 at the median per map, and per map at most 9 of them lie
beyond the outermost level-1 atom. Run 5: 1364 kept, 160 on missed stored
atoms, 1204 on none. These are sites next to the particle's stored surface
that the stored model does not hold: weak densities a lattice step from the
known atoms, kept because they lie inside the pruning zone or have enough
level-1 contacts. Whether they are partly occupied sites or noise the stored
coordinates cannot tell; they do not form a class of their own (K = 1 on
63 maps).
Intensity and width against environment (runs 2 and 5; atom-weighted over
all maps, aperture intensity relative to each map's mean, environment.tsv):
| Coordination | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|
| atoms, run 2 | 635 | 2893 | 2501 | 1776 | 2469 | 1375 | 1873 | 9746 |
| intensity, run 2 | 0.871 | 0.853 | 0.900 | 0.946 | 0.959 | 0.987 | 1.010 | 1.098 |
stage-1 B (A^2), run 2 |
30.2 | 28.9 | 28.6 | 28.6 | 28.0 | 28.8 | 28.5 | 28.3 |
stage-2 B (A^2), run 2 |
30.8 | 29.5 | 29.1 | 29.1 | 28.6 | 29.4 | 29.3 | 29.1 |
| intensity, run 5 | 0.878 | 0.856 | 0.899 | 0.948 | 0.963 | 0.994 | 1.015 | 1.100 |
By radial fifth of the atoms (inner to outer, mean radius 5.0 to 11.1 A),
run 2: intensity 1.141, 1.062, 0.995, 0.932, 0.872; stage-1 B 29.0, 27.9,
27.9, 28.5, 29.2 A^2; stage-2 B 29.9, 28.7, 28.5, 29.0, 29.9 A^2 (run 5
within 0.002 and 0.2 A^2 of these). Per map, the
least-squares slope of the intensity against the coordination number, over
the map's mean intensity: median +3.75% per neighbour (quartiles +1.6% and
+5.6%; run 5 +3.79%); of the stage-1 B against (r / r_max)^2: median
-0.45 A^2 (quartiles -2.37 and +2.70; stage 2 -0.88; run 5 -0.84 and
-1.07). The first attempt's numbers over all its maps include the background
atoms of its failed maps, so the comparison is over the maps level 1
reproduced (its 33, this run's 56): intensity 0.856 at 6 neighbours and
1.094 at 12 (now 0.845 and 1.101), 1.139 to 0.870 from the inner to the
outer fifth (now 1.142 to 0.867), stage-1 B 28.9 A^2 at 6 neighbours and
28.2 at 12 (now 29.0 and 28.4), and +3.8% per neighbour at the median map
(now +3.83%). The mask fix has not changed these. On the fixtures of section 7 the intensity fell with
coordination (by 12% from 5 to 12 neighbours in the aperture sum alone) and
the fitted width fell with it (B 23.8 A^2 at 6 neighbours, 19.8 at 12); on
the real maps the intensity rises by 26% from 5 to 12 neighbours and the
width is flat.
Time series (per particle across its time points, summary_phase7.txt):
K = 1 in runs 2 and 5 at every time point of 12 of the 15 particles; the
exceptions are single time points (EFC4 at 3 s in run 2, ESC4 at 1 s and
ESIP2 at 5 s in both runs). The Pt,Ni fit is inadmissible at every time
point but four (EFC4 at 3 s, ESC4 at 1 s, ESIP1 at 8 s, ESIP2 at 5 s).
The recovered counts move with the time point
(for example EFC1: 73, 117, 30, 115; EFC2: 37, 51, 4, 48, 56, 1, 2, 12).
Exit items of phase 7 and how they were met:
- Build, fast gate and CTest before the maps:
./compile_clean.shpassed with the fast gate (15 of 15, the two mask checks included);species_discoveryand the foursingle_atoms_statsentries passed, with their wall times recorded, thesingle_atoms_statsnumbers equal to phases 0 and 4, and every moved metric ofspecies_discoverynamed above. - Inventory: 66 pairs, boxes, atom counts as above.
- Five runs per map with the keys of 10.9, the program's own mask, logs in
logs/<name>_run<k>.log; every map's rows invalidation.tsvandenvironment.tsv, including the measured particle diameter, the mask diameter andregion_voxels. - Product identity:
cmpof the five present products, runs 1 = 2 = 3 and 4 = 5, identical on all 66 maps. - Run 2's products kept for phase 8; volumes deleted.
- The phase-7 numbers of 10.9 over all maps above, beside the first attempt's where the mask changed them. The expectations of 10.9 are compared in the report of phase 8.
Phase 8, weaker classes planted into the real maps, and the comparison across maps (2026-10-11)¶
Files changed: this note (this entry) and
doc/implementation_notes/completed/species_discovery_report.md (this run's
section). No source file was touched; the build is phase 7's. Every path
below is under the run directory
/home/elmlundho/agent_runs/species_validation_r2; tables, scripts and
logs are in scratch/keep/validation/. No ruling was given.
The planting was done as 10.9 defines it, with the first attempt's script
(plant.py, only its paths changed), so that wherever the level-1 atoms of
the two runs agree the planted atoms are the same. The decisions it carries,
inherited from the first attempt: the pruning zone is centred on the mean of the
level-1 atoms of run 2's _species.csv (the present pruning centres it on
the atoms before its own deletions, which the table no longer holds); 20%
of the level-1 atoms inside prune_zone_radius, rounded to the nearest
integer, are drawn with Python's random.Random(zlib.crc32(name)), the same
atoms for every level; each planted atom gets a background patch centred on
a random voxel farther than the outermost level-1 atom plus 2 d_NN from
the centre (d_NN the median nearest-neighbour distance of _species.txt),
with the mean over all such voxels removed; atoms are applied one after the
other; the output keeps the input's header byte for byte. At each atom the
map is multiplied by f = 1 - (1 - r) w (w 1 within 0.35 d_NN, a cosine
to 0 at 0.5 d_NN) and the patch times sqrt(1 - f^2) is added; the
control adds 0.8 w times the patch and scales nothing. Levels r = 0.6,
0.4, 0.25 and the control, on all 66 maps: 29 to 120 planted atoms per map
(median 53.5), 3792 in all. The planted atoms of each map and level are in
planted/<name>_r060.tsv, _r040, _r025, _ctl (positions, radius,
patch voxel, and in the first line the seed, d_NN, the zone and the
background numbers). Two checks per planted map, both passed on all 264:
plant.py checks that every voxel outside the planted balls equals the
input and that r = 1 without noise returns the input unchanged;
check_planted.py, written independently, re-reads the files and finds the
header identical, every changed voxel within 0.5 d_NN of a planted atom,
and the value at the planted centres at r times the input on average (for
example 0.601, 0.401, 0.251 and 1.001 on ESC4_time01s; logs
logs/planted/<name>_plant.log).
Runs 2 (element=Pt discover_species=yes), 3 (element=Pt,Ni) and 5 (no
element, discover_species=yes) on every planted map, as in phase 7:
run_planted.sh, ESC4_time01s first as a test, then the other 65 maps 16
at a time from 13:08 to 13:33, 792 runs in all
(logs/run_all_phase8.log, one log per map, level and run in
logs/planted/), no run stopped with an error. Table planted.tsv
(analyze_planted.py), one row per map, level and run: a planted atom is
found when an atom of class 2 lies within 0.3 d_NN of it; recall is the
fraction of planted atoms found; precision the fraction of class-2 atoms
within 0.3 d_NN of a planted atom; false labels the class-2 atoms that are
not. Also the planted atoms detected by any atom, and by level 1; the
measured ratio, the mean aperture intensity of the detected planted atoms
over that of the unplanted atoms of the zone; and the fitted class ratio.
effective_ratio.py gives the noise-free ratio the planting makes inside
the aperture of section 3.5 (effective_ratio.tsv); summary_planted.py
writes summary_phase8.txt, extra_planted.py the numbers over the maps
with two classes (extra_planted.txt), and compare_first_p8.py the
comparison with the first attempt (compare_first_p8.txt).
Sensitivity over the 66 maps. "Found on a map" is 10.9's expectation: recall at least 0.9 with at most one false class-2 label.
| Level | run | maps found | maps with K = 2 (in brackets: maps where a two-class fit was admissible) |
recall on the K = 2 maps, median |
false labels there, median | planted atoms detected at all, median per map | measured ratio, median | noise-free ratio in the aperture, median |
|---|---|---|---|---|---|---|---|---|
| 0.6 | 2 | 0 | 4 (6) | 0.31 | 16 | 0.99 | 0.73 | 0.63 |
| 0.6 | 5 | 0 | 2 (4) | 0.20 | 36 | 1.00 | 0.73 | |
| 0.4 | 2 | 0 | 21 (21) | 0.83 | 11 | 0.85 | 0.61 | 0.45 |
| 0.4 | 5 | 1 | 20 (20) | 0.80 | 11 | 0.88 | 0.62 | |
| 0.25 | 2 | 1 | 25 (26) | 0.72 | 9 | 0.52 | 0.54 | 0.31 |
| 0.25 | 5 | 1 | 25 (26) | 0.69 | 9 | 0.51 | 0.54 | |
| control | 2 | 0 | 3 (3) | - | 21 | 1.00 | 1.02 | |
| control | 5 | 0 | 2 (3) | - | 114 | 1.00 | 1.02 |
(For the control, nothing is dimmed, so its recall has no meaning; its
"false labels" are the class-2 atoms of the phase-7 two-class maps.)
Precision where a second class was called: at 0.6, median 0.47 (run 2) and
0.05 (run 5); at 0.4, 0.76 and 0.78; at 0.25, 0.79 and 0.81. The fitted
class ratio less r on those maps: at 0.6, -0.05 (run 2) and -0.11 (run 5);
at 0.4, +0.13 and +0.13; at 0.25, +0.20 and +0.21 (medians; range at 0.4 and
0.25 +0.06 to +0.33). In run 3 it is +0.13, +0.28 and +0.40.
Run 3, where Pt,Ni forces two classes on every map: admissible on 6, 21
and 25 maps at the three levels and 3 for the control; median recall 0.80,
0.75, 0.49; median precision 0.26, 0.41, 0.33; median false labels 115,
58, 38. Where two classes were admitted at r = 0.4 (run 2), the precision
was 0.55 to 0.97 (median 0.76) and the fitted class ratio 0.06 to 0.22
above r (median +0.13): the fitted ratio, 0.53 at the median, is close to
the measured ratio of the planted atoms on those maps, 0.54 (over all maps
0.61).
At 0.6 the planted atoms are detected (99% median per map, a quarter of them
by level 1) but form no class of their own: their measured ratio, 0.73, is
within the spread of the unplanted Pt intensities (the aperture-intensity
spread is about twice its measurement noise, phase 7). From 0.4 on the
planted atoms fall out of level 1 (none at the median map) and are reached
by the recovery, 85% of them at 0.4 and 52% at 0.25. A second class appears
on a third of the maps at 0.4 and below, and is then mostly the planted
atoms; on the other two thirds the call stays at one class. The maps with a
second class at 0.4 cluster by particle: every time point of ESC4 and
FCHCS1, ESC5 at 3 s, five of EFC4's six time points,
two of EFC3, ESC3 at 13 and 26 s, ESIP1 at 3 and 13 s, ECT2 at 5 s.
The control. It adds the noise of the 0.6 level without scaling anything:
the planted atoms are detected as before (measured ratio 1.02) and K is
the same as in phase 7 on every map in runs 2 and 5. Its two-class maps in
run 2 (EFC4_time03s, ESC4_time01s, ESIP2_time05s) are phase 7's, and on none
of them is class 2 mostly planted atoms. One admissibility call changed:
the two-class fit of ESIP1_time08s, admissible in phase 7 (runs 2 and 3),
is not on the control map. The noise injection does not create a class.
Against the first attempt (compare_first_p8.txt): the same picture. Maps
found at 0.6, 0.4, 0.25 in run 2: 0, 1, 1 then and 0, 0, 1 now; maps with
two classes 5, 20, 26 then and 4, 21, 25 now; on the 32 maps both runs'
level 1 reproduced, 4, 15, 18 then and 3, 13, 18 now. The mask fix did not
change the sensitivity.
Across maps, 10.9's six items over both phases, with the expectations of 10.9:
- Present path: 56 of 66 maps reproduced with
element=Pt(at least 98% of the stored atoms matched within 1 A), 47 without an element; the ten others match 0.85 to 0.98 and are listed in phase 7's entry. Expected every map; not met. The first attempt: 33 and 44. - False positives:
K= 1 on 63 (95.5%) and 64 (97.0%) of the maps in runs 2 and 5, expected 95%, met;Pt,Niinadmissible on 62 (93.9%), expected 95%, missed by one map; the forcedD0.01 to 7.72 (median 1.92); kept recovered atoms 0 to 117 per map (median 12.5), 88% of them a bond length from the stored atoms at sites the stored model does not hold; the surface-confined flag fires on 2, 11 and 1 maps in runs 2, 3, 5. - Environment: the aperture intensity rises with coordination (+3.8% of the
map mean per neighbour at the median map; 0.87 at 5 neighbours to 1.10 at
12) and falls with radius (1.14 to 0.87 from the inner to the outer fifth);
the fitted
Bis flat with coordination (28.9 A^2 at 6, 28.3 at 12) and with radius (median slope -0.45 A^2 against(r / r_max)^2). On the fixtures of section 7 the intensity fell with coordination and the width fell by 4 A^2 from 6 to 12 neighbours; on the real maps neither artefact shows, and the intensity trend has the opposite sign. - Time series: one class in both runs 2 and 5 at every time point of 12 of the 15 particles; the exceptions are single time points (EFC4 at 3 s in run 2 only, ESC4 at 1 s, ESIP2 at 5 s). The recovered counts do not stay the same: within a particle they range, for example, from 1 to 56 (EFC2), 24 to 111 (ESC1) and 30 to 117 (EFC1) in run 2.
- Sensitivity: above. Expected the planted class found at 0.6 and 0.4 on at
least 90% of the maps; found on none at 0.6 and on 1 of 66 at 0.4 (run 5);
not met. In 10.9's sense the planted class is found on at most one map at
any level, so there is no
rbelow which it is found. What changes withris whether a second class is called: at 0.6 on 4 maps, about half of its atoms planted (median precision 0.47); at 0.4 and 0.25 on a third of the maps, with recall about 0.8 and about ten false labels there. The control was never reported as a second class, as expected. - Mask: the measured diameter over the coordinate extent 0.91 to 1.27 (median 1.00); expected within 15% on every map; two outside (EFC2_time18s 1.19, EFC2_time39s 1.27).
Exit items of phase 8 and how they were met:
- Planting as 10.9 says, on every map, at the three levels and the control, with the planted atoms recorded per map and level, and the check that the planted map equals the input outside the planted balls: done, both checks passed on all 264 planted maps.
- Runs 2, 3 and 5 on every planted map, every run's numbers in
planted.tsv: 792 runs, no error. - The across-map analysis of 10.9 over the tables of both phases: above, with the expectations compared.
- The report: this run's section of
species_discovery_report.md. - The planted maps and the volumes of every run were deleted; the tables,
scripts and logs stay in
scratch/keep/validation/.
Before phase 9: the coordination term built and tested on the Mac (2026-10-12)¶
Not a run phase. These are the maintainer's build and test runs of the checkout with the coordination term of 3.6, before it was committed: the precondition of 10.11's first item.
- Build on
c28bfc101with the term: the fast gate passed 15 of 15.unit_singletook 3.8 s, of which 3.4 s were thespeciessub-suite (65 checks,test_coordination_termamong them). After a sync to665ac2731, which changes no SINGLE source, the fast gate passed 15 of 15 again. species_discovery, run by hand: normal stop after 143.6 s, every floor met. The numbers, from itsmetrics.tsv:
| Run | found / false | Pt recall | second recall | all eligible | K, labels | fitted ratio (error) | B rise |
|---|---|---|---|---|---|---|---|
pure Pt / none |
285 / 0 | 1.000 / 1.000 | |||||
pure Pt + key, none + key |
285 / 0 | 1.000 | 1.000 | 1, nothing recovered | 1.39, 1.41 | ||
pure Pt,Ni |
285 / 0 | 1.000 | 1.000 | 2, inadmissible (D 0.55), nothing recovered |
1.33 | ||
alloy Pt / none (reported) |
212, 213 / 0 | 1.000 | 0, 0.014 | ||||
alloy Pt,Ni, with half maps |
281 / 0 | 1.000 | 0.986 | 0.996 | 2, admissible, all right, order right | 0.434 (22.7%) | 1.20 |
| alloy none + key | 281 / 0 | 1.000 | 0.986 | 0.996 | 2, all right, order right | 1.22 | |
core Pt (reported) |
215 / 0 | 1.000 | 0.014 | ||||
core Pt,Ni |
285 / 0 | 1.000 | 1.000 | 1.000 | 2, admissible, all right, order right | 0.528 (5.9%) | 1.52 |
light Pt / none (reported) |
207 / 0 | 1.000 | 0 | ||||
light Pt,Al, none + key |
268 / 0 | 1.000 | 1.000 | 1.000 | 2, admissible, all right, order right | 0.268 (42.7%) | 1.30, 1.29 |
- The half-map run of the alloy reports
noise_source = half_mapsand a label agreement of 1.00. - The core case labels every found atom right, the Ni atom at the centre included, so its label floor is restored in the test (10.6, fifth ruling).
- These fixtures are not phase 5's. The test's seeding changed on
2026-10-11 (the seed fixed in
simple_test_exec,set_fixed_seedin the test), and the eligible atoms differ (alloy 204 Pt and 70 Ni, against 193 and 68). Against phase 5, as an indication only, the alloy and core ratios moved toward the single-atom ratio (0.434 against 0.423, 0.528 against 0.489), the light ratio away from it (0.268 against 0.288), and the Al recall rose from 0.952 to 1.000. Phase 7's copy ofmetrics.tsvwas made with the same seeding and is still the like-for-like comparison of 10.11. It is on dell. single_atoms_stats(element=Pt), run by hand: normal stop after 24.5 s. The three compound entries (CdSeW,CdSeZ,CdSeR) were not run.- Two more fixes the same day, by hand.
atoms%extract_atomnow copies every per-atom field: it dropped the occupancy, so an extracted pseudo-atom rendered with zero intensity. The atoms tester checks it. Its callers are the model-validation routines, notdetect_atoms.atoms%copy(also the assignment) now copies the charge column, which it left blank; atoms built bydetect_atomscarry no charge. These two fixes and the restored floor have not been built yet.
Appendix. Emulation scripts¶
emul_detect.py: atoms%convolve, phase_corr, otsu, sortmeans,
26-connected components, raw-weighted centroids and the bisection of
binarize_and_find_centers, written from the source. emul_species.py: the
generating model, sections 3.1 to 3.8 and 4 of this note, the three statistics
of 8.4, and the case list (python3 emul_species.py, or with case labels as
arguments; about 25 s per case). Seeds are fixed. The template-width bank of
section 7 and the "13 noise peaks returned as a species" observation of 3.3
come from an earlier variant of the residual levels (connected components,
exclusion at 0.5 d_NN); the gate numbers of 3.3 are from the current
variant (8.8).
codex_checks.py (numpy only, kept with the other two): the independent
generator and detector of 8.8, with python3 codex_checks.py null | contam |
gate | all (about two minutes for all). It ports detect_peak_thres_fdr
and implements the threshold calibration of 3.2 as calibrate_k.
emul_species_cases.py (numpy only, in the arun run species_validation,
numpy_checks/): the fixtures of 10.6 and the fit and classification steps
of discover_species, with the level-1 positions taken from the generating
model. CASE=pure|alloy|core|light INT_MODE=own|common python3
emul_species_cases.py <seed> 20 list,blind writes one JSON record (about 8 s
per mode). It gave the coordination-bias numbers of section 7.
real_fit.py, classfit.py, aggregate.py and fixture_check.py (beside
it): the class-fit checks of 10.10. real_fit.py <map> <atms.pdb> <seed> <r>
<out.npz> fits a real map's level-1 atoms and plants a class at r
(r = 1 plants nothing, r = 2 is the noise control); classfit.py fits
the present, additive, multiplicative and fully-coordinated variants to
each output and aggregate.py sums them. mask_est.py is the numpy copy of
the fixed mask estimate (section 7).