Skip to main content

Module psf

Module psf 

Source
Expand description

Radial point-spread function (PSF) of a pencil beam: extraction from the electron deposition tally and double- or triple-Gaussian fits.

§The radial profile

A RadialAccumulator bins the energy deposited by the electron transport in a depth slab depth_lo <= x < depth_hi by the distance r = (y² + z²)^(1/2) from the beam axis (the axis of CylindricalGrid). The radial bins are log-spaced (LogRadialBinning) so that one profile spans nanometres to the backscatter range; bin 0 is the inner disc [0, r_min). Deposits at r >= r_max in the slab are kept in RadialProfile::beyond_ev, so the profile sums to the energy deposited in the slab. The accumulator is fed by FullElectronTally when ElectronTallyConfig::psf is set, from the same deposits (and with the same bookkeeping convention) as its cylindrical r-x grid; it is an r-x grid restricted to one depth slab, with log radial bins.

Per-bin errors from per-history accumulation. Within a history the deposits of every bin are summed into a scratch array; at the end of the history the bin’s history total x_h is added to S = Σ_h x_h and its square to Q = Σ_h x_h². The standard error of the bin total S over N histories is then (N/(N-1) (Q - S²/N))^(1/2), N times the unbiased sample variance of x_h taken to the square root (the usual batch estimator with batches of one history). Energy deposited by the secondaries of a history is part of that history. With N < 2 the error is reported as 0, and a fit then has no usable bins.

§The fitted forms

Double Gaussian. The normalised double-Gaussian proximity function of T. H. P. Chang, “Proximity effect in electron-beam lithography”, J. Vac. Sci. Technol. 12, 1271 (1975), doi:10.1116/1.568515, as printed in Q. Mao, J. Zhu, X. Cheng and Z. Wang, Discover Nano 20, 84 (2025), doi:10.1186/s11671-025-04264-0 (open access, CC BY-NC-ND 4.0; PMC12089565), eq. (1), section “Traditional Gaussian model”:

f(r) = 1/(π (1 + η)) [ (1/α²) exp(-r²/α²) + (η/β²) exp(-r²/β²) ]

with α the forward-scattering range, β the backscattering range and η the ratio of backscattered to forward-scattered energy (Mao et al.’s words). Chang’s paper itself is closed access and was not seen (see docs/data-provenance.md); Mao et al. attribute the form to it.

Triple Gaussian. The sum-of-Gaussians PSF of T. Rosa Figueiro, Process modeling for proximity effect correction in electron beam lithography, PhD thesis, Université Grenoble Alpes (2015), HAL tel-01206934, eq. (72), p. 111 (PDF page 112):

PSF(x) = 1/(1 + Σ η_i) [ 1/(π α²) exp(-x²/α²) + Σ_i η_i/(π β_i²) exp(-x²/β_i²) ]

with two terms in the sum (the “3 Gaussian PSF model” of its Fig. 61). Here β_1 = β, η_1 = η, β_2 = γ, η_2 = ν:

f(r) = 1/(π (1 + η + ν)) [ (1/α²) e^(-r²/α²) + (η/β²) e^(-r²/β²) + (ν/γ²) e^(-r²/γ²) ]

With one term in the sum, eq. (72) is Mao et al.’s eq. (1). Both are normalised, ∫₀^∞ f(r) 2πr dr = 1; the fitted function is E f(r), eV/m², with E (eV) a free parameter, the energy the PSF represents.

§How the fit is done

The data are the bin energies themselves (not their logarithm), and the model of bin [a, b) is the exact annulus integral of E f(r). Each Gaussian term integrates in closed form (our own one-line integral, checked numerically in the tests):

∫_a^b (1/(π w²)) exp(-r²/w²) 2πr dr = exp(-a²/w²) - exp(-b²/w²)

so there is no bin-centre approximation, however wide the log bins are. The fit minimises the weighted sum of squares χ² = Σ_i ((E_i - μ_i)/σ_i)² with σ_i the per-history standard error of bin i; bins with σ_i = 0 (no deposit, or fewer than two histories) carry no information and are left out. Large dynamic ranges are handled by the weights: a bin’s error scales with its content.

Normalisation. By default (PsfNormalization::SlabTotal) E is fixed to the energy deposited in the slab (RadialProfile::total_ev, deposits beyond r_max included) and only the shape is fitted, so the fitted function integrates to the slab energy whatever the quality of the fit: the forms are normalised, and their scale is the deposited energy. With PsfNormalization::Free E is fitted too. That recovers E when the form describes the profile, but a Gaussian sum fitted to a profile it does not describe follows the best-measured bins, and its integral can then miss the slab energy by tens of percent. One case is a point beam, which deposits a finite fraction of its energy on the axis itself, before the first deflection; no Gaussian of finite width reproduces that.

The algorithm is our own, built from textbook pieces not opened for this implementation: a start from a grid search over the widths (for fixed widths the model is linear in the term amplitudes, solved by weighted linear least squares; starts with a non-positive amplitude are skipped), then Levenberg-Marquardt iterations (K. Levenberg, Q. Appl. Math. 2, 164 (1944); D. W. Marquardt, J. SIAM 11, 431 (1963)) on the logarithms of the parameters (which keeps them positive) with the analytic Jacobian. The covariance is (Jᵀ W J)⁻¹ in the natural parameters at the minimum, with W = diag(1/σ_i²); it is not scaled by the reduced χ², so a reduced χ² well above 1 signals that the form does not describe the profile and that the errors are too small. The labels follow the start: the grid orders the widths α < β (< γ).

§Determinism

The accumulator merges field by field in the order crate::rng::run_particles merges chunk tallies, so the profile is bit-identical at any thread count for a fixed chunk size, and the fit is a fixed sequence of floating-point operations on the merged profile.

§Export

PsfReport holds a profile and its fits, derives Serialize and Deserialize (callers serialise it, as for the other reports), and writes the profile with the fitted model per bin (PsfReport::profile_csv) and the parameters with their errors (PsfReport::parameters_csv) as CSV. Lengths are in metres, energies in eV, areal densities in eV/m².

Structs§

GaussianPsf
A double- or triple-Gaussian PSF scaled to the energy total_ev: E f(r), eV/m² (see the module docs). The triple form has gamma_m and nu; the double form has neither.
LogRadialBinning
Log-spaced radial bins: bin 0 is the disc [0, r_min), bins 1..=bins split [r_min, r_max) into bins bins of equal width in ln r. Metres.
PsfConfig
Where the radial profile is taken: log radial bins and a depth slab depth_lo_m <= x < depth_hi_m, m.
PsfFit
The result of fit_psf.
PsfFitOptions
Settings of fit_psf.
PsfReport
A radial profile and its fits, for export.
PsfResidual
One bin of a fit: data, model and normalised residual.
RadialAccumulator
Per-history accumulation of a radial profile (see the module docs). Call RadialAccumulator::deposit for every deposit of a history and RadialAccumulator::end_history once at its end.
RadialProfile
A radial energy-deposition profile in a depth slab, summed over all histories, with per-bin standard errors. Bin i is the annulus edges_m[i] <= r < edges_m[i + 1].

Enums§

PsfError
Errors of the PSF extraction and fit.
PsfModel
Which proximity function is fitted.
PsfNormalization
How the energy scale E of the fitted PSF is set.

Constants§

PSF_FIT_METHOD
How the fit is done, as recorded in a PsfFit.

Functions§

fit_psf
Fits the double- or triple-Gaussian PSF to a radial profile. See the module docs.