---
title: 'treams_ebeam: Fast-Electron Spectroscopy Module'
url: https://www.emergentmind.com/topics/treams_ebeam
type: topic
---

# treams_ebeam: Fast-Electron Spectroscopy Module

`treams_ebeam` is an open-source extension module to the T-matrix-based nanophotonics suite `treams` that implements fast-electron spectroscopy—specifically cathodoluminescence (CL) and electron energy-loss spectroscopy (EELS)—within the same algebraic scattering framework used for optical excitation. It reuses T-matrix descriptions of individual scatterers and ensembles, adds an electron-beam source, supports cylindrical-wave and spherical-wave basis transformations, and provides closed-form CL and EELS observables for single particles, finite clusters, and one-dimensional periodic chains under aloof or parallel trajectories. The code is available at `https://github.com/tfp-photonics/treams_ebeam` [2602.12743].

## 1. Definition and scope

The defining feature of `treams_ebeam` is the integration of free-electron excitation into a T-matrix formalism in which scatterers are represented by illumination-independent response operators. In this framework, the same object description can be reused across different excitations, including conventional electromagnetic illumination and the near field of a fast electron. The module therefore serves as a computational bridge between nanophotonic multiple-scattering theory and electron-beam spectroscopies such as CL and EELS [2602.12743].

The scope of the implementation is explicitly threefold. First, it treats isolated scatterers, including analytically supported cases such as spheres and infinite cylinders. Second, it handles finite aggregates by combining per-particle T-matrices with translation and multiple-scattering operators. Third, it treats periodic one-dimensional chains, including electron motion parallel to the periodic axis and the associated diffracted cylindrical orders. In all three cases, the computational object remains the multipole coefficient vector rather than a real-space mesh, so the method is meshless in the sense emphasized by the implementation paper [2602.12743].

The intended application domain is fast-electron spectroscopy in homogeneous vacuum or air. The presented formalism is classical electrodynamics with local material response, so it addresses CL as far-field radiation generated by electron-driven scattering, and EELS as the work done by the scattered field on the traversing electron. This places `treams_ebeam` squarely in the computational ecosystem used to design and interpret nanophotonic electron-beam experiments [2602.12743].

## 2. Basis expansions and scattering formalism

The formalism expands electromagnetic fields in either a cylindrical wave basis (CWB) or a spherical wave basis (SWB). The incident and scattered electric fields are written as
\[
\mathbf{E}_\mathrm{inc}(\mathbf{r},\omega)=\sum_{\nu}\sum_{\lambda=0,1} a_{\nu\lambda}\,\mathbf{F}^{(1)}_{\nu\lambda}(\mathbf{r},\omega),
\qquad
\mathbf{E}_\mathrm{sca}(\mathbf{r},\omega)=\sum_{\nu}\sum_{\lambda=0,1} p_{\nu\lambda}\,\mathbf{F}^{(3)}_{\nu\lambda}(\mathbf{r},\omega),
\]
where $\nu$ collects the modal indices and $\lambda=0,1$ labels TM and TE polarization, respectively. Regular basis functions carry the superscript $(1)$, while singular outgoing functions carry the superscript $(3)$ [2602.12743].

In the cylindrical basis, $\nu=(k_z,m)$, with longitudinal wave number $k_z$ and azimuthal index $m$. Regular cylindrical waves use Bessel functions $J_m$, and singular waves use Hankel functions $H_m^{(+)}$. In the spherical basis, $\nu=(\ell,m)$, regular waves use spherical Bessel functions $j_\ell(kr)$, and singular waves use spherical Hankel functions $h_\ell^{(+)}(kr)$. The implementation follows the conventions of the underlying `treams` package for normalization, basis ordering, and translation/addition theorems [2602.12743].

At the single-scatterer level, the central relation is
\[
\mathbf{p}=\mathbf{T}\,\mathbf{a},
\]
with $\mathbf{T}$ the T-matrix, $\mathbf{a}$ the incident multipole coefficients, and $\mathbf{p}$ the scattered coefficients. A critical structural property is that $\mathbf{T}$ depends only on geometry and material composition, not on the illumination. That separation is what permits reuse of the same object response across optical and electron-beam excitation scenarios [2602.12743].

For aggregates, `treams_ebeam` uses local expansions about each particle center. If particle $i$ has T-matrix $\mathbf{T}_i$ and local incident coefficients $\mathbf{a}_i$, then multiple scattering is expressed as
\[
\mathbf{p}_i=\mathbf{T}_i\Big[\mathbf{a}_i+\sum_{j\ne i} \mathbf{C}^{(3)}(\mathbf{r}_i-\mathbf{r}_j)\,\mathbf{p}_j\Big],
\]
with $\mathbf{C}^{(3)}$ the singular translation matrices. In stacked form, the local response operator is
\[
\mathbf{T}_\mathrm{local}=\big[I-\mathbf{T}_\mathrm{diag}\mathbf{C}^{(3)}\big]^{-1}\mathbf{T}_\mathrm{diag}.
\]
A global expansion can then be formed by translating local coefficients to a common origin through regular translation matrices $\mathbf{C}^{(1)}$ [2602.12743].

For periodic one-dimensional chains aligned with the electron trajectory, periodic coupling includes all lattice vectors and the phase factor $e^{ik_z\Lambda}$. The implementation evaluates the lattice sums with a fast-converging Ewald method. This periodic formulation is particularly relevant for Smith–Purcell-type radiation channels and for lattice resonances in extended arrays [2602.12743].

## 3. Electron-beam source and spectroscopic observables

The electron is modeled as moving in vacuum along a straight line at constant velocity $\mathbf{v}=v\,\hat{\mathbf{z}}$, with reduced velocity $\beta=v/c$ and Lorentz factor $\gamma=1/\sqrt{1-\beta^2}$. In the frequency domain, its electric field is
\[
\mathbf{E}(\mathbf{r},\omega)= -\frac{e}{2\pi\varepsilon_0}\,\frac{\omega}{v^2\gamma}\,e^{i\omega z/v}
\left[
K_1\!\left(\frac{\omega\rho}{v\gamma}\right)\hat{\boldsymbol{\rho}}
-\frac{i}{\gamma}K_0\!\left(\frac{\omega\rho}{v\gamma}\right)\hat{\mathbf{z}}
\right],
\]
with $K_m$ modified Bessel functions and $(\rho,\phi,z)$ cylindrical coordinates. Rewriting this field in cylindrical-wave form shows that the source is a singular TM cylindrical wave of fixed longitudinal wave number $k_z=\omega/v$, with evanescent radial behavior because $k_\rho=i\omega/(v\gamma)$ [2602.12743].

That representation is fundamental to the implementation. The electron source is naturally expressed in the cylindrical basis, then translated and, if necessary, converted into the spherical basis so that it matches the basis of the scatterer T-matrix. The code therefore relies on exact cylindrical-to-cylindrical and cylindrical-to-spherical addition theorems to couple the moving charge to local or global scatterer representations [2602.12743].

CL and EELS are then computed directly from the multipole coefficients. In the spherical basis, the CL probability obtained from the far-field Poynting flux is
\[
\Gamma_\mathrm{CL}^{\mathrm{S}}(\omega)=\frac{1}{\pi\hbar\omega\,Z}\,\frac{\mathbf{p}^\dagger\mathbf{p}}{k^2},
\]
where $Z=\sqrt{\mu_0/\varepsilon_0}$ is the vacuum impedance and $k=\omega/c$. In the cylindrical basis, integrating over a cylinder of length $L$ gives
\[
\Gamma_\mathrm{CL}^{\mathrm{C}}(\omega)=\frac{4L}{\pi\hbar\omega\,Z}\,\frac{\mathbf{p}^\dagger\mathbf{p}}{k}.
\]
For infinitely long structures, the cylindrical expression is quoted per unit length [2602.12743].

The EELS probability is defined from the work done by the scattered field on the electron trajectory. In spherical form,
\[
\Gamma_\mathrm{EEL}^{\mathrm{S}}(\omega)= -\frac{1}{\pi\hbar\omega\,Z}\,\frac{\mathrm{Re}\{\mathbf{a}^\dagger\mathbf{p}\}}{k_0^2},
\]
and in cylindrical form,
\[
\Gamma_\mathrm{EEL}^{\mathrm{C}}(\omega)= \frac{4L}{\pi\hbar\omega\,Z}\,\frac{\mathrm{Re}\{\mathbf{a}^T\mathbf{p}\}}{k_0},
\]
with $k_0=\omega/c$. These expressions make the division between radiative and nonradiative channels explicit: CL is constructed from far-field flux, whereas EELS contains both radiative and absorptive losses [2602.12743].

## 4. Software architecture and computational workflow

`treams_ebeam` is implemented as a Python extension of `treams` and uses the same basis objects and T-matrix data structures. The standard workflow begins by constructing or importing per-particle T-matrices. Built-in analytic constructors exist for spheres in the spherical basis and for infinite cylinders in the cylindrical basis. For arbitrary shapes, the module accepts numerically computed spherical T-matrices, including data imported from BEM, FEM, or DDA workflows [2602.12743].

Finite clusters are assembled through local per-particle bases and solved with the aggregate interaction operator. Infinite one-dimensional chains are assembled through lattice interactions with periodic Ewald summation. Electron excitation is then instantiated with the fast-electron source and expanded into the basis required by the target T-matrix. Once the incident coefficients are available, CL and EELS are evaluated through basis-aware post-processing routines [2602.12743].

Several implementation details determine numerical stability. For subwavelength spheres, typical truncations are $\ell_\mathrm{max}$ up to $6$–$10$, and the two-dimensional cluster example uses $\ell_\mathrm{max}=6$. For cylinders, the azimuthal cutoff `mmax` is chosen according to the needed azimuthal content and the convergence of Lorentzian spectral peaks. For periodic chains, the diffracted-order cutoff is set by $b_\mathrm{max}=2\pi n/\Lambda$, which selects the Smith–Purcell diffraction orders to retain. The recommended convergence procedure is to increase $\ell_\mathrm{max}$ or `mmax` until the spectra stabilize [2602.12743].

The implementation paper characterizes the approach as meshless and emphasizes the reuse of per-particle T-matrices, exact translation/addition operators, and block-structured multiple scattering. It further states that T-matrix simulations can be orders faster than spatially discretized Maxwell solvers such as BEM, FEM, FDTD, or DGTD in multiscale or periodic settings, while remaining especially convenient for infinite periodic systems and radiation-channel analysis [2602.12743].

## 5. Representative calculations and physical regimes

The paper demonstrates the method first on isolated scatterers. For a dielectric sphere of radius $R=50$ nm with nondispersive $\varepsilon=16+0.5i$, excited by an electron with $\beta=0.7$ at an aloof distance $R-b=10$ nm, the calculated EEL and CL spectra show magnetic dipole, electric dipole, and magnetic quadrupole resonances in increasing energy order. In this case EEL exceeds CL because of absorption associated with the complex permittivity [2602.12743].

For an infinite metallic nanowire of radius $R=50$ nm with Drude permittivity
\[
\varepsilon(\omega)=\varepsilon_\infty-\frac{\omega_p^2}{\omega^2+i\gamma_p\omega},
\]
using $\varepsilon_\infty=3.3$, $\hbar\omega_p=9$ eV, and $\hbar\gamma_p=22$ meV, an electron with $\beta=0.7$ launches TM surface plasmon polaritons along the wire axis. The resulting spectra exhibit Lorentzian peaks associated with azimuthal orders $m=0,1,\dots$ [2602.12743].

A third single-particle example uses an amorphous silicon elliptical nanodisk of height $h=90$ nm and axes $r_\mathrm{l}=286$ nm and $r_\mathrm{s}=96$ nm. Its EEL and CL spectra show broader features with mixed multipolar character. This case illustrates the use of imported spherical T-matrices for shapes beyond analytic Mie-type geometries [2602.12743].

The periodic-chain example is more distinctive. Using the same elliptical nanodisk, with pitch $\Lambda=294$ nm along the electron trajectory, an electron with $\beta=0.7$ and impact parameter satisfying $b-R=7$ nm excites finite chains with $N=1,3,5,9,15$ and the infinite-chain limit. The spectra reveal a lattice resonance near $1.7$ eV that sharpens with increasing $N$. In the infinite chain, CL is suppressed at this resonance, described in the paper as radiation quenching, whereas away from resonance the CL follows Smith–Purcell radiation. The emission angle of diffraction order $n$ is
\[
\theta_n=\cos^{-1}\!\left(\frac{1}{\beta}-\frac{b_\mathrm{max}(n)}{k}\right),
\qquad
b_\mathrm{max}(n)=\frac{2\pi n}{\Lambda}.
\]
The angular CL develops the characteristic lobes, with node count tied to the number of unit cells [2602.12743].

The finite two-dimensional array example uses aluminum nanospheres arranged on a square lattice of pitch $\Lambda=120$ nm, each sphere having radius $R=50$ nm and Drude parameters $\varepsilon_\infty=1$, $\hbar\omega_p=15$ eV, and $\hbar\gamma_p=1.06$ eV. An electron with $\beta=0.7$ passes transversely through the center, and arrays with $N=2,4,6,8$ particles per side are considered. The single-sphere EEL spectrum contains $\ell=1,2,3$ peaks and a higher-order cluster spanning $\ell=4$–$6$. In the arrays, these features split through hybridization into bonding and antibonding modes. For $N=2$ per side, the electric-dipole splitting is not resolved and instead appears as a broad feature near $2.8$ eV, while a high-intensity feature near $9.1$ eV emerges from coupled higher-order modes. CL lacks the tightly confined higher-order features because they are nonradiative [2602.12743].

## 6. Assumptions, validity limits, and broader context

The implementation is explicitly restricted to classical electrodynamics in homogeneous vacuum or air, with $\varepsilon_r=\mu_r=1$ for the background. No substrate or host medium is included in the presented formalism. Material response is local and encoded through frequency-dependent permittivity models such as Drude forms, while nonlocal and quantum corrections are neglected. The electron follows a straight trajectory at constant velocity, and the excitation is introduced through its frequency-domain field rather than through an explicitly discretized current density [2602.12743].

Basis validity imposes additional geometric constraints. A global spherical-wave expansion is valid only outside the circumscribing sphere of the full scatterer or aggregate, so aloof trajectories must stay outside that region when a global SWB is used. Local spherical expansions relax this requirement and allow smaller impact parameters, but they in turn require non-overlapping circumscribing spheres for the individual particles. For periodic systems, overlapping unit-cell circumscribing spheres invalidate a global SWB and force the calculation to remain in a local periodic representation. Very small beam–structure separations can stress multipole truncation and translation accuracy, so the recommended remedy is to increase $\ell_\mathrm{max}$ and remain in local bases [2602.12743].

Within electron microscopy and spectroscopy more broadly, `treams_ebeam` belongs to the class of methods that treat the electron not merely as a point probe but as a structured excitation channel for specific electromagnetic or inelastic processes. Related work on phase-engineered probes in TEM and STEM has emphasized that electron-beam design can be matched to targeted interactions, including OAM-sensitive EELS and EMCD-style measurements, with representative vortex states written as $\psi(r,\phi,z)\propto f(r,z)e^{i\ell\phi}$ [1403.5457]. A plausible implication is that the algebraic source-handling strategy used in `treams_ebeam` could be a useful starting point for future extensions beyond the straight-line TM cylindrical-wave source treated in the present implementation.

In its present form, however, `treams_ebeam` is defined by a narrower and technically precise achievement: it embeds straight-line fast-electron CL and EELS into a reusable T-matrix scattering formalism, thereby enabling efficient spectroscopy calculations for isolated nanostructures, finite aggregates, and periodic chains with explicit control over basis choice, multiple scattering, and radiative versus nonradiative channels [2602.12743].

Source: https://www.emergentmind.com/topics/treams_ebeam