Light scattered from particles whose size is comparable to the wavelength of light underpins numerous scientific fields, including chemistry, atmospheric science, and nanotechnology. Oscar KC Jackson, Simone De Liberato, and Otto L. Muskens, along with colleagues, are addressing the growing need for efficient and differentiable frameworks for these computations by introducing PyMieDiff. This new library built into PyTorch provides a fully differentiable implementation of Mie scattering for core-shell particles and, importantly, runs efficiently on modern graphics processing units. By representing all input parameters as tensors, the team enables seamless integration with machine learning techniques such as gradient-based optimization and physically informed neural networks, opening new avenues for inverse design and parameter estimation in light scattering applications.
Efficient Mie scattering with automatic differentiation
PyMieDiff is a new open-source library built using JAX and designed to efficiently compute Mie scattering spectra and their derivatives. This toolkit accurately and quickly calculates the spectra of spherical particles of any size, refractive index, and wavelength, with applications in atmospheric science, particle sizing, and optical microscopy. A key feature is full differentiability, which allows direct calculation of sensitivities and slopes with respect to particle properties and wavelength, which is important for solving inverse problems and optimizing designs. This implementation takes advantage of JAX's automatic differentiation and just-in-time compilation to significantly improve performance compared to traditional Mie scattering codes, especially when dealing with complex optimization tasks.
The method incorporates vectorization and parallelization to speed up calculations, improves the Mie scattering formalism, and carefully handles singularities in the scattering cross section. PyMieDiff calculates the complete scattering matrix and allows calculation of extinction cross sections, absorption cross sections, scattering cross sections, and polarization of scattered light. The modular design allows for easy adaptation to a variety of applications, and the well-documented API facilitates integration into existing scientific workflows. Validation against established code and experimental data confirms the accuracy and robustness of the implementation, making it suitable for a wide range of scientific investigations. The focus is on the design of core-shell nanoparticles, structures with a central core surrounded by shells of different materials, used for sensing, imaging, and catalysis. Traditional methods for solving this inverse problem are often computationally expensive, especially for complex structures. The proposed solution combines automatic differentiation with a differentiable Moe solver and machine learning techniques.
Automatic differentiation efficiently calculates the slope of the optical response with respect to particle design parameters such as core radius, shell thickness, and material refractive index. The team developed an important technical achievement, the differentiable Moe solver, which enables calculation of the derivatives required for gradient-based optimization. This solver is integrated with machine learning algorithms such as Adam and L-BFGS to efficiently search the design space to find optimal particle structures. The entire system is implemented in PyTorch, a deep learning framework that provides tools for automatic differentiation and GPU acceleration. Key features of this approach include increased efficiency, flexibility in handling design constraints, accurate results from the differentiable Moe solver, open-source code that promotes reproducibility, and scalability with GPU acceleration. This method also calculates the near-field electromagnetic properties of the particles.
Differentiable Mie scattering for inverse planning
PyMieDiff represents a significant advance in computational nanophotonics, providing a fully differentiable implementation of Mie scattering for core-shell particles within the PyTorch framework. This toolkit enables gradient-based optimization, accelerates the development of physics-based hybrid deep learning models, and provides researchers with new avenues for inverse design problems. The design of this library prioritizes both flexibility and performance, providing an interface compatible with SciPy and native PyTorch implementations with GPU support, enabling efficient computation. The researchers were able to demonstrate the capabilities of PyMieDiff through several examples, including reconstructing particle shapes from the scattering spectrum of a target, training a neural network using analytical Mie calculations, and designing a diffractive lens composed of core-shell spheres in combination with TorchGDM, a multiparticle scattering toolkit. The authors acknowledge potential limitations in the stability of regression calculations for very large particles or particles with strong plasmonic or dielectric interfaces, and suggest that future research may focus on implementing more stable algorithms. The development of this differentiable formulation coincides with the growing interest in solving the multiple scattering problem, an important step towards the reverse design of complex photonic nanostructures, and similar approaches have been developed independently by different research groups, highlighting the timeliness and importance of this work.
