Introduction

The quantum control of isolated particles forms the basis for recent advancements in quantum computation1,2,3, for precise time and frequency measurements4,5, for searches for new physics beyond the standard model6,7, for controlled chemistry8,9,10 and for quantum communication11,12.

Recent progress in the quantum control of single trapped molecules13,14,15,16,17 has enabled the detection13,15, coherent manipulation14,16 and entanglement17 of molecular quantum states on the single-particle level. These advances aim at encoding qubits in rotational and vibrational molecular energy states18,19 and at performing precise spectroscopic measurements20 with applications including the development of mid-infra-red frequency standards21 and testing a possible variation of fundamental constants such as the proton-to-electron-mass ratio22,23,24,25,26.

Previous studies13,14,15,16,17 built on prior knowledge of the molecular energy-level structure to engineer level subspaces that enable a precise control on the quantum level. These approaches relied on the entanglement of the internal molecular states with the external motion of a molecular-ion (MI) and atomic-ion (AI) Coulomb crystal27,28. The motion was generated by, e.g., applying state-dependent forces on the MI13,15. The molecular state was then inferred from the excitation amplitude of the MI–AI crystal read out on the AI.

However, for larger and more complex molecules such prior knowledge of the molecular energy-level structure is often not available. Moreover, situations occur, even in comparatively simple diatomic molecules, in which several states that are potentially populated result in similar excitation amplitudes generated by the state-dependent forces such that it is not readily possible to unambiguously distinguish them. Indeed, it can be expected that this is a typical scenario given that molecular-state preparation down to the hyperfine or Zeeman level is currently only feasible for the simplest systems14,29.

Here, we enhanced the capabilities of a recently developed method for the quantum-non-demolition readout of molecular states15,18. This was achieved by interfering a reference force applied on the AI with the state-dependent force experienced by the MI. By changing the relative phase of the forces, additional information on the molecular state could be obtained, which is not available from only measuring the amplitude of the forces.

Using this method, we experimentally identified specific hyperfine-Zeeman states of a single 14N\({}_{2}^{+}\) MI in different excited rotational states of its electronic and vibrational ground state, thus also probabilistically preparing the MI in a specific hyperfine state. We also showed how this method could potentially be used to track the initial and final states during state-changing processes like chemical reactions and inelastic collisions. Finally, we demonstrated a protocol to simultaneously exclude a large subset of rotational levels. This protocol is useful when probing an unknown molecular state within a complex and only partially known energy level structure.

Results

Phase-sensitive forces

Consider a string of two ions, an AI and an MI confined in a linear radiofrequency ion trap (Fig. 1a). The two-ion string exhibits two fundamental motional modes along the trap axis, an in-phase (IP) mode and an out-of-phase mode30,31. The ions are superimposed with a running-wave optical lattice generated by two overlapping linearly polarized counterpropagating laser beams with frequency difference Δf. The lattice induces a modulated ac-Stark shift on the ions which results in a state-dependent optical-dipole force (ODF) oscillating at the frequency Δf. When the oscillation frequency of the ODF matches the one of a motional mode (e.g., Δf = fIP for the in-phase mode), the ODF resonantly excites motion in the mode15,18,32. This motion can be detected on the AI through sideband thermometry15,33,34.

Fig. 1: Experimental scheme.
figure 1

a A pulsed molecular beam of neutral N2 molecules traversed the centre of a linear radiofrequency ion trap. A single 14N\({}_{2}^{+}\) molecular ion was generated from the molecular beam by photoionization and was trapped together with a single laser-cooled 40Ca+ ion (inset). A running-wave optical lattice generated from two counter-propagating laser beams with frequency difference Δf = fIP was overlapped with the two-ion crystal to excite motion depending on the molecular state. The Ca+ ion enabled sympathetic cooling of the N\({}_{2}^{+}\) ion as well as readout of the common motional state and provided a reference for the phase-dependent method presented here. b Four possible configurations (SPR/B, OPR/B) of the lattice containing the atomic ion (AI, blue circle) and the molecular ion (MI, orange circles). The direction of the force on the MI (AI) (Fm(a)) was determined by the frequency detuning ±Δm(a) of the lattice laser beams from resonance and the relative positions of the particles in the lattice field. The AI and the MI had either the same signs of detuning (top) or opposite signs (bottom). For an MI at positions SPR and SPB in the lattice, the distance between the two ions was such that they experienced the same phase (SP), while at positions OPR and OPB the ions experienced opposite phases (OP) of the lattice intensity gradient. c The ac-Stark shift, ΔE, experienced by the AI in the (3d)2D5/2(m = −5/2) (red) and the MI in the \({X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0,\,N^{\prime\prime} =0)\) (blue) states as a function of lattice wavelength in the region 785–790 nm. The direction of the ac-Stark shift switches sign when changing from negative to positive detuning across a molecular resonance while the ac-Stark shift experienced by the AI remains constant in this wavelength range.

In addition to the ac-Stark shift on the MI, the lattice may induce a non-negligible ac-Stark shift on the AI. Since two ODFs are applied on the crystal simultaneously, the relative phase of the forces will influence the total degree of motional excitation. This phase depends on both the sign of the detuning of the lattice wavelength from spectroscopic resonances in the ions as well as the distance of the ions from each other. The former determines the sign of the ac-Stark shift experienced by the AI and the MI while the latter determines the relative phase of the optical lattice at the positions of the AI and MI.

For the AI, the sign and amplitude of the ac-Stark shift were constant in our experiments because the lattice beams were far detuned (−Δa) from any atomic resonance (Fig. 2a). Here, the minus sign indicates that the lattice beams were red detuned from the nearest transition. On the other hand, for the MI, the amplitude and sign of the induced ac-Stark shift depended on the specific rovibronic, hyperfine and Zeeman state of the MI. Within the frequency range of the optical lattice used in the present experiments, a range of different spectroscopic transitions were accessible (Fig. 2b) leading to different detunings (±Δm) depending on the exact state of the MI.

Fig. 2: Energy-level diagrams.
figure 2

a Reduced energy-level diagram (not to scale) of 40Ca+ relevant for Doppler and resolved-sideband cooling as well as motional state readout (solid arrows indicate transition frequencies). Motional excitation was initiated by a 1D lattice (dashed arrow indicates the laser frequency not to scale) which mainly interacted with the (nf)FJ(m = −5/2) states (where n ≥ 4 and J = 7/2, 5/2) when Ca+ was shelved in the (3d)2D5/2(m = −5/2) level. The transition wavelength to the F states is smaller than 184 nm such that the lattice at 789 nm is far red detuned. b Simplified energy-level diagram (not to scale) of the \({A}^{2}{\Pi }_{u}(v^{\prime} =2)\leftarrow {X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\) band of 14N\({}_{2}^{+}\). Solid arrows indicate the possible transitions from a single rotational level (split into two spin–rotation components) of the ground vibronic state. Red (blue) arrows indicates red (blue) detuning of the lattice frequency (dashed green arrow) with respect to the relevant transitions.

 Figure 1b shows a schematic of two different configurations of forces on the two ions used in our experiment. Since the AI was always red detuned, it always experienced a force in the direction of higher lattice intensity (high-field seeking configuration). For the MI, however, both high- and low-field seeking (blue detuning) scenarios were possible (upper and lower panels in Fig. 1b). The relative phase of the forces was set by controlling the distance between the two ions, d. By placing the two ions at a separation that corresponded to an integer multiple of lattice nodes, d = nλ/2 (\(n\in {\mathbb{N}}\) is an integer number and λ is the wavelength of the lattice lasers), the ions experienced the same intensity gradient from the lattice. We denote this lattice configuration as “same phase” (SP). In the SP scenario, the forces were in the same (opposite) direction when the MI was red (blue) detuned (SPR and SPB in Fig. 1b). By changing the two-ion distance by half a lattice spacing, Δd = ± λ/4, the ions experienced an opposite gradient of the lattice field, i.e., the opposite phase (OP) of the lattice. In the OP lattice configuration, the forces were in the same (opposite) direction when the MI was blue (red) detuned (OPR and OPB in Fig. 1b).

In the case when the forces interfered constructively (same directions), the resulting motional-excitation signal was stronger than in the case of destructive interference (opposite directions). This by itself did not yield information about the sign of the detuning since the ac-Stark shift varied greatly between different states such that a priori the strength of the signal could not be predicted. In order to disentangle the strength and sign of the ac-Stark shift, the SP and OP configurations were compared by varying the two-ion distance and thus obtained both the magnitude and sign of the ac-Stark shift. As the detuning (Δm) changes across a resonance in the molecule, the direction of the induced ac-Stark shift (and hence the dipole force) changes while the direction of the shift (and hence the force) on the AI remains constant (Fig. 1c). As will be shown below, this information proves extremely valuable for distinguishing states in a complex energy level structure.

The signed value of the ac-Stark shift, ΔEj, is related to the dynamic molecular polarizability, αj(ω), via \(\Delta {E}^{j}=-\frac{{\alpha }^{j}(\omega )}{2{\varepsilon }_{0}c}I\) (see Methods). Here, the index j specifies the quantum state of the molecule, ε0 is the vacuum permittivity, c is the speed of light and I ≈ 11.5 W mm−2 is the intensity of a single lattice beam. The AI was used as a probe for the lattice intensity at the position of the AI–MI crystal (see Methods).

Experiment

A detailed description of our experimental apparatus is given in refs. 15,18, a schematic representation is shown in Fig. 1a and a brief overview is given in the Methods section.

The relevant energy levels of 40Ca+ and 14N\({}_{2}^{+}\) are shown in Fig. 2. With lattice beams linearly polarized and parallel to the magnetic-field direction, the lattice mainly interacted with high-lying (nf)F7/2(m = −5/2) and (nf)F5/2(m = −5/2) levels in Ca+ since the AI was prepared in the metastable (3d)2D5/2(m = −5/2) state. Here, m denotes the magnetic quantum number. Even though the lattice was highly red-detuned from these AI levels (Δa >250 THz), their contribution to the ac-Stark shift was not negligible (see Methods). For N\({}_{2}^{+}\), the lattice was nearly resonant with the \({A}^{2}{\Pi }_{u}(v^{\prime} =2)\leftarrow {X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\) vibronic transition where \(v^{\prime}(v^{\prime\prime})\) denotes the quantum number of the upper (lower) vibrational level of the transition. The detuning was dependent on the exact rotational, fine, hyperfine and Zeeman state of the MI. Figure 2b shows the detuning of the lattice on the P(J), Q(J), and R(J) lines initiating from the two spin–rotation components of the vibronic ground state. Here, J is the quantum number of the total molecular angular momentum without nuclear spin of the MI in its \({X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0,N^{\prime\prime} ,\;J^{\prime\prime} =N^{\prime\prime} \pm 1/2)\) ground state and P,Q,R stand for spectroscopic branches with \(\Delta J=J^{\prime} -J^{\prime\prime} =-1,0,1\).

An ODF pulse was applied to detect the state of the molecule. In this pulse, the lattice lasers were turned on for a duration of 3 ms to excite motion in the crystal. The motional state of the IP mode was subsequently probed on the AI by Rabi sideband thermometry on a blue sideband of the D5/2(m = −5/2) → S1/2(m = −1/2) transition33,34. The frequency and contrast of the resulting Rabi-oscillation signal was proportional to the ODF strength (Methods).

In order to obtain both the sign and the magnitude of the ac-Stark shift experienced by the MI, the Rabi-oscillation experiment was performed twice. Once with an ion distance of d = nλ/2 where n = 19 and λ ≈ 789 nm corresponding to the SP configuration (\({f}_{{\rm{IP}}}^{{\rm{SP}}}=695\) kHz) and a second time with the ion distance shifted by Δd = +λ/4 corresponding to the OP configuration (\({f}_{{\rm{IP}}}^{{\rm{OP}}}=668\) kHz). The configurations were changed by adjusting the voltages on the ion-trap end-cap electrodes. The relative uncertainty in determining the ion–ion distance was estimated to be δd/d = 10−3 (Methods).

Example of Rabi-oscillation signals from two SP/OP experiments are shown in Fig. 3. The blue-sideband-pulse duration, t729, was scanned and averaged 20 times for each data point to retrieve two Rabi-oscillation signals in each experiment, one for the SP (blue) and the other one for the OP (purple) configurations. The frequency and contrast of the Rabi signals were observed to be higher for the SP configuration compared to the OP configuration in Fig. 3a, implying that the ODF and overall motional excitation was stronger for the SP configuration. This indicated that the detuning of the lattice frequency from a molecular resonance was to the red in this experiment (Fig. 1b, upper panel). The resulting Rabi oscillations were fitted to a phenomenological function which was used to extract the amplitude of the ac-Stark shift (Methods). Based on the obtained values for the phase and amplitude, the molecular state could unambiguously be identified as N″ = 6, J″ = 11/2, as illustrated in the following section.

Fig. 3: Rabi thermometry.
figure 3

Rabi oscillation signals for the SP (blue) and OP (purple) lattice configurations after an ODF pulse for two different molecular states (panels a and b). Each data point is an average of 20 ODF excitations. Error bars represent 1σ binomial uncertainties. The solid curves represent fits to the data as described in the Methods section from which the ac-Stark shifts were extracted. a The stronger SP signal (larger frequency and amplitude of the Rabi oscillation) suggest that the lattice laser (λ = 789.71 nm, in both experiments) was red detuned from the closest molecular transition. By comparing the measured amplitude and sign of the ac-Stark shift with theory (Methods), the molecular state could unambiguously be be identified as N″ = 6, J″ = 11/2. b The stronger OP signal suggests that the lattice laser was blue detuned from the closest molecular transition. Therefore, all rotational states N″ ≤ 4 can be excluded (see below).

In Fig. 3b, the opposite situation occurred for the same settings of the lattice laser beams. Here, the observed frequency and contrast of the Rabi signals were higher for the OP configuration. This implied that the lattice frequency was blue-detuned from the closest molecular resonance. Below it is shown how based on this observation only, all molecular states with N ≤ 4 can be excluded.

Results

Our method applied to the identification of specific spin–rotation and Zeeman levels of N\({}_{2}^{+}\) molecules in the \({X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\) electronic and vibrational ground state is exemplified in Fig. 4 with the N″ = 4 and N″ = 6 states. By tuning the lattice-laser wavelength near 789 nm, the detection was sensitive to states originating from the N″ = 4, J″ = 7/2 spin–rotation manifold and induced a significant ac-Stark shift through the Q12(7/2) transition at 788.624 nm (red lines in Fig. 4). For these states, the lattice frequency was red detuned with respect to the transition frequency. At the same wavelength, the detection was also sensitive to states originating from the N″ = 6, J″ = 11/2 spin–rotation manifold. These states induced a significant ac-Stark shift through the Q12(11/2) transition at 789.1872 nm (blue lines in Fig. 4). For these states, the lattice frequency was blue detuned with respect to the transition frequency.

Fig. 4: Molecular-state identification.
figure 4

Absolute magnitude of the ac-Stark shifts (left ordinate) and the molecular dynamic polarizability (right ordinate) for molecules in the N″ = 4, 6 and 8 rotational states (red, blue and green lines) at a lattice-laser wavelength around 789 nm. Thick lines correspond to the ac-Stark shift of Zeeman components of the I = 0 nuclear-spin isomer without hyperfine structure (labelled by their magnetic quantum numbers mJ on top of the figure) while thin lines correspond to the hyperfine-Zeeman components of the I = 2 isomer. Blue (red) triangles represent experiments in which the measured ac-Stark shifts were stronger in the OP (SP) configuration corresponding to a lattice blue (red) detuned from the transition. The black square represents an experiment without the phase information. Error bars are the combined 1σ uncertainties of the fit to the data (Methods) and the uncertainty of the lattice laser power (~10%). The ac-Stark shifts originating from the N″ = 0, 2 rotational levels are lower than the ones for the N″ = 8 state in this wavelength range and were omitted for clarity.

In the present experiments, molecules in the electronic and vibrational ground state were primarily created in rotational states with N″ ≤ 8 by a rotationally unselective photoionization scheme. In each experiment, the molecules were randomly initialized in one of the 540 corresponding hyperfine Zeeman states. The detection protocol was then applied to extract the amplitude and phase of the ODF signal. In many experiments, the signal was very low, indicating that the state of the molecule was not within the subspace of states which could effectively be traced at the chosen lattice-laser wavelength (examples are shown by the red triangles in the bottom of Fig. 4). However, for some experiments (labelled 1–3 in Fig. 4), the ODF amplitude was large enough indicating that the molecule was either in the N″ = 6, J″ = 11/2 or the N″ = 4, J″ = 7/2 spin–rotational states. The added sign information enabled us to distinguish between these two spin–rotation manifolds (blue and red triangles, respectively). The black square exemplifies an experiment in which the sign information was lacking and, therefore, an unambiguous identification of the molecular state was not possible.

For the experiment marked 1 in Fig. 4, the state was identified as N″ = 4, J″ = 7/2. The measured and the predicted ac-Stark shifts agree within 1σ with only six hyperfine Zeeman states (Table 1). Thus, 534 out of 540 possible states can be excluded for a molecule with N ≤ 8. Even if we assume a discrepancy of 2σ between theory and our measured ac-Stark shifts, 528 of the 540 possible states of the molecule can be excluded (Table 1). For the experiment marked 2 in Fig. 4, the state was identified as N″ = 6, J″ = 11/2. Here again, only 6 (12) hyperfine Zeeman states agree with theory within 1σ (2σ), thus excluding 99% (98%) of the possible states (Table 1).

Table 1 Molecular state identification.

The experiments marked 3 and 4 in Fig. 4 also show opposite signs at a comparable amplitude. While in experiment 3, the state was identified to be 1 out of 4 (6) hyperfine Zeeman states of the N″ = 6, J″ = 11/2 spin–rotation manifold, experiment 4 was associated with 22 (42) hyperfine Zeeman states of the N″ = 4, J″ =  7/2 and N″ = 8, J″ = 17/2 spin–rotation manifolds (Table 1). These experiments exemplified that using the phase information, it is possible to exclude more than 50% (here  ~85%) of the states compared to when only the amplitude information is available.

To further illustrate the capabilities of the present state-detection protocol, a state-sensitive chemical reaction experiment was implemented to observe how N\({}_{2}^{+}\) molecules in a determined state react with H2 background gas molecules to form N2H+. Figure 5 shows the results of such an experiment. An N\({}_{2}^{+}\) molecule was identified to be in the N = 4, J″ = 7/2 spin-rotational state (Fig. 5a). The molecule eventually reacted with background gas and turned into N2H+. The change of the Rabi-oscillation signal from panel a to panel b indicated a possible change of the chemical composition of the molecule, which was then verified by mass spectrometry (Methods). Due to the mass change of the crystal in the reaction, the frequency difference of the lattice beams, Δf, had to be adjusted to match the new crystal frequency \({f}_{{\rm{IP}}}^{{\rm{SP}}}({\mathrm{{{N}}}}_{2}{\mathrm{{{H}}}}^{+})=690\) kHz (Methods). The energy-level structure of N2H+ is not sufficiently known to be able to clearly identify the molecular quantum state generated in the reaction. However, the phase information indicated that the lattice beams were red detuned from the relevant resonance in the N2H+ molecule. This experiment exemplifies the basic possibility to perform state-to-state chemical reaction experiments involving polyatomic species. The ability to perform such experiments depends on the lifetime of the product state compared to the time required for state detection.

Fig. 5: Tracing molecular states during inelastic processes.
figure 5

State dynamics of two molecules (experiment nos. 1 and 2 in Fig. 4) probed by the present SP/OP protocol under a chemical reaction (a → b) and a quantum jump (c → d). (a → b): An N\({}_{2}^{+}\) molecule in the N″ = 4, J″ = 7/2 state reacts with a background-gas H2 molecule and converts into N2H+. (c → d) An N\({}_{2}^{+}\) molecule in N  = 6, J″ = 11/2 changes its state (likely to N″ = 4) due to an inelastic collision or photon scattering. Error bars represent 1σ binomial uncertainties.

Following the same principle, inelastic, i.e., state-changing, processes of a single molecule can also be traced. In panels c and d of Fig. 5, the results of such an experiment are shown. An N\({}_{2}^{+}\) ion in the N″ = 6, J″ = 11/2 spin–rotational state underwent a quantum-jump to a different rotational state as can be seen by the change in the amplitude and phase of the Rabi-oscillation signal. The change of state could have been caused by either an inelastic collision with a background-gas molecule or by the scattering of a photon from the lattice laser15. Prior to the quantum jump, the OP configuration showed a stronger signal than the SP configuration while after the collision, the OP configuration showed a weaker signal than the SP configuration. This suggests that the molecule underwent a rotational-state change, most probably to the N″ = 4 state though the low amplitude of the signal does not allow us to unambiguously exclude other rotational or vibrational states. The state of the molecule after the quantum jump could have been tested with higher fidelity by changing the lattice laser frequency to a value at which the assumed state would result in an increased signal amplitude.

In this experiment, the interrogation time for state identification was on the order of few seconds. This relatively long interrogation time posed no problem since all states of homonuclear diatomics in the electronic ground state are long-lived. However, this timescale could set a limitation for the state identification of polar molecules in which the rovibrational states typically exhibit shorter radiative lifetimes. This can become important, for example, in a state-to-state reaction experiment in which the product states are short lived or if interaction with black-body radiation scrambles the state populations. In this case, the interrogation time can be reduced by carefully choosing the lattice and AI parameters to maximize the signal and minimize the averaging time. Moving the experiment to a cryogenic environment should also reduce the limitation on the interrogation time.

The experiments presented so far relied on prior knowledge of the strengths and positions of molecular transitions to positively identify specific states of a molecule by comparing the experimentally obtained ac-Stark shift to theory. In a variety of molecules, this information will not be completely available. For the common situation in which only the frequencies of the transitions are known, e.g., from a prediction based on known spectroscopic constants, we propose and demonstrate here an adaption of the present method for partial state readout35 that can be used to exclude a large subset of molecular states simultaneously and provide a non-destructive spectroscopic signal.

An example is given for the present case of N\({}_{2}^{+}\). The positions of all spectral lines belonging to the \({A}^{2}{\Pi }_{u}(v^{\prime} =2)\leftarrow {X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\) transitions up to N″ = 6 colour coded by rotational state are shown in Fig. 6. As can be seen in the figure, a lattice-laser wavelength larger than 789.4 nm (dashed line) is red-detuned with respect to all transitions with N ≤ 4. Therefore, detecting a blue detuning in an SP/OP experiment excludes this entire manifold regardless of its substructure or strengths. In Fig. 3b, a demonstration for this partial state readout is shown. Here, a lattice wavelength of 789.71 nm was used and a stronger OP than SP signal was detected which implied that the lattice was blue detuned to the molecular transition, thus enabling to exclude all states with rotational quantum number N ≤ 4 for this molecule.

Fig. 6: State identification within a dense level structure.
figure 6

Stick spectrum showing the positions of the allowed P, Q and R transitions of the \({A}^{2}{\Pi }_{u}(v^{\prime} =2)\leftarrow {X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\) band of N\({}_{2}^{+}\) originating from the rotational levels N = 0 (red), 2 (magenta), 4 (orange) and 6 (blue). A subset of these states can be excluded by determining the effective detuning at specific lattice wavelengths using an SP/OP experiment. The dotted, dash-dotted and dashed lines show the lattice wavelengths that enable the exclusion of rotational states N″ = 0, N ≤ 2 and N ≤ 4. The detuning can be chosen either blue of the transitions (782.6, 782.1 and 781.6 nm to exclude N″ = 0, N ≤ 2 and N ≤ 4 respectively) or red (787.5, 788.2 and 789.4 nm to exclude N″ = 0, N ≤ 2 and N ≤ 4). By choosing the detuning opposite to the detuning of an excited state of interest, the initial and final states are easily distinguishable in an SP/OP test with no available information about the hyperfine or Zeeman structure of either upper or lower states or the specific transition strengths.

Conversely, the present protocol can be used as a non-destructive readout for spectroscopic excitations when exciting from a partially known initial state, e.g., N ≤ 4 (v″ = 0) to a long-lived excited state with a known detuning with respect to the lattice such as the \(v^{\prime} =1\) state of the \({X}^{2}{\Sigma }_{g}^{+}\) ground state. For instance, at around 804 nm the lattice laser is blue-detuned from the closest transitions out of \(v =1\) and one can detect a successful spectroscopic excitation from low rotational states in the vibrational ground state to the first excited vibrational state as a change in the sign of the ac-Stark shift even with no available information about the hyperfine or Zeeman structure of either upper or lower states or the transition strengths. Such an approach will greatly enhance the possibilities for non-destructive spectroscopic experiments in complex molecules.

To conclude, we have demonstrated an experimental protocol for molecular-state detection incorporating both the amplitude and sign of the ac-Stark shift. Using this protocol, Zeeman levels of rotational states of N\({}_{2}^{+}\) were identified in a region where information about only the amplitude of the ac-Stark shift leads to ambiguity in the state identification. The state identification of hyperfine-spin-rotational levels can also be regarded as a probabilistic state preparation. The hyperfine-state preparation of molecular ions has been a long-standing open problem in molecular physics29,36 for which the present scheme offers a complementary solution.

The present method was also demonstrated to trace reactive and state-changing collisions of single molecules with partial state selectively. We also showed how the sign information provided by the present method can be used for a partial state determination in situations in which only incomplete spectroscopic information is available on the molecule. The present work thus introduces important new tools towards non-destructive state identification and spectroscopy of complex molecular systems.

Methods

Experimental setup

A molecular-beam machine was coupled to a linear radio-frequency ion trap in which a 40Ca+ AI and a 14N\({}_{2}^{+}\) MI were trapped simultaneously (Fig. 1 of the main text). A small magnetic field of 4.6 G defined the quantization axis along the viewing direction of the camera, orthogonal to the trap axis. A continuous-wave (CW) laser beam at 789 nm was split into two paths which were then superimposed on the trapping region in a counter-propagating configuration to form an optical lattice. The polarization of the beams was chosen parallel to the magnetic-field vector. The frequency difference, Δf, between the beam paths was matched to the frequency of the IP motional mode using acousto-optic modulators. Two pulsed dye-laser beams at 202 and 375 nm were used to produce 14N\({}_{2}^{+}\) ions by resonance-enhanced multi-photon ionization (REMPI) from the pulsed molecular beam of neutral 14N2 molecules37,38. The ionization scheme was chosen to create 14N\({}_{2}^{+}\) in the lowest rotational levels of the I = 0 or I = 2 nuclear-spin isomers (corresponding to levels with even rotational angular momentum quantum numbers N = 0, 2, 4, …) in the electronic and vibrational ground state. We achieved this isomeric selectivity by using a [\(2+1^{\prime}\)] REMPI scheme consisting of two 202 nm photons at 49,426 cm−1 on resonance with the S(0) transition from the rovibronic ground-state (N = 0) in neutral 14N2. Therefore, the I = 1 isomer, with its lowest rotational state N = 1 was excluded from the ionization. Two CW lasers at 397 and 866 nm were used for Doppler laser cooling of Ca+, and another two laser beams at 729 and 854 nm were used for resolved-sideband cooling and coherent state manipulation.

Our experimental procedure was described in detail in refs. 15,18. Approximately ten Ca+ ions were loaded into the trap and Doppler cooled on the (4s)2S1/2 ↔ (4p)2P1/2 ↔ (3d)2D3/2 closed optical cycling transitions to form a string of Coulomb-crystallized ions. A single N\({}_{2}^{+}\) ion was then loaded into the trap using REMPI. The appearance of a dark ion in the string signalled the sympathetic cooling of a molecule. By lowering the trap depth, Ca+ ions were successively ejected from the trap until a Ca+–N\({}_{2}^{+}\) two-ion string remained. The ions were cooled to the motional ground state of the IP motional mode by resolved sideband cooling on the (3d)2D5/2(m = −5/2) ←  (4s)2S1/2(m = −1/2) transition of Ca+ followed by quenching the D5/2 state to the S1/2 level through the (4p)2P3/2 state and optical pumping back to the S1/2(m = −1/2) state. To prepare the Ca+ ion in the metastable D5/2(m = −5/2) state, we used a π-pulse on the narrow D5/2(m = −5/2) ← S1/2(m = −1/2) transition followed by a state-purification pulse14,15. The state-purification pulse projected the Ca+ either to the D5/2(m = −5/2) or the S1/2 state with a heralded signal (photon scattering) that allowed us to exclude experiments with improper state preparation. We chose the D5/2(m = −5/2) level due to its reduced ac-Stark shift compared to the S1/2 state which would have overwhelmed the molecular signal.

Phase-sensitive forces

In ref. 15, we used a similar type of force-spectroscopic method to the one presented here. In that work, we employed a smaller lattice-laser detuning from a specific, well known resonance in N\({}_{2}^{+}\) prepared in a specific quantum state and consequently required a smaller lattice-laser intensity and duration compared to the present study. Under these conditions, small effects such as the contribution of the ODF on Ca+ to the motional excitation, the effects of far-detuned molecular resonances including other electronic transitions and the influence of the polarizability of the N\({}_{2}^{+}\) core electrons on the excitation strength could be neglected.

For the objectives of the present work, i.e., the determination of an initially unknown quantum state of the molecule, larger detunings from molecular resonances and consequently higher laser intensity and duration were necessary. Here, we give a more complete account of phase-sensitive force spectroscopy that includes the effect of the lattice on both the atomic and the molecular ions.

Normal modes of the system

The derivation of the normal modes of a Coulomb crystal of two ions with unequal masses in a harmonic trap is described in refs. 30,31. Here, we only give the final results and definitions which will be used later in the extraction of the molecular ac-Stark shift from the experimental signal.

The present system is composed of two ions, a molecular ion with mass m1 = 28 a.u. and an atomic ion with mass m2 = 40 a.u. The ions are confined in a harmonic potential characterized by a spring constant, u0, such that the frequency of a single particle is given by \({\omega }_{i}=\sqrt{{u}_{0}/{m}_{i}}\). Here, the subscripts i = 1, 2 refer to the molecular ion and the atomic ion, respectively.

When both ions are trapped together, they form a crystal due to the balance between their Coulomb repulsion, \({F}_{\text{c}}=-\frac{{e}^{2}/4\pi {\varepsilon }_{0}}{{r}_{12}^{2}}\), and the harmonic confinement of the trap. Here, e is the electron charge, ε0 is the vacuum permittivity and r12 is the separation between the two ions. The distance between the equilibrium positions, \({x}_{i}^{0}\), of the ions in the crystal is given by

$$d=| {x}_{2}^{0}-{x}_{1}^{0}| =\root{3}\of {\frac{{e}^{2}}{4\pi {\varepsilon }_{0}}\frac{2}{{u}_{0}}}.$$
(1)

By measuring the trap-oscillation frequency of a single atomic ion, ω2, with relative uncertainty δω2/ω2 < 10−3, the distance d can be calculated with a similar accuracy.

At the motional-excitation amplitudes reached in the present experiments, the ions performed only small oscillations around their equilibrium positions, \({q}_{i}={x}_{i}-{x}_{i}^{0}\), such that it is safe to keep only harmonic terms in an expansion of the potential. The displacements of the individual particles, however, do not correspond to the normal modes of the system. To transform to a normal-mode basis, scaling and rotation transformations given by

$$\left(\begin{array}{l}{\beta }_{+}\\ {\beta }_{-}\end{array}\right)=\left(\begin{array}{ll}\cos (\theta )/\sqrt{\mu }&-\sin (\theta )\\ \sin (\theta )/\sqrt{\mu }&\cos (\theta )\end{array}\right)\left(\begin{array}{l}{q}_{1}\\ {q}_{2}\end{array}\right).$$
(2)

were performed. Here, β± are the in-phase (−) and out-of-phase (+) normal-mode displacements, θ is a rotation angle where \(\tan (\theta )=1/\sqrt{\mu }-\sqrt{\mu }+\sqrt{1/\mu +\mu -1}\) and μ = m2/m1. In the normal-mode picture, the system is equivalent to an ion of mass m2 trapped in a 2D harmonic potential with two uncoupled mode frequencies,

$${\Omega }_{\pm }={\omega }_{2}\sqrt{1+\mu \pm \sqrt{1+{\mu }^{2}-\mu }}.$$
(3)

Note that a change of one unit in the mass of the molecular ion (as in the case of the chemical reaction described in Fig. 5 of the main text) corresponds to a relative change of the in-phase mode frequency of δΩ ≈ 6 × 10−3, which can readily be detected in the present experiments.

Lattice excitation of the normal modes

The optical lattice induces a modulated ac-Stark shift on both the atomic and molecular ion,

$$\Delta {E}_{i}=2\Delta {E}_{i}^{0}\left(1+\cos (2k{q}_{i}-\Delta\omega t+{\phi }_{i}^{0})\right).$$
(4)

Here, \(\Delta {E}_{i}^{0}\) is the ac-Stark shift induced by a single lattice beam, Δω = 2πΔf is the difference in angular frequency of the lattice-laser beams, k = 2π/λ is the lattice-laser k-vector and λ ≈ 789 nm is the lattice-laser wavelength. The phase, \({\phi }_{i}^{0}=2k{x}_{i}^{0}\), depends on the equilibrium positions of the particles. In the SP configuration, the phase difference between the two particles, \({\phi }_{21}^{0}={\phi }_{2}^{0}-{\phi }_{1}^{0}=2k{d}_{{\rm{SP}}}=2\pi n\) (n an integer), is such that the phase of the lattice is equal for both particles. In the OP configuration, \({\phi }_{21}^{0}=2k{d}_{{\rm{OP}}}=2\pi (n+1/2)\), and the particles experience opposite phases of the lattice intensity gradient (Fig. 1b of the main text). An additional phase difference is attributed to the sign of the ac-Stark shift, \(\pm | \Delta {E}_{i}^{0}|\), which depends on the detuning of the lattice-laser frequency with respect to a dominant resonance in the relevant particle.

To get an intuition on how the ODF on the molecular ion and the atomic ion affect the excitation of the in-phase mode of the crystal, we first expand Eq. (4) in a Taylor series around the equilibrium positions and neglect constant terms of the potential which do not exert any force,

$$\Delta {E}_{i}\approx -4k\Delta {E}_{i}^{0}{q}_{i}\sin (\Delta\omega t-{\phi }_{i}^{0}).$$
(5)

In this approximation, the lattice exerts an oscillating spatially homogeneous force with an amplitude \({F}_{i}=4k\Delta {E}_{i}^{0}\) on particle i. In the case of a single particle, this force will lead to coherent excitation of motion in the trap. In the case of two ions with unequal masses, the ac-Stark shift resulting in the driving of the in-phase mode can be obtained using Eq. (2),

$$\Delta {E}_{-} =-4k\left(\Delta {E}_{1}^{0}\sqrt{\mu }\sin (\theta )\pm \Delta {E}_{2}^{0}\cos (\theta )\right){\beta }_{-}\sin (\Delta\omega t)\\ \equiv -4k\Delta {E}_{-}^{0}{\beta }_{-}\sin (\Delta\omega t).$$
(6)

Here, the  ±  sign corresponds to the SP and OP configurations, respectively, and \(\Delta {E}_{-}^{0}\) defines the single-beam ac-Stark shift of the in-phase mode. Thus, the two forces exerted by the lattice on the two ions are combined to a single effective force on the in-phase mode with an amplitude, \({F}_{-}=4k\Delta {E}_{-}^{0}\). This force will lead to coherent excitation of the in-phase mode of the two-ion crystal. In this analytical derivation, higher order terms of the lattice potential were neglected, which lead to squeezing of the motional states and to mixing of the in-phase and out-of-phase modes. In the data analysis, we used a classical simulation of the two-ion system to account for high-order terms in the lattice excitation15,18.

By measuring the in-phase motional excitation amplitude both in the SP (\(| \Delta {E}_{-}^{0}({\rm{SP}})|\)) and in the OP configuration (\(| \Delta {E}_{-}^{0}({\rm{OP}})|\)), the amplitude of the ac-Stark shift, \(| \Delta {E}_{\,\text{m}\,}^{0}|\), exerted by the lattice on the molecule can be determined,

$$| \Delta {E}_{\,\text{m}\,}^{0}| \equiv | \Delta {E}_{1}^{0}| =\frac{| \Delta {E}_{-}^{0}({\rm{SP}})| +| \Delta {E}_{-}^{0}({\rm{OP}})| }{2\sqrt{\mu }\sin (\theta )},$$
(7)

under the assumption that \(| \Delta {E}_{\,\text{m}}^{0}| \,> \,| \Delta {E}_{\text{a}\,}^{0}|\). The phase of the ac-Stark shift is inferred from the relative amplitudes obtained in the SP and OP measurements assuming that the sign of the ac-Stark shift on the atomic ion is negative.

Ac-Stark shift of Ca+

The ac-Stark shift, ΔEj, of a level j in Ca+ is given by

$$\Delta {E}^{j}=-\frac{{\alpha }^{j}(\omega )}{2{\varepsilon }_{0}c}I,$$
(8)

where ε0 is the vacuum permittivity, c is the speed of light, I the laser intensity, and αj(ω) the dynamic polarizability of level j which is given by

$${\alpha }^{j}(\omega )={\alpha }_{s}^{j}(\omega )+\left(\frac{3{\cos }^{2}\Theta -1}{2}\right)\frac{3{m}_{j}^{2}-{J}_{j}({J}_{j}+1)}{{J}_{j}(2{J}_{j}-1)}{\alpha }_{t}^{j}(\omega ).$$
(9)

Here, \({\alpha }_{s}^{j}(\omega )\) and \({\alpha }_{t}^{j}(\omega )\) are the scalar and tensor dynamic polarizabilities of level j, Θ is the angle of linear polarization (Θ = 0 for π-polarized light) and Jj and mj are the quantum numbers of the total angular momentum and its projection.

The (4s)2S1/2 state of Ca+ has only a scalar contribution to the polarizability which results in αS(ω) = 97.5 a.u.39 for a lattice laser wavelength of 789.0 nm.

The (3d)2D5/2(m = −5/2) state of Ca+ has both scalar and tensor contributions to the polarizability. With linearly π-polarized light, this state interacts only with high lying F states. The contribution of these states to the polarizability decays rather slowly such that all states up to the continuum need to be taken into account39. The polarizability of this state results in, αD(ω) = 4.44 a.u.39 at a lattice-laser wavelength of 789.0 nm. Small uncertainties in the linear lattice polarization at the level of 1 amount to  ~1% error in the D-state polarizability.

The low polarizability of the (3d)2D5/2(m = −5/2) state with linearly polarized light is comparable to the polarizability of the core electrons, \({\alpha }^{D,{\rm{core}}}=3.03\) a.u.39 for this state. The core contribution is almost identical in the (3d)2D5/2 and the (4s)2S1/2 states (\({\alpha }^{S,{\rm{core}}}=3.134\) a.u.39 in the S state). Therefore, in a spectroscopic experiment on the 2D5/2(m = − 5/2) ← 2S1/2(m = −1/2) transition, the measured ac-Stark shift has contributions mostly from the polarizability of the valence electron in both states,

$$\Delta {E}^{D\leftarrow S} =\left(\Delta {E}^{D}+\Delta {E}^{D,{\rm{core}}}\right)-\left(\Delta {E}^{S}+\Delta {E}^{S,{\rm{core}}}\right)\\ \approx \Delta {E}^{D}-\Delta {E}^{S}.$$
(10)

However, in a lattice-excitation experiment, the contribution to the ac-Stark shift from the atomic ion is due to both the core and valence electrons in the relevant state,

$$\Delta {E}_{2}^{0}\equiv \Delta {E}^{j,{\rm{lattice}}}=\Delta {E}^{j}+\Delta {E}^{j,{\rm{core}}}.$$
(11)

Ac-Stark shift calibration

The amplitude of the ac-Stark shift was determined from the Rabi-oscillation data (see, e.g., Fig. 3 of the main text) by comparison to a calibration experiment. In this calibration, the Ca+–N\({}_{2}^{+}\) Rabi-oscillation signal was simulated by exciting motion on a two-ion Ca+–N2H+ string with a well-defined ac-Stark shift amplitude applied on the atomic ion15. We used an N2H+ molecular ion for convenience due to its longer chemical lifetime. The mass difference of 1 u between N\({}_{2}^{+}\) and N2H+ amounts to only a small correction compared to other experimental errors.

In the calibration experiment, Ca+ was prepared in the \({(4s)}^{2}{S}_{1/2}\left(m=-1/2\right)\) state due to its large polarizability that allowed us to tune the desired ac-Stark shift. The ac-Stark shift was calibrated by a spectroscopic measurement on the \((3d){}^{2}{D}_{5/2}\left(m=-5/2\right)\leftarrow {}^{2}{S}_{1/2}\left(m=-1/2\right)\) transition of Ca+ and varied by changing the lattice-laser power. Six different ac-Stark shifts in the range 0.8−4.6 kHz were applied for generating the calibration data. The spectroscopically measured shifts were the combined shifts of both spectroscopic levels (Eq. (10)). However, since the lattice excitations were preformed in the \({}^{2}{S}_{1/2}\left(m=-1/2\right)\) state only, the \({}^{2}{D}_{5/2}\left(m=-5/2\right)\) contribution (Eq. (11)) was subtracted.

Subsequently, a lattice-excitation experiment was performed in which the ODF was applied for 3 ms with well-defined shifts on the Ca+–N2H+ system so that a Rabi-oscillation signal was obtained for each applied ac-Stark shift (Fig. 7). We used these Rabi-oscillation signals as a reference for the ac-Stark shift amplitudes generated in the experiments described in the main text. In order to extract the amplitude from Rabi-oscillation data with unknown ac-Stark shift, an interpolation between the six calibrated ac-Stark shifts was performed using a single parameter (the ac-Stark shift) fitting function (see details in the supplementary materials of ref. 15).

Fig. 7: Calibration measurements: Rabi-oscillation data from a two-ion Ca+–N2H+ string.
figure 7

The Ca+ ion is prepared in the (4s)2S1/2(m = −1/2) state with a well defined ac-Stark shift. The contribution of N2H+ to the excitation signal is corrected for iteratively (see text). The legend shows the second-iteration ac-Stark shift values including the contribution from N2H+. Error bars represent 1σ binomial uncertainties.

Another advantage of using N2H+ as opposed to N\({}_{2}^{+}\) for the calibration experiment besides the longer lifetime is that it has no strong transitions near 789 nm that could interfere with the calibration. There is, however, a residual force on the N2H+ due to highly detuned transitions in the molecule that must be taken into account (compare Fig. 5b and the associated discussion in the main text). Since the ac-Stark shift on N2H+, \(\Delta {E}_{{{\rm{N}}}_{2}{{\rm{H}}}^{+}}\) is small compared to the Ca+ shift, \(\Delta {E}_{{{\rm{Ca}}}^{+}}\), in the (4s)2S1/2(m = −1/2) state, it was neglected to first order. This zero-order fitting function was then used to extract the ac-Stark shift of N2H+ (Fig. 5). An approximate value of \(\Delta {E}_{{{\rm{N}}}_{2}{{\rm{H}}}^{+}}=-0.81\) kHz was obtained corresponding to  ~15.8% of \(\Delta {E}_{{{\rm{Ca}}}^{+}}=5.41\) kHz measured with the same power. This shift was then added to the calibration data for a more realistic fitting function which now includes the total shift from both Ca+ and N2H+. This procedure was iterated for a first-order estimate of the ac-Stark shift of N2H+. The first iteration changed the measured shift to \(\Delta {E}_{{{\rm{N}}}_{2}{{\rm{H}}}^{+}}=-0.93\) kHz corresponding to  ~18.1% of \(\Delta {E}_{{{\rm{Ca}}}^{+}}\). The second iteration yielded \(\Delta {E}_{{{\rm{N}}}_{2}{{\rm{H}}}^{+}}=-0.99\) kHz corresponding to  ~18.5% of \(\Delta {E}_{{{\rm{Ca}}}^{+}}\). Thus, any residual error in the fitting function after the second iteration was neglected.

 Figure 7 shows the results of the calibration experiments accounting for the effect of N2H+ excitation. The Ca+ and N2H+ shifts were added together to produce the effective shift as indicated in the figure legend since the lattice was red detuned for both the atomic and molecular ions and the calibration was preformed in the SPR configuration (Fig. 1b of the main text).

Ac-Stark shift of N\({}_{2}^{+}\) including hyperfine structure

The lattice-laser beam induced an ac-Stark shift on the molecular ion according to Eq. (8). This shift was calculated by summing up the contributions of the different transitions in the ro-vibrational band \({A}^{2}{\Pi }_{u}(v^{\prime} =2)\leftarrow {X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\),

$${\alpha }^{j}(\omega )=\sum _{k}\frac{2}{\hslash }\frac{{\omega }_{jk}}{{\omega }^{2}-{{\omega }_{jk}}^{2}}{\left|\langle k| {\boldsymbol{\mu }}| j\rangle \right|}^{2}.$$
(12)

Here, is the reduced Planck constant, ωjk are the transition angular frequencies40 and kμj2 is the squared transition-dipole matrix element calculated using a spherical-tensor-algebra approach41 using the value of the vibronic Einstein A coefficient taken from ref. 42. Here, the ground state j is the \({X}^{2}{\Sigma }_{g}^{+}(v^{\prime\prime} =0)\) vibronic state of N\({}_{2}^{+}\) which is adequately described by a Hund’s case (b) coupling scheme. The excited state k is the \({A}^{2}{\Pi }_{u}(v^{\prime} =2)\) vibronic state described by an intermediate Hund’s case (a)/Hund’s case (b) coupling scheme43. Hyperfine effects are included in the calculation of the dipole matrix element. The effect of mixing of states with different total angular momentum quantum number J by hyperfine interactions44 should only have a small effect on the ac-Stark shifts and was therefore not included in the calculations.

The contribution of additional vibrational bands in the \({A}^{2}{\Pi }_{u}(v^{\prime} \,\ne\, 2)\) excited state and of the \({B}^{2}{\Sigma }_{u}^{+}(v^{\prime} )\) electronic state were included. Here, due to the large detuning, only the rotationless transition frequencies were used45. The corresponding Einstein A coefficients were also taken from ref. 45.

The core polarizability of N\({}_{2}^{+}\) was estimated from a calculation of the polarizability of N\({}_{2}^{2+}\). The calculation was performed using Gaussian 09 (ref. 46) at the CCSD/aug-cc-pVQZ level of theory. The value of the polarizability was found to be \({\alpha }^{{{\rm{N}}}_{2}^{+},{\rm{core}}}\approx {\alpha }^{{{\rm{N}}}_{2}^{2+}}=7.23\) a.u. which corresponds to an ac-Stark shift of −390 Hz at our experimental parameters.