Mie calculation of electromagnetic near-field for a multilayered sphere
We have developed an algorithm to calculate electric and magnetic fields inside and around a multilayered sphere. The algorithm includes explicit expressions for Mie expansion coefficients inside the sphere and calculation of the vector spherical harmonics in terms of the Riccati–Bessel functions and their logarithmic derivatives. This novel approach has been implemented in the new version of our program scattnlay. Scattnlay 2.0 will be the first publicly available (at GitHub, https://github.com/ovidiopr/scattnlay) program, based on the Mie theory, which can calculate near-fields for the general case of a multilayer sphere. Several tests were designed to verify that the results obtained with our code match literature results and those obtained through similar programs (limited to core-shell structures) or full-wave 3D simulations. These tests demonstrate that the implementation is effective, yielding accurate values of electric and magnetic fields for a wide range of size parameters, number of layers, and refractive indices.