1 Introduction

Electromagnetic multipoles play an indispensable role across different sub-branches of optics and photonics [1]. In classical electrodynamics, the field excited by localized spatial charge and current distribution can be decomposed into electric and magnetic multipole fields of all orders [2]. A visualization of field decomposition is presented in Fig. 1. The total scattered field can be decomposed into a series of multipole modes of all orders, including dipole, quadrupole, octupole, and high-order multipoles. In optics, the multipole decomposition method has been widely used in many nanophotonics scenarios for the analysis of light scattering of both a single scatterer and of periodic arrays of nanostructures [3,4,5,6,7,8,9,10]. The electric and magnetic multipoles excited in the scatterer contain valuable information about its optical response, including resonance, far-field patterns, and scattering cross-section [11,12,13,14,15]. Moreover, high-order multipoles such as electric and magnetic octupoles can be structurally engineered to tune optical resonances, absorption and scattering [16,17,18].

Fig. 1
figure 1

Schematic of multipole decomposition. The leftmost field pattern represents the total scattered field, which can be irregular and complex. The field patterns on the right show the multipole modes of order \(\mathrm{1,2},3\) and \(4\)

Apart from symmetric scatterers such as spheres or cylinders, normally there are no analytical solutions to the electromagnetic multipoles of irregular scatterers. Hence, numerical projection of electromagnetic multipoles is desirable for two purposes: (1) for understanding the underlying principles of many exotic phenomena such as ultra-directional scattering, perfect reflection and transmission, anapole effects [19,20,21,22,23,24]; (2) for designing photonic devices such as metasurfaces and plasmonic arrays [25,26,27,28,29,30,31]. Several routes are feasible for realizing numerical projection of electromagnetic multipoles, as is well documented in recent works [32,33,34]. For instance, Alaee et al. proposed a multipole expansion method based on exact multipole moments beyond long-wavelength approximation [32]. Evlyukhin et al. studied discrete dipole approximation to calculate the multipole components of non-spherical scatterers [33]. Evlyukhin et al. also combined analytical and numerical methods to calculate the multipoles of scatterers with anisotropic optical properties [34]. The approach for multipole decomposition considered in this paper is based on multipole modes in spherical coordinates, rather than multipole moments in Cartesian coordinates [16, 17, 23, 24, 35]. Evidently, numerical integration is one of the key ingredients to perform multipole decomposition, and can be carried out using surface or volume integral techniques, provided that the scattered field is known from full-wave simulation. Despite the relevance of numerical integration in multipole decomposition, previous studies provide no systematic treatment of how the numerical integration is carried out, including the selection of sampling points, numerical accuracy and efficiency.

In this paper, we propose an efficient and accurate numerical projection procedure for multipole decomposition, which is complementary to the existing works in multipole projection. To the best of our knowledge, the Lebedev and Gaussian quadrature methods are introduced for the first time to process the numerical projection of multipoles, wherein the integration sampling points can be selected efficiently and accurately based on the solid framework given by the quadrature rule, i.e., in accordance with the interpolation functions used in full-wave simulations such as finite element method. Moreover, high-order electric and magnetic multipoles up to the 8th order are accurately coded in our program. The codes for MATLAB implementation of our new numerical projection procedure are open-source and available on GitHub [36].

The paper is organized as follows. In Sect. 2, we review the general approach to multipole decomposition for scattering problems. Then the Lebedev and Gaussian quadrature methods for surface and volume integration are introduced and tested in detail. In Sect. 3, we validate the numerical projection procedure using benchmarks of an isotropic dielectric nanosphere, a symmetric scatterer, and an anisotropic nanosphere. Finally, Sect. 4 summarizes the paper.

2 Theory

In this section, we briefly review the principles of the multipole decomposition method. Two types of numerical projection methods are highlighted, including surface integration based on the scattered field and volume integration based on the induced current density. To perform surface and volume integration in the numerical projection procedure, the Lebedev and Gaussian quadrature methods are adopted and discussed in detail.

The general working flow of the algorithm, following the common procedure of multipole decomposition based on numerical projection, is depicted in Fig. 2. Firstly, for a given structure, the scattered and total field in the whole space is computed using full-wave simulation such as finite element method (FEM) or finite-difference time-domain (FDTD) method. Based on the field data, the multipole coefficients of the scattered field are obtained by numerical projection. There are two approaches for numerical projection, each suitable for different situations. The first approach is surface integration based on the scattered field outside the scatterer, which is mainly used for the multipole analysis of a single structure. The second approach is volume integration based on the induced current density inside the scatterer, which is applicable to the building blocks in periodic structures such as metasurfaces and photonic crystals. Examples show that the surface integration method has faster convergence than the volume integration method with less computational resources in practice.

Fig. 2
figure 2

Working flow of the algorithm for multipole decomposition

2.1 Surface integration based on the scattered field

The first approach to numerical projection of multipoles is based on the scattered field outside the scatterer. Consider a monochromatic incident plane wave \({{\varvec{E}}}_{i}={{\varvec{E}}}_{0}{\text{e}}^{\text{i}\left({\varvec{k}}\cdot {\varvec{x}}-\omega t\right)}\), where \(\omega\) is the angular frequency, \({{\varvec{E}}}_{0}\) is the complex amplitude of electric field, and \({\varvec{k}}\) is the wave vector in the background material. The total electric/magnetic field is denoted by \({\varvec{E}}\)/\({\varvec{H}}\), which is the sum of the incident field \({{\varvec{E}}}_{i}\)/\({{\varvec{H}}}_{i}\) and scattered field \({{\varvec{E}}}_{s}\)/\({{\varvec{H}}}_{s}\), i.e., \({\varvec{E}}={{\varvec{E}}}_{i}+{{\varvec{E}}}_{s}\) and \({\varvec{H}}={{\varvec{H}}}_{i}+{{\varvec{H}}}_{s}\). In the source-free region, the wave equations for total electric and magnetic field are written as follows:

$$\begin{array}{c}\begin{array}{cc}{\nabla }^{2}{\varvec{E}}+{k}^{2}{\varvec{E}}=0,& \\ {\nabla }^{2}{\varvec{H}}+{k}^{2}{\varvec{H}}=0.& \end{array}\end{array}$$
(1)

The wave vector \(k=\sqrt{{\varvec{k}}\cdot {\varvec{k}}}=\omega \sqrt{\varepsilon \mu }\), where \(\varepsilon\) and \(\mu\) are the permittivity and permeability of isotropic background. Adapting the spherical coordinate system, the eigen solutions of wave equations Eq. (1) are vector spherical harmonics. The concrete forms of vector spherical harmonics \({\varvec{M}}\) and \({\varvec{N}}\) of order \(\left(l,m\right)\) are expressed as follows [37]:

$$\begin{array}{c}\begin{array}{cc}{{\varvec{M}}}_{lm}& =\left[\mathrm{i}{\uppi }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\theta }-{\tau }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\phi }\right]{z}_{l}\left(kr\right){\mathrm{e}}^{\mathrm{i}m\phi },\\ {{\varvec{N}}}_{lm}& =l\left(l+1\right){P}_{l}^{m}\left(\mathrm{cos}\theta \right)\frac{{z}_{l}\left(kr\right)}{kr}{\mathrm{e}}^{\mathrm{i}m\phi }{\widehat{{\varvec{e}}}}_{r}+\left[{\tau }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\theta }+\mathrm{i}{\uppi }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\phi }\right]\frac{{\left[kr{z}_{l}\left(kr\right)\right]}^{\prime}}{kr}{\mathrm{e}}^{\mathrm{i}m\phi },\end{array}\end{array}$$
(2)

where \({P}_{l}^{m}\left(\mathrm{cos}\theta \right)\) is the associated Legendre polynomial, \({z}_{l}\left(kr\right)\) is the spherical Bessel function, and \({\left[kr{z}_{l}\left(kr\right)\right]}^{\prime}\) denotes the differentiation with respect to the argument \(kr\). The auxiliary functions \({\tau }_{lm}\left(\theta \right)\) and \({\uppi }_{lm}\left(\theta \right)\) are defined as:

$$\begin{array}{c}\begin{array}{cc}& {\tau }_{lm}\left(\theta \right)=\frac{\mathrm{d}}{\mathrm{d}\theta }{P}_{l}^{m}\left(\mathrm{cos}\theta \right),\\ & {\uppi }_{lm}\left(\theta \right)=\frac{m}{\mathrm{sin}\theta }{P}_{l}^{m}\left(\mathrm{cos}\theta \right).\end{array}\end{array}$$
(3)

In physics, \({{\varvec{N}}}_{lm}\) and \({{\varvec{M}}}_{lm}\) represent the field excited by electric and magnetic multipoles, respectively, located at the origin in the spherical coordinate system. Because of the completeness of vector spherical harmonics, the scattered field \({{\varvec{E}}}_{s}\) can be expanded in terms of the electric and magnetic multipole modes,

$$\begin{array}{c}{{\varvec{E}}}_{s}=\sum_{l=1}^{\infty }\sum_{m=-l}^{l}{E}_{lm}\left({a}_{lm}{{\varvec{N}}}_{lm}+{b}_{lm}{{\varvec{M}}}_{lm}\right),\end{array}$$
(4)

where \({a}_{lm}\) and \({b}_{lm}\) are electric/magnetic multipole coefficients, which represent the contributions of electric/magnetic multipoles to the scattered field. The constant coefficient \({E}_{lm}\) is given by: \({E}_{lm}=\frac{{i}^{l+1}\left(2l+1\right)}{2}\sqrt{\frac{\left(l-m\right)!}{l\left(l+1\right)\left(l+m\right)!}}\). Considering the orthogonality of vector spherical harmonics, the multipole coefficients \({a}_{lm}\) and \({b}_{lm}\) are computed as follows [37]:

$$\begin{array}{c}\begin{array}{cc}{a}_{lm}=\frac{\iint {{\varvec{N}}}_{lm}^{*}\cdot {{\varvec{E}}}_{s}\mathrm{d}s}{{E}_{lm}\iint {{\varvec{N}}}_{lm}^{*}\cdot {{\varvec{N}}}_{lm}\mathrm{d}s},& \\ {b}_{lm}=\frac{\iint {{\varvec{M}}}_{lm}^{*}\cdot {{\varvec{E}}}_{s}\mathrm{d}s}{{E}_{lm}\iint {{\varvec{M}}}_{lm}^{*}\cdot {{\varvec{M}}}_{lm}\mathrm{d}s},& \end{array}\end{array}$$
(5)

where the asterisk \(*\) denotes complex conjugation. The surface integration in Eq. (5) is taken over a spherical surface which encloses the scattering object. In practice, the scattered field \({{\varvec{E}}}_{s}\) is computed by full-wave simulation, and the integration surface should not go beyond the simulation region.

2.2 Volume integration based on the induced current density

The second approach to numerical projection of multipoles is based on the induced current density inside the scatterer, which is defined as follows:

$$\begin{array}{c}{{\varvec{J}}}_{s}\left({\varvec{r}}\right)=-\text{i}\omega {\varepsilon }_{0}\left({\varepsilon }_{r}-{\varepsilon }_{b}\right)\varvec{E}\left({\varvec{r}}\right),\end{array}$$
(6)

where \({\varepsilon }_{r}\) is the permittivity distribution in the whole space with presence of the scatterer, \({\varepsilon }_{b}\) is the permittivity of background material, and \({\varvec{E}}\left({\varvec{r}}\right)\) is the total electric field. Based on Maxwell equations, the relations between the scattered field \({{\varvec{E}}}_{s}\)/\({{\varvec{H}}}_{s}\) and the induced current density \({{\varvec{J}}}_{s}\) are expressed as follows:

$$\begin{array}{c}\begin{aligned}& \nabla \cdot {{\varvec{E}}}_{s}=-\frac{\mathrm{i}\eta }{k}\nabla \cdot {{\varvec{J}}}_{s},\\ & \nabla \cdot {{\varvec{H}}}_{s}=0,\\ & \nabla \times {{\varvec{E}}}_{s}=\mathrm{i}k\eta {{\varvec{H}}}_{s},\\ & \nabla \times {{\varvec{H}}}_{s}=-\frac{\mathrm{i}k}{\eta }{{\varvec{E}}}_{s}+{{\varvec{J}}}_{s}.\end{aligned}\end{array}$$
(7)

The wave equations for the scattered field \({{\varvec{E}}}_{s}\) can be derived based on Eq. (7). Then one can further determine the exact forms of the induced current density of electric and magnetic multipoles of order \(\left(l,m\right)\) [38],

$$\begin{array}{c}\begin{array}{cc}{{\varvec{S}}}_{lm}& =\left[{\Pi }_{l}\left(kr\right)+{\Pi }_{l}^{^{\prime\prime} }\left(kr\right)\right]{P}_{l}^{m}\left(\mathrm{cos}\theta \right){\mathrm{e}}^{-\mathrm{i}m\phi }{\widehat{{\varvec{e}}}}_{r}+\left[{\tau }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\theta }-\mathrm{i}{\uppi }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\phi }\right]\frac{{\Pi }_{l}^{\prime}\left(kr\right)}{kr}{\mathrm{e}}^{-\mathrm{i}m\phi },\\ {{\varvec{T}}}_{lm}& =\left[\mathrm{i}{\uppi }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\theta }+{\tau }_{lm}\left(\theta \right){\widehat{{\varvec{e}}}}_{\phi }\right]{\mathrm{e}}^{-\mathrm{i}m\phi }{J}_{l}\left(kr\right),\end{array}\end{array}$$
(8)

where \({\Pi }_{l}\left(kr\right)=kr{J}_{l}\left(kr\right)\) is the Riccati-Bessel function. As in the case of the multipole decomposition based on the scattered field, one can also calculate the multipole coefficients based on the induced current density in the following form,

$$\begin{array}{c}\begin{array}{c}{a}_{lm}=\frac{{\left(-\mathrm{i}\right)}^{l-1}{k}^{2}\eta {Q}_{lm}}{\sqrt{\uppi \left(2l+1\right)}}{\iiint }_{V}{{\varvec{J}}}_{s}\left({\varvec{r}}\right)\cdot {{\varvec{S}}}_{lm}\mathrm{d\Omega },\\ {b}_{lm}=\frac{{\left(-\mathrm{i}\right)}^{l+1}{k}^{2}\eta {Q}_{lm}}{\sqrt{\uppi \left(2l+1\right)}}{\iiint }_{V}{{\varvec{J}}}_{s}\left({\varvec{r}}\right)\cdot {{\varvec{T}}}_{lm}\mathrm{d\Omega },\end{array}\end{array}$$
(9)

where \({Q}_{lm}=\frac{1}{\sqrt{l\left(l+1\right)}}\sqrt{\frac{2l+1}{4\uppi }\frac{\left(l-m\right)!}{\left(l+m\right)!}}\) is a constant coefficient and \(\eta =\sqrt{\frac{{\mu }_{0}}{{\varepsilon }_{0}}}\) is the vacuum impedance. The two integrals in Eq. (9) are evaluated over the volume \(V\) of the scattering object. The volume integration method applies to either a single scatterer or the building blocks in a periodic array. Since the unit building block expands in the entire full-wave simulation region in the direction with periodic boundary conditions, only the volume integration method, which extracts the induced current density inside the unit building block, can be used to calculate the multipole components.

It is worth mentioning that the multipole coefficients obtained using either the scattered field-based or induced current density-based numerical projections should be identical for a given scatterer. The expressions for the two methods can be transformed into each other using the relationship between the source current and far-field [38].

As a side remark, if the center of mass of the scatterer is not the same as the coordinate origin, then the multipole decomposition is complicated. Notably, the numerical projection procedures, i.e., surface or volume integration-based numerical projection as used in this paper, still apply and the resulting multipole components are not the same. However, the observable physical quantity obtained by the combination of different kinds of multipoles should be the same. If multipole decomposition is performed with respect to the symmetric center of the scatterer, there are fewer multipole components. For example, for a spherical scatterer, if the sphere center and the coordinate origin are identical, the projected multipole components have the fewest terms. In contrast, if the sphere center has an off-set from the coordinate origin, one can still do multipole decomposition. In such a case, there are more multipole components than is the case in the overlapped scenario, but the observable physical quantities are the same. For calculation of multipoles of asymmetrical or compound scatterers, it is beneficial to choose the center of mass as the reference point to get minimum number of multipole components.

2.3 Numerical implementations of integration

To compute the multipole coefficients accurately, certain numerical quadrature rules are needed to implement the surface or volume integration described in the above sections. In order to achieve higher computational accuracy with fewer function evaluations, we first adopt the Gaussian and Lebedev quadrature methods to compute the volume and surface integration in the numerical projection, respectively.

The Gaussian quadrature method is widely used in the numerical integration in the practical implementation of electromagnetic finite element computation. As such, the integration sampling points as well as the interpolation functions used in finite element full-wave simulation are also carefully selected according to the quadrature rule and can be directly used in our proposed method for multipole projection, wherein the integration sampling points can be cut down to the minimum, as constrained by finite element full-wave simulation.

2.3.1 Gaussian quadrature method for volume integration

Since the boundary of the integration region can be irregular, finite elements are often used to mesh the integration region. The most commonly used shape for meshing is the tetrahedron in three-dimensional space and the triangle for two-dimensional surfaces. To compute the integral over a tetrahedron, the Gaussian quadrature method is adopted due to its high accuracy. For a single tetrahedron \(V\) with a unit volume, the numerical quadrature of a function \(f\) over the tetrahedron \(V\) is in the following form [39],

$$\begin{array}{c}{\iiint }_{V}f\left({\alpha }_{1},{\alpha }_{2},{\alpha }_{3},{\alpha }_{4}\right)\text{d}\Omega \approx \sum_{i}{\omega }_{i}f\left({\alpha }_{1}^{i},{\alpha }_{2}^{i},{\alpha }_{3}^{i},{\alpha }_{4}^{i}\right),\end{array}$$
(10)

where \({\alpha }_{j}^{i}\left(j=\mathrm{1,2},\mathrm{3,4}\right)\) are the natural coordinates of the \(i\) th quadrature point in the tetrahedron, and \({\omega }_{i}\) is the corresponding weight of the \(i\)th quadrature point. According to the definition of natural coordinates [40], the constraint for the quadruplet \(\left({\alpha }_{1}^{i},{\alpha }_{2}^{i},{\alpha }_{3}^{i},{\alpha }_{4}^{i}\right)\) is \(\sum_{j=1}^{4}{\alpha }_{j}^{i}=1\). Because of the symmetry of tetrahedron, all possible permutations of the quadruplet \(\left({\alpha }_{1}^{i},{\alpha }_{2}^{i},{\alpha }_{3}^{i},{\alpha }_{4}^{i}\right)\) are equivalent quadrature points sharing the same weight. The coordinates of the quadrature points and weights for the quadrature expression Eq. (10) are determined by integrating polynomials of particular forms exactly, leading to a set of nonlinear equations which are relatively difficult to solve [39]. The choice of polynomial order and form for exact integration depends on the desired degree \(N\) of the quadrature method. For the integration over a tetrahedron, Gaussian quadrature formulas of degree \(N=4\) to \(8\) are given in Ref. [41].

To illustrate the Gaussian quadrature intuitively, we present an example of computing the integration of the function \(f={x}^{2}+{y}^{2}+{z}^{2}\) over a regular tetrahedron with a unit volume with only 11 sampling points. The geometry of the tetrahedron and selected quadrature points are shown in Fig. 3. The exact coordinates of these quadrature points and the corresponding weights are listed in Table 1. We utilize the Gaussian quadrature method with degree \(N=4\) for the computation, resulting in an integral value of \(0.485352892045444\) up to 16 digits of accuracy, which precisely matches the analytical solution of \(\frac{7}{10\times \sqrt[3]{3}}=0.485352892045444\).

Fig. 3
figure 3

Geometry of the integration region and selected Gaussian quadrature points

Table 1 The natural/Cartesian coordinates and weights of Gaussian quadrature points of degree \(N=4\) for the computation of integrals over a regular tetrahedron

2.3.2 Lebedev quadrature method for surface integration

As mentioned above, Gaussian quadrature is compatible with finite elements such as tetrahedrons or triangles. It is straightforward to adapt Gaussian quadrature to compute the surface integration over a sphere, as long as the quadrature points and weights are computed based on the symmetry of triangles. However, note that a sphere has a higher degree of symmetry than a triangle, resulting in more quadrature points that are equivalent to each other. For instance, quadrature points which are equivalent under the octahedron rotation and inversion on the sphere share the same weight [42]. Therefore, a smaller number of independent quadrature points can achieve the same accuracy as Gaussian quadrature. This efficient quadrature method for a sphere is called Lebedev quadrature, which is adopted in this paper.

Given a unit sphere \({S}^{2}\) which is described by \({x}^{2}+{y}^{2}+{z}^{2}=1\), the integration of a function \(f\) on \({S}^{2}\) is approximated using Lebedev quadrature in the following form [43],

$$\begin{array}{c}\begin{array}{cc}I={\iint }_{{S}^{2}}f\left({\varvec{r}}\right)\mathrm{d}\sigma & \approx {A}_{1}\sum_{i=1}^{6}f\left({a}_{i}^{1}\right)+{A}_{2}\sum_{i=1}^{12}f\left({a}_{i}^{2}\right)+{A}_{3}\sum_{i=1}^{8}f\left({a}_{i}^{3}\right)\\ & +\sum_{k=1}^{{N}_{1}}{B}_{k}\sum_{i=1}^{24}f\left({b}_{i}^{k}\right)+\sum_{k=1}^{{N}_{2}}{C}_{k}\sum_{i=1}^{24}f\left({c}_{i}^{k}\right)+\sum_{k=1}^{{N}_{3}}{D}_{k}\sum_{i=1}^{48}f\left({d}_{i}^{k}\right),\end{array}\end{array}$$
(11)

where the quadrature points \({a}_{i}^{k}\), \({b}_{i}^{k}\), \({c}_{i}^{k}\) and \({d}_{i}^{k}\) are determined according to the octahedronal symmetry, and \({A}_{k}\), \({B}_{k}\), \({C}_{k}\) and \({D}_{k}\) are the corresponding weights. To be more specific, for each group of quadrature points with the same \(k\), they are invariant under the octahedral rotation group with inversion \({G}_{8}^{*}\) and share the same weight [43]. To determine the corresponding weights of quadrature points in Lebedev quadrature of order \(n\), the quadrature method must exactly integrate over all spherical harmonics \({Y}_{lm}\) of order \(l\le n\). In addition, it is sufficient to determine the quadrature weights by requiring the exact integration of the polynomials that are invariant under the octahedral rotation with inversion. As in the case of the determination of Gaussian quadrature, the exact integration of polynomials or spherical harmonics also leads to a set of nonlinear equations to be solved. The computed value of weights \({A}_{k}\),…,\({D}_{k}\) and quadrature points for order \(9\le n\le 17\) can be found in Ref. [42].

Without loss of generality, we demonstrate an example of accurate integration for a function \(f={x}^{2}+{y}^{3}-{z}^{4}\), which is randomly chosen here, over a unit sphere using the Lebedev quadrature method with only 26 sampling points. The sampling points are shown in Fig. 4, and the coordinates and the corresponding weights are also listed in Table 2. Remarkably, the computed integral yields a value of \(1.675516081914556\), which shows agreement with the analytical solution of \(\frac{8\uppi }{15}=1.675516081914556\), up to 16 digits of accuracy.

Fig. 4
figure 4

Geometry of the integration region and selected Lebedev quadrature points

Table 2 The Cartesian coordinates and weights of Lebedev quadrature points of order \(n=7\) on a unit sphere

3 Results and discussion

In this section, we study three scattering objects, including an isotropic dielectric nanosphere, a symmetric scatterer with \({D}_{3h}\) symmetry, and an anisotropic nanosphere, to validate our numerical projection procedure for multipole decomposition. The scattered field and induced current density are computed by full-wave simulation using COMSOL Multiphysics [44].

3.1 Scattering by an isotropic dielectric nanosphere

We compute the multipole scattering cross-section of an isotropic dielectric nanosphere as discussed in Ref. [45]. The nanosphere and the incident condition are illustrated in Fig. 5a. The center of the nanosphere is located at the origin of the coordinate system. The nanosphere has a refraction index of \(n=3.5\) and a radius of \(a=210\) nm. The incident light is a plane wave propagating along the \(z\) axis with linear polarization along the \(x\) axis. The wavelength of incident light ranges from \(800\) to \(1900\) nm. For an isotropic spherical scatterer, Mie theory provides analytical expressions for the calculation of multipole coefficients [1]. Furthermore, we utilize both the surface and volume integration methods of numerical projection to compute the multipole coefficients. Based on the multipole coefficients \({a}_{lm}\) and \({b}_{lm}\), the total scattering cross-section \({\sigma }_{\mathrm{sca}}\) is determined by the following expression,

$$\begin{array}{c}{\sigma }_{\mathrm{sca}}=\frac{2}{{k}^{2}{a}^{2}}\sum_{l=1}^{\infty }\sum_{m=-l}^{l}\left(2l+1\right)\left({\left|{a}_{lm}\right|}^{2}+{\left|{b}_{lm}\right|}^{2}\right),\end{array}$$
(12)

where \({\sigma }_{\mathrm{sca}}\) is normalized based on the cross-sectional area \(\uppi {a}^{2}\) of the sphere. As shown in Fig. 5a, it is evident that the numerical results from the surface and volume integration methods of our numerical projection procedure both have excellent agreement with the analytical results from Mie theory. The two resonance peaks are characterized accurately in the wavelength range from \(900\) to \(1900\) nm. Furthermore, it can be found that within this wavelength range, only the electric/magnetic dipole and quadrupole make significant contributions to the total scattering cross-section. In contrast, as shown in Fig. 5b, the magnetic octupole has a notable impact in the wavelength range from \(800\) to \(900\) nm. In particular, the resonance peak at \(818\) nm is exclusively due to the magnetic octupole.

Fig. 5
figure 5

The multipole scattering cross-section of the dielectric nanosphere as a function of the incident wavelength. The analytical curves are derived from Mie theory, while the discrete symbols represent the numerical results from our procedure. Both surface and volume integration methods are utilized in subplot a, while subplot b only employs surface integration

The convergence analysis of the numerical projection procedure based on both surface and volume integration is shown in Fig. 6. The convergence of magnetic octupole (MO) scattering cross-section at incident wavelength of 818 nm is calculated using surface integration, and the convergence of magnetic quadrupole (MQ) scattering cross-section at 1000 nm is calculated using volume integration. The green region in Fig. 6 shows the convergence range for each case. The convergence thresholds are set to 1% and 0.2% for subplots (a) and (b), respectively. Evidently, Lebedev quadrature has a faster convergence than the trapezoidal rule of surface integration when the number of quadrature points is higher. Similarly, Gaussian quadrature also shows a faster and more stable convergence, while the trapezoidal rule of volume integration shows oscillation near the analytical value from Mie theory. It is also evident that the surface integration method requires fewer quadrature points than are required by the volume integration method. This is because meshing the volume of scatterer needs more finite elements than meshing the scatterer’s surface.

Fig. 6
figure 6

Convergence versus the number of quadrature points. Subplot a shows the convergence of magnetic octupole at 818 nm using surface integration. Subplot b shows the convergence of magnetic quadrupole at 1000 nm using volume integration. Black dashed line shows the analytical value from Mie theory

As a side remark, the distribution of Lebedev quadrature points in this demonstration is the same as in the benchmark case (a unit sphere) in Sec. 2.3.2, up to a scaling factor. This is because Lebedev quadrature points are only determined by the Lebedev quadrature rule, regardless of the geometrical shape of the scatterer inside the integration sphere. However, to calculate volume integrals, the 3D scatterer needs to be meshed using tetrahedrons, so that the quadrature points are chosen at each tetrahedron. The Gaussian quadrature rule provides the quadrature points of different order in a reference tetrahedron. To apply Gaussian quadrature to real physical tetrahedron meshes, whose geometrical shape is generally irregular, there exists a mapping from the reference tetrahedron to physical tetrahedron. Therefore, the distribution of Gaussian quadrature points in each tetrahedron mesh for scattering particle cases can be different from the benchmark case (a regular tetrahedron) in Sec. 2.3.1, and the quadrature points can be transformed to each other by a mapping.

3.2 Scattering by a symmetric scatterer with \({{\varvec{D}}}_{3{\varvec{h}}}\) symmetry

The second benchmark evaluates the multipole coefficients of eigenmodes of a symmetric scatterer with \({D}_{3h}\) symmetry. In optics, symmetry can be used to classify eigenmodes in structures such as waveguides or photonic crystals [46]. Furthermore, optical symmetries can introduce certain constraints on the optical properties of the structure. For symmetric scatterers, a group theory approach can be applied to analyze the constraints of multipole coefficients imposed by the symmetry of the scatterer [47, 48]. There are six irreducible representations of \({D}_{3h}\) group, and each eigenmode belongs to one of these representations. Specifically, we focus on two eigenmodes belonging to different representations \({A}_{1}^{^{\prime\prime} }\) and \({A}_{2}^{^{\prime\prime} }\). It is demonstrated that there are exact relationships between multipole coefficients of the eigenmodes. The constraints on the multipole coefficients can vary for eigenmodes belonging to different representations of the symmetry group. The character tables for the \({A}_{1}^{^{\prime\prime} }\) and \({A}_{2}^{^{\prime\prime} }\) repersentations, along with the corresponding constraints on the multipole coefficients of each representation are listed in Table 3. A detailed explanation of the symmetry operations in the \({D}_{3h}\) group can be found in Ref. [47].

Table 3 The character table of \({D}_{3h}\) group representation \({A}_{1}^{^{\prime\prime} }\) and \({A}_{2}^{^{\prime\prime} }\), and constraints on multipoles coefficients of the eigenmodes of two representations. \(N\) is an integer

The multipole coefficients for the two eigenmodes in Fig. 7a and c are computed using the surface integration method of our numerical projection procedure. The results are shown in Fig. 7b and d, respectively. The scatterer, represented by the solid black lines in Fig. 7a and c, has a refractive index of \(n=8\) and is a three-dimensional structure, and only the \(xy\) plane is depicted. It can be checked that both eigenmodes are invariant under the operation \(E\) and \(2{C}_{3}\), and are reversed under the operation \({\sigma }_{h}\) and \(2{s}_{3}\). For the eigenmode shown in Fig. 7a, the mode profile is reversed under the operation \(3{\sigma }_{v}\), which represents reflection in the \(xy\) plane. Therefore, this eigenmode satisfies the character of the \({A}_{1}^{^{\prime\prime} }\) representation. The constraints listed in Table 3 for the \({A}_{1}^{^{\prime\prime} }\) representation require the multipole coefficients to satisfy \({b}_{\mathrm{3,3}}=-{b}_{3,-3}\) and \({a}_{\mathrm{4,3}}={a}_{4,-3}\), which perfectly match the computed multipole coefficients shown in Fig. 7b. Similarly, for the eigenmode in Fig. 7c, the mode profile is unchanged under the operation \(3{\sigma }_{v}\), indicating that this eigenmode satisfies the requirement of the \({A}_{2}^{^{\prime\prime} }\) representation. The corresponding constraints for the \({A}_{2}^{^{\prime\prime} }\) representation require \({b}_{\mathrm{3,3}}={b}_{3,-3}\) and \({a}_{\mathrm{4,3}}=-{a}_{4,-3}\), which also agree with our numerical results as shown in Fig. 7d.

Fig. 7
figure 7

Two eigenmodes of the \({D}_{3h}\) scatterer and the normalized (with respect to itself) multipole coefficients of each eigenmode. The eigenmode shown in subplot a/c belongs to \({A}_{1}^{^{\prime\prime} }/{A}_{2}^{^{\prime\prime} }\) representation, whose multipole coefficients are presented in subplot b/d

As shown in Fig. 8, we evaluate the expression \(\frac{{b}_{3,-3}+{b}_{\mathrm{3,3}}}{{b}_{3,-3}}\) of the \({A}_{1}^{^{\prime\prime} }\) eigenmode to analyze the convergence of surface integration-based numerical projection based on this benchmark. According to the symmetry constraints for \({A}_{1}^{^{\prime\prime} }\) eigenmodes, the expression \(\frac{{b}_{3,-3}+{b}_{\mathrm{3,3}}}{{b}_{3,-3}}\) should be exactly zero. Evidently, Lebedev quadrature also has a faster convergence than the trapezoidal rule of surface integration in this benchmark.

Fig. 8
figure 8

Convergence of \(\frac{{b}_{3,-3}+{b}_{\mathrm{3,3}}}{{b}_{3,-3}}\) of the \({A}_{1}^{{\prime\prime} }\) eigenmode versus the number of quadrature points: a real part and b imaginary part. The surface integration-based numerical projection is adopted

3.3 Scattering by an anisotropic nanosphere

Lastly, we use an anisotropic nanosphere to verify the accuracy of our numerical projection procedure on scatterers with optical anisotropy. The center of the nanosphere is located at the origin of coordinates and has a radius of 200 nm. The incident light is a plane wave with left-handed or right-handed circular polarization (LCP or RCP), and the incident direction is along the positive \(z\) axis. The anisotropic dielectric tensor of the nanosphere is \(\overline{{{\varvec{\varepsilon}}_{r} }} \, = \left( {\begin{array}{*{20}c} {\varepsilon_{r} } & {{\text{i}}g} & 0 \\ { - {\text{i}}g} & {\varepsilon_{r} } & 0 \\ 0 & 0 & {\varepsilon_{r} } \\ \end{array} } \right)\), where \({\varepsilon }_{r}=5.2\), \(g=3\), and \(\mathrm{i}=\sqrt{-1}\). As the incident light is LCP or RCP light, the nanosphere exhibits different scattering characteristics due to its anisotropy [34]. The computation results of the scattering cross-section under LCP and RCP illumination are shown in Fig. 9. The total scattering cross-sections obtained by numerical projection are calculated by the sum of scattering cross-sections of multipoles of each order, which are in excellent agreement with the total scattering cross-sections calculated in COMSOL.

Fig. 9
figure 9

Scattering cross-sections of an anisotropic nanosphere. The incident light of subplot a and b is LCP and RCP light respectively. The triangles represent the results calculated by COMSOL, and the circles represent the results from the numerical projection algorithm

4 Conclusion

In summary, we introduce the Lebedev and Gaussian quadrature methods in the numerical projection procedure of multipole decomposition for various scattering objects, and provide the corresponding open-source program, wherein the electric and magnetic multipoles up to the 8th order are coded. Two approaches for numerical projection, surface and volume integration, are reviewed. To validate our numerical projection procedure, we apply it to analyze the light scattering of an isotropic dielectric nanosphere, a symmetric scatterer, and an anisotropic nanosphere. The results show excellent agreement with those from Mie theory, symmetry constraints, and finite element simulation. Moreover, the Lebedev and Gaussian quadrature methods show faster convergence, than is achieved using the trapezoidal rule, for surface and volume integration in multipole decomposition.

Our proposed numerical projection procedure is highly efficient and accurate in analyzing the scattering properties of various nanostructures, and is a useful complement to existing works on multipole projection. Our numerical method is publicly available and could prove beneficial for those working in the field of nanophotonics, enabling convenient design of nanostructures with special scattering properties such as directional scattering, phase modulation, and high transmittance.