TorchGDM: A GPU-Accelerated Python Toolkit for Multi-Scale Electromagnetic Scattering with Automatic Differentiation
Sofia Ponomareva, Adelin Patoux, Clément Majorel, Antoine Azéma, Aurélien Cuche, Christian Girard, Arnaud Arbouet, Peter R. Wiecha
TL;DR
TorchGDM presents a GPU-accelerated, PyTorch-based framework for nano-optical scattering that unifies volume discretization with effective dipole models through the Green's Dyadic Method. By enabling mixed discretization (fully discretized and GPM-based structures) and full automatic differentiation, it supports differentiable design, optimization, and inverse problems for multi-scale metasurfaces and complex environments. Key contributions include the formalism for 6N×6N coupling, a robust extraction procedure for Global Polarizability Matrix models, and a versatile set of observables (near/far fields, LDOS, Green's tensors, multipole analyses) with AD capabilities. The toolkit targets mesoscale to large-scale scattering problems, offering a path toward physics-informed learning and gradient-based metasurface design, with demonstrated capabilities in resonance searches, BICs, metalens optimization, and large mixed-structure reconstructions. The work also delineates current AD limitations and outlines a roadmap for differentiable Mie/T-Matrix components and iterative solvers to extend scalability beyond ~10^4 dipoles.
Abstract
We present "torchGDM", a numerical framework for nano-optical simulations based on the Green's Dyadic Method (GDM). This toolkit combines a hybrid approach, allowing for both fully discretized nano-structures and structures approximated by sets of effective electric and magnetic dipoles. It supports simulations in three dimensions and for infinitely long, two-dimensional structures. This capability is particularly suited for multi-scale modeling, enabling accurate near-field calculations within or around a discretized structure embedded in a complex environment of scatterers represented by effective models. Importantly, torchGDM is entirely implemented in PyTorch, a well-optimized and GPU-enabled automatic differentiation framework. This allows for the efficient calculation of exact derivatives of any simulated observable with respect to various inputs, including positions, wavelengths or permittivity, but also intermediate parameters like Green's tensor components, which can be interesting for physics informed deep learning applications. We anticipate that this toolkit will be valuable for applications merging nano-photonics and machine learning, as well as for solving nano-photonic optimization and inverse problems, such as the global design and characterization of metasurfaces, where optical interactions between structures are critical.
