Introduction

Optical levitation offers the tantalizing prospect of harnessing quantum effects at the mesoscale for both fundamental as well as technological purposes, and multiple milestones have recently been reached in the pursuit of these goals1. Through the focusing of a laser beam, particles with sizes in the nanometer or micrometer range can be trapped by an optical tweezer in high vacuum, resulting in underdamped oscillations around an equilibrium position. In contrast to other optomechanical devices2, the spring constant (i.e., stiffness) that governs the oscillator dynamics scales here linearly with laser intensity, providing remarkable tunability. Large stiffnesses are, in particular, required to overcome decoherence rates and perform ground-state cooling of nanoparticles3,4,5,6 as well as to achieve high-performance sensors7. Importantly, trapping has to be photon-efficient—i.e., provide maximal stiffness for minimal optical intensity, as levitated objects in high vacuum are known to heat up substantially due to residual absorption, which is detrimental for quantum coherence8 and can lead to particle melting9. Operating at reduced power is also of major importance to mitigate photonic recoil that hampers cooling10. Several theoretical proposals have therefore been put forward to increase a trap’s stiffness at fixed or reduced intensity, for example, by using different materials and/or particles’ dimensions11,12. Yet, no experimental realization of these concepts with optically levitated nano-objects in high vacuum has been reported so far.

In practice, the optomechanical stiffness is governed by the interplay between the different optical forces produced by the trapping field, which divide into conservative (gradient) and nonconservative (scattering) components13. Gradient forces attract the particle towards intensity maxima, whereas scattering forces commonly push it away along the optical axis, thus weakening optical confinement. For microscale particles (i.e., dimensions largely exceeding the wavelength), which exhibit numerous Mie resonances14, stiffness is strongly hampered by significant scattering forces, whose contributions can be easily tailored—e.g., to balance gravity15. In contrast, levitated subwavelength nanoparticles are often approximated as simple Rayleigh scatterers (or point-like dipoles) with negligible mass, for which gradient forces dominate and lead to increased stiffnesses. Nevertheless, due to an inherently complex dipolar polarizability, the scattering force remains nonzero, shifting the equilibrium position away from focus16, where field intensity—and therefore stiffness—is reduced. It has long been assumed that, unlike for microparticles, the relative contributions of gradient and scattering forces in a diffraction-limited laser field provide optimal confinement of nanoparticles17, thus leaving no straightforward route for improvement.

In domains like multiple-scattering media18,19,20 or complex beam generation21, wavefront-shaping approaches, relying on devices such as Spatial Light Modulators (SLM), have been tailored to control optical-field distributions. In particular, in the case of single microparticles, a spatially-modulated wavefront can reorganize the contributions of Mie resonances, thus reshaping light-matter interactions22. Notably, for large microparticles trapped in liquid—where motion is overdamped—spatially modulating the trapping field’s phase has successfully been used to enhance optomechanical stiffness23,24. However, this strategy might prove ineffective for nanoparticles levitated in vacuum, which, unlike microparticles trapped in water, are expected to behave as point-like Rayleigh scatterers, displaying underdamped motion on very short timescales. Given these constraints, it remains unclear whether wavefront shaping can provide any meaningful control over these particles’ optomechanical confinement.

In this work, we challenge and overturn this prevailing assumption by demonstrating that optomechanical stiffness in nanoparticle levitation can indeed be enhanced through wavefront shaping. We achieve this by spatially modulating the trapping beam’s wavefront to reduce scattering forces while preserving gradient forces. Specifically, we implement an iterative optimization routine that shapes the incoming beam onto a focusing objective to maximize the stiffness of a subwavelength silica bead, thereby making the optical tweezer more photon-efficient. Numerical simulations confirm that this optimization reshapes spatially the scattering force, shifting the equilibrium position closer to focus, where the particle experiences stronger confinement. Experimentally, we validate this effect by analyzing modifications within the stochastic toroidal motions embedded into the particle’s dynamics, revealing direct signatures of reduced nonconservative forces. Crucially, our findings demonstrate that acting on scattering forces—previously considered a fixed constraint—provides a viable pathway to enhance optical confinement even at the nanoscale. Importantly, as optomechanical confinement is enhanced and the particle moves closer to focus, we also observe a reduction in motional nonlinearities that influence the overdamped dynamics at low pressures.

Results

Experimental optimization

We experimentally implement a wavefront-shaping approach that restructures the focused trapping field in order to increase the stiffness of deeply-subwavelength levitated particles. As displayed in Fig. 1a, we levitate individual nanoparticles (radius \(R\) ranging from \(75\) to \(125\,{{\rm{nm}}}\), red dot) inside a vacuum chamber (Supplementary Fig. S1) using an objective lens (\({NA}=0.8\)), which focuses an incoming laser (wavelength \(\lambda=1064\,{{\mathrm{nm}}}\), intensity \(\approx 300\,{{\mathrm{mW}}}\), red beam) whose phase is modulated through a phase-only SLM (“Methods”). The SLM encodes non-uniform wavefronts, \(\phi \left(r\right)\), which reshape the focused field while preserving its overall laser intensity. Below a pressure of a few mbar, the particle experiences underdamped oscillations along \(x,y\), and \(z\), which materialize as mechanical resonances in the power spectral densities (PSDs), \({S}_{{jj},j\in \left[x,y,z\right]}\), emerging for a uniform (i.e., unmodulated) wavefront at around \(100,120,\,{{\rm{and}}}\, 30\,{{\rm{kHz}}}\) for \(x\), \(y\), and \(z\), respectively (Supplementary Fig. S2). The corresponding stiffnesses \({\kappa }_{x}\), \({\kappa }_{y}\) and \({\kappa }_{z}\) are readily deduced from their respective resonance frequencies. The black curve in Fig. 1b displays the axial PSD, \({S}_{{zz}},\) of a \(125\,{{\mathrm{nm}}}\)-radius silica particle levitated using a uniform wavefront (black circle, inset). The beam’s phase is then iteratively shaped through an optimization routine and converges towards an “optimized wavefront” (white-to-black concentric circles, inset), which simultaneously improves the axial frequency resonance (along \(z\), red curve) and the transverse ones (along \(x\) and \(y\), Supplementary Fig. S5). The corresponding iterative enhancements in optical confinements performed throughout the optimization are reported in Fig. 1c. At each iteration, the ratios of the modulated stiffness \({\kappa }_{{{\mathrm{opt}}},i\in \left[x,y,z\right]}\) over their initial (i.e., uniform) values \({\kappa }_{0,i\in \left[x,y,z\right]}\) are displayed and converge towards final magnifications of 1.4, 1.5 and 2.5 along \(x,y\), and \(z\), respectively. When applied to nanoparticles of different sizes, our approach systematically enhances the stiffness (colored curves, Fig. 1d), requiring different optimized wavefronts (white-to-black insets). While the transverse stiffness enhancements follow similar trends when the size increases (yellow and green curves), the axial enhancement turns out to be systematically larger (blue curve). Interestingly, larger particles—bestowed with larger scattering cross sections—display stronger stiffness enhancements along all directions. This emphasizes that the optimization is more efficient on objects that are subject to stronger scattering forces. Remarkably, the wavefronts are customized to match the particle they have been optimized for and appear only partially efficient when applied to particles of different sizes (Supplementary Fig. S10). Our optimization is implemented through a gradient-free routine, which maximizes a cost function assembled from stiffness ratios and can be adapted to promote specific resonance directions (Supplementary Fig. S6). The wavefronts are expanded over a Zernike-polynomial basis, in which axis-symmetric and asymmetric elements appear to have different contributions (Supplementary Figs. S3 and S7). The routine proves very robust: Even though it can converge towards different final solutions associated with different optimized wavefronts, we constantly report comparable enhancements for a given cost function. Inherent to digital SLMs, flicker noise materializes here into harmonics with marginal contributions and spectrally bounded below a few \({{\mathrm{kHz}}}\) (Supplementary Fig. S9). This technical noise does not overlap with the mechanical resonances and, moreover, can be removed using analog SLMs25.

Fig. 1: Experimental optimization.
figure 1

a A laser (red beam) is focused by a high-NA objective to levitate nanoparticles (red dot) in a vacuum. An SLM (black box) phase-modulates the beam and imprints a non-uniform wavefront (white-to-black concentric circles, \(\phi \left(r\right)\) with \(r\) the spatial coordinate on the SLM) that reshapes the trapping field (i.e., focused field). The transmitted light is collected by a second lens and injected into a fiber bundle to read out the nanoparticle’s motion along \(x\), \(y\), and \(z\). b PSDs \({S}_{{zz}}\) of a \(125\,{{\mathrm{nm}}}\)-radius nanoparticle, measured for a uniform (black curve, black circle in inset) and an optimized wavefront (red curve, black-to-white circles in inset). c Evolution of the stiffness ratios \({\kappa }_{{{\mathrm{opt}}},x}/{\kappa }_{0,x}\) (green), \({\kappa }_{{{\mathrm{opt}}},y}/{\kappa }_{0,y}\) (yellow) and \({\kappa }_{{{\mathrm{opt}}},z}/{\kappa }_{0,z}\) (blue) throughout the optimization procedure. The iterations used in b are marked by the black and red double-arrow lines. d Optimized stiffness ratios obtained after applying the routine to nanoparticles of different radii (same color code as in c). The corresponding optimized wavefronts are reported in the insets. Error bars characterize the fluctuations of the final stiffness ratios under their respective optimized wavefronts.

Numerical model

Simulations emphasize that, along the optical axis, the optimization effectively brings the equilibrium position closer to the focus where optical intensity is larger and optomechanical confinement is enhanced. The optimization performed in Fig. 1b, c is emulated through a numerical model, which computes, for arbitrary wavefronts, the exact optical forces’ landscapes through an accurate expansion onto electric and magnetic multipoles14 (“Methods” and Supplementary Fig. S11). The black curves on Fig. 2a, b display respectively the total axial force, \({F}_{Z}\), exerted onto a \(125\,{{\mathrm{nm}}}\)-radius particle by a uniform and an optimized wavefront (insets), when its position is varied along the optical axis, \(z\). Equilibrium locations (\({z}_{{{\mathrm{eq}}}}\), vertical gray dashed line) coincide with the positions where the force cancels \(({F}_{Z}\left({z}_{{{\mathrm{eq}}}}\right)=0)\) and around which the particle oscillates following a dynamic governed by the trap stiffness \({\kappa }_{Z}=-{d}_{Z}{F}_{Z}\left({z}_{{{\mathrm{eq}}}}\right)\) (gray dotted-dashed line). As expected, for a uniform wavefront, the scattering force pushes the nanoparticle away from focus to an equilibrium position \({z}_{{{\mathrm{eq}}}}\approx 2.0\,{{\mathrm{\mu m}}}\). We observe that the optimized wavefront reshapes the axial force’s landscape, which brings the particle closer to focus at \({z}_{{{\mathrm{eq}}}}\approx 1.6\,{{\mathrm{\mu m}}}\), where the stiffness is increased by roughly a factor of \(2.2\) with respect to the uniform case. In line with experimental observations, simulations show that the trap is also more photon-efficient as the optimized wavefront can produce the same value of \({\kappa }_{z}\) as in the uniform case but with now half the intensity (Supplementary Figs. S8 and S13). Once the particle lies closer to focus, we also improve the stiffnesses \({\kappa }_{x}\) and \({\kappa }_{y}\) along the transverse directions \(x\) and \(y\), respectively (Supplementary Fig. S12). Our model also highlights that, even if the nanoparticle is electric–dipole dominated (Mie parameter \(2\pi R/\lambda \approx 0.74\)), electric and magnetic multipoles do play a role26. The forces \({F}_{z}\) displayed in Fig. 2a, b are expanded into their main multipolar contributions, corresponding to electric-dipole (\({F}_{z,{{\mathrm{ED}}}}\), blue), magnetic-dipole (\({F}_{z,{{\mathrm{MD}}}}\), red) and electric-quadrupole (\({F}_{z,{{\mathrm{EQ}}}}\), orange) terms. Yet, while we observe that higher terms are required to stabilize trapping in the uniform case of Fig. 2a, they have minor contributions to the mechanical stiffness that is mainly supported by the electric dipole (i.e., larger slope). As a result, the optimized wavefront mainly reshapes the electric-dipole landscape to improve the optomechanical stiffness \({\kappa }_{z}\), leaving higher terms unaffected (Fig. 2b).

Fig. 2: Numerical simulations of forces' landscapes.
figure 2

a, b Computed axial-force landscape (\({F}_{z}\), black) for a uniform and an optimized wavefront (insets) that are focused onto a \(125\,{{\mathrm{nm}}}\)-radius nanoparticle. The forces are expanded into an electric-dipole (\({F}_{z,{{\mathrm{ED}}}}\), blue), a magnetic-dipole (\({F}_{z,{{\mathrm{MD}}}}\), red) and an electric-quadrupole (\({F}_{z,{{\mathrm{EQ}}}}\), orange) contributions, which include interference terms (Supplementary Fig. S11) and fulfill \({F}_{z}={F}_{z,{{\mathrm{ED}}}}+{F}_{z,{{\mathrm{MD}}}}+{F}_{z,{{\mathrm{EQ}}}}\). Equilibrium positions (vertical gray dashed) fulfill \({F}_{z}\left({z}_{{{\mathrm{eq}}}}\right)=0\), while the stiffness (gray dashed-dotted) is defined as \({\kappa }_{z}=-{d}_{z}{F}_{z}\left({z}_{{{\mathrm{eq}}}}\right)\). c Along the optical axis, \(z\), a uniform beam (black circle) produces an almost-Gaussian optical potential (\({U}_{0}\), black) that sets the gradient force landscape (\({F}_{g,0}=-{d}_{z}{U}_{0}\), dashed black arrow). The nanoparticle (gray bead) is trapped at an equilibrium position (\({z}_{{{\mathrm{eq}}}}\)) shifted away from focus, where \({F}_{g,0}\) balances the scattering force (\({F}_{s,0}\), solid black arrow). The optimized wavefront (black-to-white concentric circles) barely modifies the potential (\({U}_{{{\mathrm{opt}}}}\), red), while reducing the scattering force (\({F}_{s,{{\mathrm{opt}}}}\), solid red arrow). The equilibrium is shifted to a location where the gradient force (\({F}_{g,{{\mathrm{opt}}}}=-{d}_{z}{U}_{{{\mathrm{opt}}}}\), dashed red arrow) matches \({F}_{s,{{\mathrm{opt}}}}\) and the potential is significantly stiffer. d The axial-force distributions, \({F}_{z}\), displayed in a and b are decomposed into the sum of their respective gradient (\({F}_{g,0}\), \({F}_{g,{{\mathrm{opt}}}}\)), and scattering parts (\({F}_{s,0}\), \({F}_{s,{{\mathrm{opt}}}}\)), fulfilling \({F}_{z}={F}_{g}+{F}_{s}\). The black dashed and solid curves represent respectively \(-{F}_{g,0}\) and \({F}_{s,0}\) that are obtained under a uniform wavefront and which intersect at the equilibrium position \({z}_{{{\mathrm{eq}}}}=2\,{{\mathrm{\mu m}}}\). The red dashed and solid curves represent respectively \(-{F}_{g,{{\mathrm{opt}}}}\) and \({F}_{s,{{\mathrm{opt}}}}\) that are obtained under an optimized wavefront and which intersect at the equilibrium position \({z}_{{{\mathrm{eq}}}}=1.6\,{{\mathrm{\mu m}}}\).

Our numerical model also emphasizes that, as sketched in Fig. 2c, the optimized wavefront improves the stiffness by preserving the conservative gradient force while simultaneously strongly reshaping the non-conservative scattering force’s landscape. Along the optical axis, a uniform wavefront (black inset) generates an almost Gaussian-like trapping potential (\({U}_{0}\), black line), in which scattering forces lead to the nanoparticle (gray dot) being trapped at a location \({z}_{{{\mathrm{eq}}}}\) away from focus, where confinement softens. The optimized wavefront (white-to-black inset) barely modifies the potential (\({U}_{{{\mathrm{opt}}}}\), red) while reducing the scattering. Thus, the nanoparticle is brought closer to focus, at a location where the potential quickly stiffens. This mechanism is illustrated in Fig. 2d, where the total optical forces \({F}_{Z}\) computed in Fig. 2a, b are decomposed into their gradient (\({F}_{g,0}=-{d}_{z}{U}_{0}\) and \({F}_{g,{{\mathrm{opt}}}}=-{d}_{z}{U}_{{{\mathrm{opt}}}}\), dashed lines) and scattering components (\({F}_{s,0}\) and \({F}_{s,{{\mathrm{opt}}}}\), solid lines), displayed in black and red for a uniform and an optimized wavefront, respectively. We observe that the gradient-force's landscape (i.e., potential’s derivative) remains largely unaffected by the optimization, while the scattering force is strongly shifted towards focus. This enforces a new equilibrium position, \({z}_{{{\mathrm{eq}}}}\), where the slope of the gradient force significantly contributes to increasing the total stiffness. Alternatively, this stiffness improvement also reveals when considering the “effective” potential \(U\left(z\right)-{\int }_{0}^{z}{F}_{s}\left(u\right){du}\), whose confinement is substantially enhanced when the optimized profile is applied (Supplementary Fig. S14).

Scattering-force modulation

A stochastic analysis of the nanoparticle’s non-equilibrium dynamics confirms experimentally that wavefront shaping achieves a significant modulation of the scattering forces. Due to their non-conservative nature, scattering forces generate toroidal stochastic motions, which extend over distances much smaller than the particle’s radius16,27,28,29,30. Yet, these motions materialize, both on the position and velocity probability distributions, as probability currents describing Brownian vortices (Supplementary Fig. S16). Denoting by \({v}_{\rho }\) and \({v}_{z}\) the norms of the transverse and axial velocities of a \(125\,{{\mathrm{nm}}}\)-radius nanoparticle, Fig. 3a displays a histogram of the probability distribution (\({P}_{v}\), colored map) together with its current (\({\bar{J}}_{v}({v}_{\rho },{v}_{z})\), black arrows), which are assembled from a \(10\,{{{\rm{s}}}}\)-long trajectory obtained under a uniform wavefront (inset). Figure 3b reproduces the same analysis with the optimized wavefront of Fig. 1b (inset) and shows, as expected, confinement enhancements along both the transverse and axial directions, which are combined with a strong current (i.e., vortex) reduction indicative of a significant scattering-force adjustment. In Fig. 3c, the variance, \(\left\langle {\bar{J}}_{v}^{2}\right\rangle\), of the currents displayed in panels a and b is monitored when the pressure is varied, which emphasizes that this reduction remains when the dynamics of the particle varies. Yet, while current modifications are indicative of an adjustment in non-conservative forces, their interpretation remains qualitative (Supplementary Fig. S17).

Fig. 3: Experimental observation of scattering-force modulation.
figure 3

a, b Probability distributions \({P}_{v}\) (normalized by their maximal values, colored map) and their respective currents \({\bar{J}}_{v}\) (black arrows) at 1 mbar in the velocity plane (\({v}_{\rho },{v}_{z}\)) for the uniform and optimized wavefronts of Fig. 1b, respectively (insets). c Averaged flux variance, \(\langle {\bar{J}}_{v}^{2}\rangle\), as a function of pressure for the uniform (black) and optimized wavefronts (red) of (a) and (b), respectively. The error bars characterize the standard deviations in \(\langle {\bar{J}}_{v}^{2}\rangle\) measured over multiple \(300{-}{{\mathrm{ms}}}\)-long time traces.

Non-linearity reduction

At last, we observe experimentally that improving the stiffness also delays the emergence of Duffing non-linearities responsible for spectral deformations at low pressures27,31. When motional damping drops, thermalized particles start to explore the non-linear regions of the trapping landscape. Therefore, stronger confinements (constraining the oscillations’ amplitude) and trapping the particle closer to the focus (i.e., further away from non-linearities) effectively reduce the influence of non-linearities (Supplementary Fig. S14). As Duffing spectral deformations are more pronounced in the transverse plane, we plot in Fig. 4a the PSDs \({S}_{{yy}}\) for different pressures, measured for a \(125\,{{\mathrm{nm}}}\)-radius nanoparticle, while applying the uniform (black) and optimized wavefronts (red) of Figs. 1 and 3. At a pressure of 10 mbar, the two PSDs are almost-Lorentzian, while below 0.1 mbar the one obtained under an optimized wavefront is clearly less subject to non-linearities. We show in the Supplementary Fig. S19 that central frequencies in the uniform and optimized cases are barely reduced when pressure drops. Interestingly, more quantitative insights on the reduction of non-linearities can be gained through short-term dynamics. For instance, at \(0.1\) mbar and under a uniform wavefront, Fig. 4b provides \({S}_{{yy}}\) assembled from \(5 \, {{\rm{ms}}} / 20 \,{{\rm{s}}}\) trajectories (orange/yellow dashed and black, respectively), which emphasizes that spectral broadening and the subsequent non-linear deformations originate from stochastic shifts of the short-time resonance frequency. In Fig. 4c, when pressure is varied, we plot the standard deviations of the short-time-resonance distributions along \(x\), \(y\) and \(z\), which we assemble from frequency-distribution histograms (Supplementary Fig. S18). As expected, when applying the optimized wavefront, non-linearities—which are characterized by large deviations in short-time-resonance—are reduced below roughly \(1\,{{\rm{mbar}}}\) (gray regions).

Fig. 4: Experimental reduction of non-linearities.
figure 4

a PSDs \({S}_{{yy}}\) of a \(125\,{{\mathrm{nm}}}\)-radius sphere measured at three different pressures under the uniform (black) and optimized (red) wavefronts of Fig. 1 and Fig. 3. The reduction of spectral broadening in the optimized case for pressures below \(1\,{{\mathrm{mbar}}}\) emphasizes that nonlinearities are strongly reduced. b PSDs \({S}_{{yy}}\) obtained for a \(20\,{{{\rm{s}}}}\)-long time trace (black) and two Fourier-limited \(5\, {{\rm{ms}}}\)-long time traces (dotted red, dotted orange). c Standard deviations, \({\sigma }_{f}\), of \(5\,{{\mathrm{ms}}}\) time-trace frequency distributions measured along \(x\), \(y\), and \(z\) at different pressures. The black and red curves are obtained using the wavefronts of (a) (same color code). Above \(\approx 2\,{{\mathrm{mbar}}}\), both curves display the same standard deviation. The gray regions indicate where \({\sigma }_{f}\) is lower (and non-linearities reduced) for the optimized wavefront compared to the uniform case. The error bars characterize the fluctuations in \({\sigma }_{f}\) measured over multiple \(500\,{{\mathrm{ms}}}\)-long time traces.

Discussion

In conclusion, we have demonstrated that wavefront shaping can enhance the mechanical confinement of levitated nanoparticles by modulating non-conservative scattering forces. By leveraging commercially available spatial light modulators (SLMs), our approach can be seamlessly integrated into existing optical levitation setups, enabling more photon-efficient confinement. This allows for high trapping stiffness with minimal optical power, a crucial advantage in levitation experiments where photon efficiency directly impacts particle heating and backaction. While wavefront shaping has previously been explored for levitating single microparticles32 or multiple microparticles33,34, our findings underscore its potential for trapping single nanoparticles—key to advancing quantum applications1. Building upon the remarkable progress recently achieved in wavefront shaping35,36, we anticipate that this technique could be implemented non-iteratively37 and transposed to different properties. For instance, it could help address major challenges in optical levitation, including stable trapping in high vacuum, reducing absorption losses and levitating particles composed of diverse materials38, complex geometries39 or embedded with emitters40,41.

Methods

Experimental setup

Inside a vacuum chamber of about \(5{L}\), the light produced by a linearly polarized, ultra-low-noise and water-cooled laser (Azurlight System, \(@1064\,{{\mathrm{nm}}}\), \(10\,{{{\rm{W}}}}\)) overfills the back aperture of an Olympus LMPlan IRx100 objective (\({{\mathrm{NA}}}=0.8\)) with a filling factor of \({f}_{0}=1.1\). This forms an optical tweezer with a beam waist of 810 nm, in which silica nanoparticles (Microparticles GMBH) are trapped. The laser beam is modulated using a phase-only SLM (Holoeye, Pluto-2.1 NIR 149), whose zeroth diffraction order is spatially filtered using a 4f system. The SLM’s flicker noise is characterized by maximal peak-to-peak phase fluctuations of \(3\%\)42. The light scattered from the particle is collected using a \({{\mathrm{NA}}}=0.55\) aspheric lens and injected onto a four-quadrant-like photodetector made of a 1–4 multimode fiber bundle (Thorlabs BF42HS01) coupled to two balanced photodiodes (Thorlabs PDB440C-AC). The signal is digitized using a 350 MHz-bandwidth DAQ (GaGe, TB3-RazorMax, 500 MS/s, 16 bits). The optimization is performed using a Nelder-Mead simplex algorithm, which corresponds to a gradient-free routine. The wavefronts are expanded along a basis made of 30 Zernike polynomials. The cost function is assembled from the ratios of the square of resonance frequencies obtained when applying the wavefront and in the absence of any modulation. A complete description of the procedure is provided in Supplementary Fig. S4.

Numerical model

We compute the optical field focused onto the nanoparticle using a modified version of Debye’s integral13, in which the wavefront produced by the SLM is modeled through a thin-lens apodization function describing a non-uniform phase distribution. The scattered field is obtained using the Generalized Lorentz Mie Theory (GLMT), as an expansion on vectorial spherical harmonics. Integrating the Maxwell Stress Tensor over a spherical shell surrounding the nanoparticle, we obtain the exact expression of the total optical force landscape43. In parallel, the total force is also obtained through a computation of the electric and magnetic multipoles up to quadrupole contributions44,45, which matches GLMT calculations with great precision (Supplementary Fig. S11). This multipolar approach gives analytical expressions of the force that reveal to be extremely useful to compute the conservative and non-conservative contribution46 as well as to speed up the optical-force estimations required to emulate the experimental optimization procedure (Supplementary Fig. S15).