Entanglement-based dc magnetometry with separated ions

We demonstrate sensing of inhomogeneous dc magnetic fields by employing entangled trapped ions, which are shuttled in a segmented Paul trap. As \textit{sensor states}, we use Bell states of the type $\left|\uparrow\downarrow\right>+\text{e}^{\text{i}\varphi}\left|\downarrow\uparrow\right>$ encoded in two $^{40}$Ca$^+$ ions stored at different locations. Due to the linear Zeeman effect, the relative phase $\varphi$ serves to measure the magnetic field difference between the constituent locations, while common-mode fluctuations are rejected. Consecutive measurements on sensor states encoded in the $\text{S}_{1/2}$ ground state and in the $\text{D}_{5/2}$ metastable state are used to separate an ac Zeeman shift from the linear dc Zeeman effect. We measure magnetic field differences over distances of up to $6.2~\text{mm}$, with accuracies of around 300~fT, sensitivities down to $12~\text{pT} / \sqrt{\text{Hz}}$, and spatial resolutions down to $10~\text{nm}$. For optimizing the information gain while maintaining a high dynamic range, we implement an algorithm for Bayesian frequency estimation.


I. INTRODUCTION
Magnetic field sensors are ubiquitous in modern technology and applied and fundamental research. Various sensing technologies are available, covering different parameter regimes in terms of sensitivity, spatial resolution, bandwidth, and other parameters. While commonly used devices such as SQUIDs [1] are already based on quantum effects, recent advances in quantum technology bring genuine quantum sensors within the reach of applications. Magnetometers based on single well-isolated atomic systems or ensembles have been demonstrated, where the accumulated phase of a superposition state during an interrogation time T allows for inference of the ambient magnetic field. Typically, the choice of a sensing platform requires trading sensitivity versus spatial resolution, as ensemble-based systems are more accurate, but also have larger dimensions. Suitable ensemble systems include atomic vapors [2,3], ultracold atomic gases [4], and color centers in diamonds [5][6][7]. In contrast, single vacancy centers have been used for high-resolution imaging of magnetic fields [8]. For single superconducting quantum bits, high sensitivity has been achieved by harnessing strong coupling to magnetic fields [9].
A key parameter for quantum magnetic field sensing is the coherence time T 2 . For longer T 2 times, more phase can be accumulated during an experimental cycle, such that sensitivity scales as 1/ √ T 2 . Thus, it is crucial to achieve long coherence times while retaining the sensor functionality.
A well-established method for achieving long coherence times is dynamical decoupling [10], where the desired signal is spectrally separated from noise. However, this technique is restricted to measurements of alternating magnetic fields. Recently, dynamical decoupling with a single trapped ion has been used to demonstrate magnetometry in the radio-frequency range, attaining a few-pT/ √ Hz level of sensitivity [11,12]. For various applications, it is important to map out the spatial structure of ac magnetic fields [13,14].
Quantum entanglement can be harnessed to extend sensing capabilities [15,16]. Entangled Greenberger-Horne-Zeilinger or NOON states can in principle yield a sensitivity beyond the standard quantum limit [17][18][19]. However, an increased sensitivity also implies an increased noise-induced decoherence [20]. Hence, the beneficial effect of entanglement is generally compromised unless measurement schemes are designed to reject noise in favor of the desired signal. With trapped ions, entangled sensor states of the type |↑↓ + e iϕ |↓↑ / √ 2 have been employed to measure the magnetic dipole interaction between the constituents' valence electrons [21].
In this manuscript, we present a sensing scheme for magnetic fields, where entangled ions are moved to different locations x 1 and x 2 along the trap axis of a segmented linear Paul trap. The dc magnetic field difference ∆B(x 1 , x 2 ) between the ion locations can be inferred from the phase accumulation rate of these sensor states via the linear Zeeman effect Since the net magnetic moment of the two constituent ions vanishes, common-mode noise is rejected such that the T 2 time exceeds 20 s [22]. The long coherence time and the fine-positioning capabilities offered by trapped ions enables us to operate in a parameter regime which could previously not be accessed: We sense dc field differences at around 300 fT accuracy and few-pT/ √ Hz sensitivity, with spatial resolution down to the few-nanometer range.
In Sec. II, we describe the procedure for measuring the relative phase ϕ of sensor states, apply it to determine phase accumulation rates ∆ω(x 1 , x 2 ) in Sec. III, and discuss the limitations in Sec. IV. An efficient measurement scheme utilizing Bayesian frequency estimation is presented in Sec. V. Finally, in Sec. VI, we extend our sensing scheme to infer both dc and ac magnetic field differences from the measured phase accumulation rates.

II. EXPERIMENTAL PROCEDURE
We trap two 40 Ca + ions in a segmented linear Paul trap [23], featuring 32 control electrode pairs along the trap axis x. The distance between the center of neighboring electrodes is 200 µm. A quantizing magnetic field at an angle of 45 • to the trap axis is created by Sm 2 Co 17 permanent magnets, splitting the ground state Zeeman sublevels |↓ ≡ S 1/2 , m j = − 1 2 and |↑ ≡ S 1/2 , m j = + 1 2 by about 2π · 10.4 MHz. The trap setup is shielded from ambient magnetic field fluctuations by a µ-metal magnetic shielding enclosure, yielding a coherence time of about 300 ms [24] in a Ramsey-type experiment.
Laser cooling, coherent spin manipulations and readout [25] take place in the laser interaction zone (LIZ) of the trap (Fig. 1). An experimental cycle starts with Doppler laser cooling a two-ion crystal on the S 1/2 ↔ P 1/2 cycling transition near 397 nm. All collective modes of vibration of the ion crystal in radial direction are cooled close to the motional ground state via resolved sideband cooling on the stimulated Raman transition between |↑ and |↓ . State initialization to |↑↑ is achieved via frequency-selective pumping utilizing the narrow S 1/2 ↔ D 5/2 quadrupole transition near 729 nm.
Then, we carry out an entangling gate operation [26], where a spin-dependent optical dipole force is applied to transiently displace the ions in phase space only if the spins are aligned in parallel. To provide spin-motion coupling to the transverse vibrational modes, we direct two orthogonally propagating laser beams to the trap, detuned by 2π · 300 GHz from the cycling transition, such that the difference wave vector is aligned orthogonally to the trap axis. The entangling gate generates a Bell state (|↑↑ + |↓↓ ) / √ 2. A subsequent π/2-pulse is applied to acquire the sensor state (|↑↓ + |↓↑ ) / √ 2, reaching a fidelity of 99.3 (5)%.
For the subsequent operations, the two-ion crystal is separated [27,28]. Ion movement along the trap axis is controlled by applying time-dependent voltages on individual trap electrodes via a fast multichannel arbitrary waveform generator at update rates of up to 2.5 MSamples/s [29]. After separation, the ions are shuttled to the desired locations x 1 and x 2 with a maximum distance of 6.2 mm. The ions are kept at these locations for an interrogation time T . Any inhomogeneity of the magnetic field leads to the accumulation of a phase ϕ(x 1 , x 2 , T ) according to Eq. 1, resulting in the state |↑↓ + e iϕ |↓↑ / √ 2. After the interrogation time T , both ions are consecutively moved back to the laser interaction zone for spin readout. There, a pair of co-propagating laser beams drives local spin rotations in order to measure the spin along a given basis. Then, population in the state |↑ is selectively transferred for each ion via laser-driven rapid adiabatic passage to the metastable D 5/2 state, followed by conditional detection of resonance fluorescence via a photomultiplier tube while driving the cycling transition (see Fig. 1

inset).
Rather than fully reconstructing the quantum state by measuring in 9 different bases, we reduce the number of required measurements by parameterizing the density matrix describing the spin state of the two ions aŝ in the logical basis {|↑↑ , |↑↓ , |↓↑ , |↓↓ }, with the parity contrast 0 ≤ C ≤ 1. This form relies on the assumption of balanced populations in the states |↓↑ and |↑↓ , which requires that only dephasing and spin rotations about the Z axes take place after state preparation. To infer the phase ϕ and contrast C, it is sufficient to measure the parity of the two operatorsX 1X2 andX 1Ŷ2 . Thus, upon measuring the operators {X 1X2 ,X 1Ŷ2 } each {N, M } times, ϕ and C are determined from the number of events {n, m} where the state has been projected to either |↑↑ or |↓↓ . As described in Appendix A, the phase ϕ and contrast C are extracted from the parity results via maximum likelihood estimation. Using numerical simulations, we have confirmed that within the parameter regime and significance level of our measurements, the employed phase estimation method is robust against population imbalance and population leakage to even states.

III. PHASE ACCUMULATION MEASUREMENTS
To determine the phase accumulation rate ∆ω(x 1 , x 2 ) of the sensor state with both high sensitivity and high dynamic range, a measurement scheme is required that takes the 2π-ambiguity of phase measurements into account [30]. In a straightforward incremental approach, we consecutively perform phase measurements at slowly increasing, predefined interrogation times. A linear fit reveals the phase accumulation rate ∆ω(x 1 , x 2 ) and a phase offset ϕ 0 (x 1 , x 2 ), which arises from ion movement in an inhomogeneous magnetic field. For each phase measurement, the result is incremented or decremented by multiples of 2π until it falls within a range of ±π to the previously determined fit function. To check if the phase has been incremented or decremented properly, we verify that the residuals of all points are well below π. Figure 2 shows an example measurement at maximum ion distance d = 6.2 mm and the residuals δϕ for each point. In this measurement, phases of over 40 000 rad have been accumulated during interrogation times of up to T max = 1.5 s, but the residuals |δϕ| of all measurement points are well below π.
The maximum wait time T max is ultimately limited by the coherence time T coh of the sensor state. For best sensitivity, it is desired to choose T max = T coh /2 [7]. The coherence time is therefore analyzed in the following sec- tion.

IV. COHERENCE TIMES
We characterize the coherence time T coh of the sensor state for two settings: (i) The ions are kept in a common harmonic potential well at a distance of about 4.2 µm, and (ii) for the maximum possible distance of 6.2 mm. The coherence time is inferred from measurements of the contrast C for varying interrogation times T . For each interrogation time, we repeat the experimental procedure 400 times for each of the two measurement operators.
For case (i), a coherence time T coh > 12.5 s is observed (Figure 3a). In this regime, residual heating of the radial modes of motion compromises the fidelity of electron shelving, and therefore the spin readout. In a separate measurement, we confirmed that the contrast loss is entirely caused by loss of spin readout fidelity.
For the maximum possible ion distance, a coherence time in the 1−2 s range has been obtained. The observed coherence loss is presumably caused by a slow drift of the magnetic field inhomogeneity along the trap axis over time, which can be caused by magnetization changes of the permanent magnets, or by movement of the ion trap relative to the magnets. Figure 3b displays these drifts over 6 hours, consecutively measured for two different ion separation distances of d = 6.2 mm and d = 3.2 mm.

V. BAYESIAN FREQUENCY ESTIMATION
In order to speed up the incremental scheme for determining ∆ω(x 1 , x 2 ) described in Sec. III, we dynamically update the interrogation time T for each phase measurement based on previous results. To choose interrogation times that maximize the information gain per measurement cycle, we implement a Bayesian algorithm for frequency estimation [31,32].
In Bayesian statistics, for a given phase measurement to be carried out, the combined result of all previous measurements is expressed with the prior probability distribution function (PDF) p (∆ω, ϕ 0 ). Initially, we assume a uniformly distributed prior PDF, limited to a reasonable parameter range ∆ω ∈ {∆ω min , ∆ω max } and ϕ 0 ∈ {−π, π}. After a phase measurement with the outcome {n, m}, the combined result is described by the posterior PDF with the update function p (n, m|∆ω, ϕ 0 ; T ), given by the likelihood function, and the marginal PDF p (n, m|T ) (see Appendix B). The interrogation time T for each phase measurement is calculated such that the expected increase of the Shannon information in the posterior PDF is maximized (see Appendix C). With this approach, we observe the automated measurement operate in two distinct measurement regimes: The measurement starts in the capture regime, where T is consecutively increased from T = 0 to the desired maximum time T max in order to unambiguously identify ∆ω without any previous information on its value. Then, in the tracking regime, the algorithm alternates T between T max and T = 0 for best sensitivity. In order to efficiently track drifts of ∆ω, we intentionally cause a 'memory loss' by broadening the prior PDF by about 5% of its width for tracking phase measurements at T max . This facilitates the determination of frequencies which deviate from the previous mean value. Figure 4 visualizes an example measurement. In Fig.  4a, the update functions of the first phase measurements in the capture regime are shown. It can be seen that a single phase measurement alone is not sufficient to estimate ∆ω. However, the combined result of multiple phase measurements yields an approximate Gaussian marginal distribution of ∆ω, from which the mean value ∆ω and the standard error ∆ω err are inferred. Fig. 4b depicts the interrogation time T for each experimental cycle and the standard errors of the results, versus the total elapsed time of the measurement. The maximum interrogation time is reached after about 12 minutes, which is about 10 times faster than in the incremental measurement scheme.
In the tracking regime, the precision limit given by the magnetic field inhomogeneity drift rates and the coherence time is reached, and a minimum error of ∆ω err = 2π · 2.5 mHz is obtained. Now, the uncertainty after each measurement is no longer reduced, but the parameter estimates are corrected for drifts, see Fig. 4c.
The shot-noise limited sensitivity describes the minimal frequency change that can be discriminated within unit time: with the standard error of the frequency measurement ∆ω err , that has been achieved during a total experimental time of T tot [33]. As the sensitivity depends on the

FIG. 5. Frequency differences to the laser interaction zone (LIZ).
A sensor state is prepared, and the probe ion is moved to an arbitrary desired position. At the same time, the reference ion is either moved to (a) segment 1 or (b) segment 32 to maximize the ion distance. The results for each segment are shown in (c). In (d), high precision measurements close to the LIZ yield standard errors for the ion position and frequency difference of about 10 nm and 2π · 10 mHz, respectively.
chosen interrogation time, we calculate S ω separately for each phase measurement, only taking prior knowledge of the phase offset ϕ 0 into account. At an ion distance of d = 800 µm, a best sensitivity of S ω = 2π· 116 mHz/ √ Hz is obtained for an interrogation time of T max = 3.0 s. At this interrogation time, we obtained a mean contrast C of about 0.94 and an average duration of 3.3 s for a single experimental cycle, i.e. about 91% of the measurement time has been utilized for phase accumulation. Thus, we reach 79% of the theoretical standard quantum limit of 1/ √ T max = 2π · 92 mHz/ √ Hz. Our results are on par with recent measurements of ac magnetic fields with single ions [11], only surpassed by sensors with larger dimensions [2,7].
We utilize our measurement scheme to map the frequency difference ∆ω to the laser interaction zone (segment 20) along the trap axis. We perform a frequency measurement for each trap segment, where we move one ion, the probe ion to the desired segment, and the second reference ion to either segment 1 if the probe ion is being moved to segments 20 − 32, or to segment 32 if the probe ion is being moved to segments 1 − 20 ( Fig. 5a and  5b). This way, the ion distance is sufficiently large such that the trapping potential of the reference ion does not affect the probe ion position at the given level of accu- rary and vice versa. The results are depicted in Fig. 5c. In Fig. 5d, additional measurements close to the laser interation zone are shown, allowing to infer frequency gradients with high precision. For reaching spatial resolutions of about 10 nm, the probe ion position has been calibrated via an EMCCD camera.

VI. SEPARATION OF DC AND AC ZEEMAN SHIFTS
In addition to the static Zeeman effect (Eq. 1), an additional energy shift is caused by the ac Zeeman effect due to oscillating magnetic fields. In our experimental setting, such oscillating fields are generated by the charging/discharging currents of the radiofrequency (rf) electrodes of the Paul trap. In an ideal symmetric trap, the equilibrium positions of the ions are located on the nodal line of the rf field, where also the magnetic fields cancel out. However, residual displacement from the rf node gives rise to a position-dependent frequency shift between the populated magnetic sublevels of a given electronic state [34,35] Here, x is the ion position along the trap axis, B rf,⊥ (x) is the component of the oscillating magnetic field perpendicular to the static quantizing magnetic field, Ω rf = 2π · 33 MHz is the trap drive frequency, and ν(x) denotes the total (angular) frequency splitting between neighboring (|∆m j | = 1) Zeeman sublevels. For sensor states encoded in different electronic state manifolds, the respective Landé factors lead to different contributions to the total phase accumulation rates from dc and ac fields. Hence, by encoding entangled sensor states within different electronic states of 40 Ca + , our sensing scheme is extended to distinguish between ac and dc magnetic fields. We utilize the m j = ±5/2 sublevels of the metastable D 5/2 state in addition to the S 1/2 ground state for frequency-difference measurements. We prepare the sensor state |+5/2, −5/2 + |−5/2, +5/2 by first preparing the state |↑↓ + |↓↑ , and then transfer-ring the populations of both ions to the respective sublevels of the D 5/2 metastable state, i.e. |↑ → |+5/2 and |↓ → |−5/2 (Fig. 6a). The population transfer is carried out via composite inversion laser pulses near 729 nm [36]. Considering the Landé factors of both states g S = 2.00225664(9) [37] and g D = 1.2003340(3) [38], the D 5/2 sensor state features phase accumulation rates which are increased by a factor of 3. However, spontaneous decay at a rate of 1/τ per ion has to be taken into account, with a time constant of about τ = 1.17 s [39]. We employ an additional fluorescence detection step before state readout to reject measurements where at least one ion has decayed from the D 5/2 state. Beyond wait times of τ /2, this postselection reduces the sensitivity of the measurement (Fig. 6b).
As the measured differential phase accumulation rates ∆ω S (x 1 , x 2 ) and ∆ω D (x 1 , x 2 ) of the respective S 1/2 and D 5/2 sensor states are affected differently by the static dc Zeeman effect and the ac Zeeman shift, we can infer the magnetic field difference via (see Supplemental material The differential ac Zeeman shift between the constituent ions of the S 1/2 sensor state is given by Here, χ = ∆ω S (x 1 , x 2 ) denotes the ratio of the differential ac Zeeman shifts pertaining to the D 5/2 and S 1/2 sensor states. Under the approximation that the magnetic field inhomogeneity is small compared to the absolute magnetic field, i.e. the energy splittings ν S (x) and ν D (x) of the respective electronic states are constant along the trap axis, χ is calculated via This approximation is well fulfilled in our experimental setup. Experimentally, we measure the phase accumulation rates ∆ω S (x 1 , x 2 ) and ∆ω D (x 1 , x 2 ) by performing alternating experimental cycles on the S 1/2 and D 5/2 sensor states. The respective interrogation times T S and T D are individually determined by the Bayesian algorithm. Additional measurements on a single ion at the laser interaction zone are employed to determine the transition frequencies ν S (x LIZ ), ν D (x LIZ ), and the absolute ac Zeeman shift ω  S,err = 2π·0.2 Hz are reached. Compared to recent measurements of the ac Zeeman shift arising from microwave fields [14], this is a 1000-fold improvement in accuracy. Thus, our measurement technique may be used to improve the fidelity of microwave-driven quantum gates, where precise mapping of the ac Zeeman shift is important.
For dc magnetic field differences, we attain sensitivities down to S B = 12 pT/ √ Hz at interrogation times of T S = 1.50 s and T D = 0.48 s. Accuracies as good as ∆B (stat) err = 310 fT are reached at an ion distance of d = 800 µm.

VII. CONCLUSION AND OUTLOOK
We have demonstrated a novel magnetometry scheme harnessing entangled ions, which are freely positioned in a segmented Paul trap. The long coherence time of the entangled states enable precise measurement of dc magnetic field differences. Our measurement scheme additionally characterizes the position-dependent ac Zeeman effect due to the rf trap drive in Paul traps, which is a hard-to-characterize source of errors for precision measurements in frequency standards. For recent optical clocks, the ac Zeeman shift contributes to the fractional error in the 10 −20 -10 −17 range [40][41][42].
Precise knowledge of the magnetic field along the trap axis is essential for a shuttling-based approach towards scalable quantum information experiments in Paul traps. In this approach, quantum algorithms are carried out with multiple ions residing at different trap segments, where different phases are accumulated. These phases have to be taken into account within the computational sequences [43].
With the presented measurement technique, it will be feasible to characterize the magnetic field of objects close to or inside the trap volume, such as neutral atoms trapped by optical dipole forces, or additional trapped ions [44]. The current limitation of our magnetometry scheme is given by magnetic field drifts, which can be mitigated by using a spatially homogeneous quantizing magnetic field and temperature-stabilized permanent magnets.

ACKNOWLEDGMENTS
We acknowledge former contributions of Claudia Warschburger and helpful discussions with Georg Jacob, Arne Wickenbrock and Lykourgos Bougas. We further acknowledge support from the DFG through the DIP program (Grant No. SCHM 1049/7-1) and the Bundesministerium für Bildung und Forschung via IKT 2020 (Q.com). The research is based upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via the U.S. Army Research Office grant W911NF-16-1-0070. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the view of the U.S. Army Research Office.
Appendix A: Contrast and phase estimation As explained in Sec. II, the outcome of a measurement at a chosen interrogation time T is described by the parity of the projected state. Assuming the stateρ (Eq. 2), the probabilities to detect even parity for theX 1X2 and X 1Ŷ2 measurements are given by (1 + C sin (ϕ)) , whereP E = |↑↑ ↑↑| + |↓↓ ↓↓| is the projector onto the subspace of even spin configurations, andR X/Y,i (θ) represent single qubit rotations by angle θ on ion i = 1, 2 prior to readout. The readout is dichotomic in terms of even/odd spin configurations, and the measurements are independent. Probing operators {X 1X2 ,X 1Ŷ2 } each {N, M } times, the probability to observe {n, m} even spin configurations for given parameters (ϕ, C) is given by binomial statistics: is approximately χ 2 -distributed, such that 68.3%confidence intervals can be obtained via R(ϕ, C ) ≤ 1 for ϕ and R( ϕ , C) ≤ 1 for C.

Appendix B: Bayesian statistics
In Bayesian statistics, the result after each phase measurement is described by the posterior PDF p (∆ω, ϕ 0 |n, m; T ) (Eq. 3). The update function is given by p (n, m|∆ω, ϕ 0 ; T ) = 1 0 L (n, m; ϕ(∆ω, ϕ 0 ; T ), C) dC (B1) For each parameter set (∆ω, ϕ 0 ), the accumulated phase after the interrogation time T is given by ϕ(∆ω, ϕ 0 ; T ) = ∆ω · T + ϕ 0 (B2) Due to the phase periodicity, the update function features a 2π/T periodicity in ∆ω. However, if the width of the prior PDF is smaller than the periodicity of the update function, the periodicity is not inherited by the posterior PDF. After at least two phase measurements at different interrogation times, the posterior PDF is well described by a two-dimensional normal distribution. To obtain estimates for ∆ω and ϕ 0 , we calculate expectation values from the marginalized PDF: