abtem.inelastic.core_loss#
Module Contents#
Classes#
Functions#
Validate that the quantum numbers (n, l) correspond to an occupied subshell for element with atomic number Z. Raises RuntimeError if invalid. |
|
Parse an electron configuration string (e.g. “1s2 2s2 2p6”) into a list of (n, l, occupancy) tuples. |
|
Convert a list of (n, l, occupancy) tuples back to an electron configuration string (e.g. “1s2 2s2 2p6”). |
|
Batched 2D circular roll: |
|
Given precomputed function f(x), solves for x(t), which satisfies: x’’(t) = f(t) x(t) |
|
PRISM-EELS driver following Brown et al. (Phys. Rev. Research 1, 033186, 2019). |
|
PRISM-EELS beam-basis reduction (Brown et al. Sec. IV B / Eq. dropped
in supplementary; |
|
Remove one electron from the (n, l) subshell in the given configuration string and return the updated configuration string. |
Data#
API#
- class abtem.inelastic.core_loss.AtomicWaveFunction(...)[source]#
Initialization
- property bound#
- property energy#
- property l#
- property ml#
- property n#
- property quantum_numbers#
- property radial_grid#
- class abtem.inelastic.core_loss.BaseTransitionPotential(...)[source]#
Bases:
abtem.core.energy.HasAcceleratorMixin,abtem.core.grid.HasGrid2DMixin,abtem.core.utils.CopyMixin
- class abtem.inelastic.core_loss.RadialWavefunction(...)[source]#
Initialization
- property bound#
- property energy#
- property l#
- property n#
- property radial_grid#
- class abtem.inelastic.core_loss.SubshellTransitions(...)[source]#
Bases:
abtem.inelastic.core_loss.BaseTransitionCollectionInitialization
- property bound_configuration#
- property epsilon#
- property excited_configuration#
- property l#
- property lprimes#
- property min_contrast#
- property n#
- property order#
- property xc#
- class abtem.inelastic.core_loss.TransitionPotential(...)[source]#
Bases:
abtem.inelastic.core_loss.BaseTransitionPotential- property ensemble_axes_metadata: list[AxisMetadata]#
- filter_by_intensity(...) TransitionPotential[source]#
- property transition_quantum_numbers#
- property transitions#
- class abtem.inelastic.core_loss.TransitionPotentialArray(...)[source]#
Bases:
abtem.array.ArrayObject,abtem.inelastic.core_loss.BaseTransitionPotential- filter_by_intensity(...) TransitionPotential[source]#
- abtem.inelastic.core_loss.azimuthal_letter#
None
- abtem.inelastic.core_loss.azimuthal_number#
None
- abtem.inelastic.core_loss.check_valid_quantum_number(...)[source]#
Validate that the quantum numbers (n, l) correspond to an occupied subshell for element with atomic number Z. Raises RuntimeError if invalid.
- abtem.inelastic.core_loss.config_str_to_config_tuples(...)[source]#
Parse an electron configuration string (e.g. “1s2 2s2 2p6”) into a list of (n, l, occupancy) tuples.
- abtem.inelastic.core_loss.config_tuples_to_config_str(...)[source]#
Convert a list of (n, l, occupancy) tuples back to an electron configuration string (e.g. “1s2 2s2 2p6”).
- abtem.inelastic.core_loss.fast_roll(...)[source]#
Batched 2D circular roll:
out[i] == xp.roll(array, shifts[i], axis=(0, 1)).On CPU the per-site quadrant-copy loop is already very fast — each slice is a memmove — and beats both
xp.rollin a loop and a full advanced-indexing gather. On GPU the advanced-indexing form wins because the per-site loop serialises kernel launches; we dispatch on the backend.Shifts are first reduced modulo
H/Wso negative and out-of-range values are handled correctly (the previous version raised RuntimeError on negative shifts).
- abtem.inelastic.core_loss.numerov(...)[source]#
Given precomputed function f(x), solves for x(t), which satisfies: x’’(t) = f(t) x(t)
- abtem.inelastic.core_loss.prism_transition_potential_scan(...)[source]#
PRISM-EELS driver following Brown et al. (Phys. Rev. Research 1, 033186, 2019).
Supports any
interpolationfactor,downsamplesetting, and both single- and double-channel modes. The scatter and (optionally) double-channel propagation operate on a cropped grid at full resolution centered at each scattering site (Sec. IV B); whendownsampleis enabled the scattered result is Fourier-cropped to the downsampled resolution before per-position reduction.At
interpolation=(1,1)withdownsample=Falsethe output is bit-equivalent (to float32 noise) toProbe.transition_potential_scanat the matchingdouble_channelsetting.double_channel=Truepropagates the scattered state through the remaining potential slices to the exit before reducing per-position;double_channel=False(default) detects immediately at the scatter slice — Brown’s single-channel approximation.Frozen-phonon ensemble averaging is handled at the
SMatrixlevel (seeSMatrix.transition_potential_scan); Dask lazy evaluation is supported via thelazyparameter on that method.- Parameters:
s_matrix (SMatrix) – S-matrix specification (any
interpolation).transition_potentials (BaseTransitionPotential) – Atomic transition potential.
detectors (BaseDetector or list, optional) – Detectors. Defaults to
FlexibleAnnularDetector().sites (Atoms or SliceIndexedAtoms, optional) – Scattering sites. Auto-extracted from the potential if not given, following the same logic as
transition_potential_multislice_and_detect.inelastic_crop (float or tuple of float, optional) – Real-space side length [Å] of the window on which the transition potential
H_n0and the scattered wave are evaluated, following Brown et al. Sec. IV B (their independentinelastic_cropfactor). Smaller windows speed up the scatter and — most significantly — the double-channel inner propagation, at the cost of truncating theH_n0tails (cf. their Fig. 4 / Table II). IfNone(default) the full PRISM cellextent / interpolationis used (current behaviour). The window is clamped to the PRISM cell: values larger thanextent / interpolationare not supported by this real-space reduction (they would admit aliased probe copies) and are clamped with a warning — exceeding the cell requires the beam-basis reduction (see the PRISM-EELS follow-up note).
- Returns:
One measurement per detector.
- Return type:
- abtem.inelastic.core_loss.prism_transition_potential_scan_beam_basis(...)[source]#
PRISM-EELS beam-basis reduction (Brown et al. Sec. IV B / Eq. dropped in supplementary;
PRISM_double_channeling_nanoparticle.m) — the accuracy-oriented alternative toprism_transition_potential_scan().Implements Brown’s beam-basis contraction (un-reduced S-matrix columns against a transition-potential window, before applying the periodic position phase ramps). This was originally pursued (GitHub issue abTEM/abTEM#293) to let the transition-potential window exceed the real-space driver’s PRISM-cell cap, in the hope of fixing the delocalized-edge truncation error at
interpolation > 1. That goal turned out to be unfounded: the interpolation-decimated PRISM probe is exactly periodic with the PRISM cell (extent / interpolation), so a window larger than the cell multiplies the transition-potential tail against an exact copy of the probe peak — adding spurious signal rather than recovering accuracy. A direct experiment (issue #293, Update 4) confirms the shape error is flat-to-worse as the window grows past the cell, and Brown’s own published run uses a window smaller than the cell.inelastic_cropis therefore clamped to the cell, exactly like the real-space driver. This function is kept as a validated, independent re-derivation of Brown’s reduction (bit-exact atinterpolation=1); it does not — and now appears it cannot — beat the real-space path on delocalized-edge accuracy. The lever for delocalized edges is a larger cell (lowerinterpolationor a bigger supercell), not a larger window.Normalisation derivation (validated bit-exact against
Probe.transition_potential_scanatinterpolation=(1, 1)for both single- and double-channel; seeproject_prism_eels_beam_basis_conventionmemory note): for an abtemfft2/ifft2pair (unnormalised forward,1/Ninverse),fft2(forward_propagate(psi))[q] = N * sum_r conj(S2[q, r]) * psi[r]
where
N = prod(gpts)andS2[q]is built by reverse-propagatingifft2(delta_q)through the remaining slices withconventional_multislice_step(..., conjugate=True, transpose=True). The full contraction isSHn0[q, k] = N * sum_{r in window} conj(S2[q, r]) * H(r) * S1[k, r] recip[pos, q] = sum_k coeff[pos, k] * SHn0[q, k]
Limitations (this is a validated reference implementation, not an optimised production path — see GitHub issue abTEM/abTEM#293):
inelastic_cropexceeding the PRISM cell is clamped (with a warning): it is not a useful regime — see the docstring intro.S2(double-channel) is built over the full native reciprocal grid (prod(gpts)beams). Memory and compute scale asO(prod(gpts)^2)per scattering site per slice — only practical for small grids.Single exit plane only (
len(potential.exit_planes) == 1).No frozen-phonon ensemble (
potential.ensemble_shape == ()).No
downsamplesupport (s_matrix.downsampled_gpts == s_matrix.gpts).Eager only; no Dask laziness.
- Parameters:
s_matrix (SMatrix) – S-matrix specification (any
interpolation).transition_potentials (BaseTransitionPotential) – Atomic transition potential.
detectors (BaseDetector or list, optional) – Detectors. Defaults to
FlexibleAnnularDetector().sites (Atoms or SliceIndexedAtoms, optional) – Scattering sites. Auto-extracted from the potential if not given.
double_channel (bool, optional) – If
True(default), propagate the scattered state to the exit via a reverse-multisliceS2before reducing. IfFalse, detect immediately at the scatter slice (single-channel):S2is then trivial — the contraction reduces to an FFT of the windowed scattered field directly, no reverse multislice needed.inelastic_crop (float or tuple of float, optional) – Real-space side length [Å] of the window on which
H_n0and the scattered wave are evaluated. Clamped to the PRISM cell (extent / interpolation) with a warning if larger — see Limitations above. IfNone(default), the PRISM cell is used, matching the real-space driver’s default window.
- Returns:
One measurement per detector.
- Return type: