## Abstract

Demonstration of coherent control and characterization of the control fidelity is important for the development of quantum architectures such as nuclear magnetic resonance (NMR). We introduce an experimental approach to realize universal quantum control, and benchmarking thereof, in zero-field NMR, an analog of conventional high-field NMR that features less-constrained spin dynamics. We design a composite pulse technique for both arbitrary one-spin rotations and a two-spin controlled-not (CNOT) gate in a heteronuclear two-spin system at zero field, which experimentally demonstrates universal quantum control in such a system. Moreover, using quantum information–inspired randomized benchmarking and partial quantum process tomography, we evaluate the quality of the control, achieving single-spin control for ^{13}C with an average fidelity of 0.9960(2) and two-spin control via a CNOT gate with a fidelity of 0.9877(2). Our method can also be extended to more general multispin heteronuclear systems at zero field. The realization of universal quantum control in zero-field NMR is important for quantum state/coherence preparation, pulse sequence design, and is an essential step toward applications to materials science, chemical analysis, and fundamental physics.

## INTRODUCTION

Zero-field nuclear magnetic resonance (NMR) is an alternative magnetic resonance modality in which nuclear spin information is measured in the absence of applied magnetic field (*1*–*5*) and serves as a complementary analysis tool to conventional high-field NMR. Zero-field NMR experiments regularly achieve nuclear spin coherence times longer than 10 s without using dynamical decoupling pulse sequences, which provides ultrahigh frequency resolution spectroscopy with demonstrated linewidth down to 20 mHz (*6*, *7*). While at high field, the spins are coupled more strongly to the magnetic field than to each other, at zero field the spins are strongly coupled to each other by spin-spin interactions. Significantly, at zero field, the spin-spin couplings are not truncated in an anisotropic way as they are in conventional NMR. This means that zero-field NMR can measure certain spin-dependent interactions (*8*, *9*), which are not generally accessible in high-field NMR experiments.

Compared with high-field NMR, spins with different gyromagnetic ratios all have identical (zero) Larmor frequency at zero field, and thus individual manipulation of different spin species presents a challenge and limits the possible applications of zero-field NMR. Previous examples of coherent isotropic averaging pulse sequences in zero-field NMR have been limited to the homonuclear case (*10*). More recent pulse sequences for heteronuclear spin systems (*11*–*13*) have been limited by the inability to generate independent arbitrary rotations for different spins. Here, we experimentally demonstrate and quantify the fidelity of universal quantum control of a spin system composed of two coupled heteronuclear spins at zero magnetic field. We use a composite sequence to rotate one of the two spins by a desired angle and to cancel the accumulated rotation angle of the other (*14*). On the basis of this, we realize single-spin control for ^{13}C and ^{1}H and two-spin control via a controlled-not (CNOT) gate in ^{13}C-formic acid (^{1}H-^{13}COOH, where the acidic proton is neglected due to rapid exchange). Although the ^{13}C-^{1}H system is one of the simplest cases to achieve nuclear spin control, our approach can be, in principle, extended to more general multispin heteronuclear systems (*14*). Identifying the dominant errors in zero-field NMR is particularly important for improving quantum control performance. To estimate the fidelity of the single-spin control, we adopt a quantum information–inspired randomized benchmarking method (*15*–*18*). We implement state tomography at zero field for determining the quantum state of nuclear spins (*19*). By performing partial quantum process tomography (*20*–*22*), we characterize the performance of the CNOT gate using a constrained fitting technique.

## RESULTS

### Spin system at zero magnetic field

A liquid-state *n*-spin system at zero magnetic field can be described by the Hamiltonian *J*_{ij} is the strength of the scalar spin-spin coupling (*J* coupling) between the *i*th and *j*th spins, **I**_{i} is the spin angular momentum operator of the *i*th spin, and the reduced Planck constant is set to one. We experimentally demonstrate feasibility of our nuclear spin control scheme by using ^{13}C-formic acid (Fig. 1A), a convenient heteronuclear two-spin system. At zero magnetic field, the eigenstates of a two-spin 1/2 system are most conveniently defined in terms of the total angular momentum **F** = **I**_{1} + **I**_{2}, yielding a singlet state with **F** = 0 and three degenerate triplet states with **F** = 1 (section S1). The frequency separation (*J*) between the singlet state and the triplet states is ~222.2 Hz. This frequency sets the time scale in which precise magnetic field pulses can be applied: *J*τ_{p} ≪ 1, where τ_{p} is the pulse duration. In our system, τ_{p} = 50 μs, so *J* coupling can be considered negligible during magnetic field pulses.

High-fidelity nuclear spin control also requires long coherence times. The nuclear spin singlet state is antisymmetric with respect to exchange, and it cannot evolve into symmetric states under the symmetric intramolecular dipole-dipole interaction (*23*). For this reason, the lifetime of a nuclear spin singlet state can be long. The singlet state lifetime of the ^{13}C-formic acid sample used in our experiment is measured to be 16.7 s. While homonuclear singlets are long-lived at arbitrary fields, this holds for heteronuclear systems only in near-zero fields (*7*), where the lifetime of the singlet-triplet coherence can also be enhanced (*24*). The lifetime of the singlet-triplet coherence observed in our experiment is *T*_{2} = 10.3 s, as shown in Fig. 1A. We can therefore implement numerous coherent operations: nearly 10^{5} single-spin operations or 10^{4} two-spin operations. This is also useful for molecular structure determination and fundamental physics, as it permits high-resolution measurement of minute frequency differences and precise determination of coupling constants.

We perform our experiments using an apparatus similar to that of Theis *et al.* (*3*), Tayler *et al.* (*5*), and Ledbetter *et al.* (*25*), which is schematically shown in Fig. 1B. Details of the experimental setup are described in Materials and Methods. We polarize nuclear spins in the NMR sample in a permanent Halbach magnet (*B*_{pol} = 1.8 T), after which we shuttle the sample into a magnetically shielded region, such that the bottom of the sample tube is ~1 mm above a rubidium vapor cell of an atomic magnetometer (*26*, *27*). We apply a guiding magnetic field (*B*_{guid} ~3 × 10^{−5} T) during the transfer and turn it off after the sample reaches the zero-field region. The initial spin magnetization then evolves under the *J*-coupling interaction between the nuclei, which generates an oscillating magnetization signal along *z* and is detected with a rubidium atomic magnetometer.

The way that the guiding field is switched to zero plays a crucial role in determining the initial state and, in turn, the amplitude and phase of the oscillating magnetization signal produced. There are two limiting cases, which correspond to sudden and adiabatic changes that for brevity we call the “sudden” and “adiabatic” states, respectively (*7*). It should be pointed out that the state mentioned here is not a pure quantum state, but a mixed state, which is a statistical ensemble of pure states and is described with a density matrix ρ (*28*, *29*). When the guiding field *B*_{guid} is turned off within 10 μs, the state of the two-spin system, ^{13}C (**S**) and ^{1}H (**I**), remains the high-field equilibrium state ρ = exp(−*H*_{z}/*k*_{B}*T*)/Tr[exp(−*H*_{z}/*k*_{B}*T*)]. Here, *H*_{z} = −*B*_{pol}(γ_{I}*I*_{z} + γ_{S}*S*_{z}), γ_{I} and γ_{S} are the gyromagnetic ratios of the respective spins, *k*_{B} is the Boltzmann constant, *T* is the temperature of the sample, and *I*_{z} and *S*_{z} are the *z* components of the spin operators. In the high-temperature (low-polarization) approximation, ρ = [**1** + (γ_{I}*B*_{pol}*I*_{z}*/k*_{B}*T*) + (γ_{S}*B*_{pol}*S*_{z}*/k*_{B}*T*)]/4, which is the sudden state. On the basis of the experimental parameters, γ_{I}*B*_{pol}*/k*_{B}*T* ≈ 1.2 × 10^{−5} and γ_{S}*B*_{pol}*/k*_{B}*T* ≈ 3 × 10^{−6}. Alternatively, when we turn off the guiding field slowly the populations at high field are converted to the populations of the zero-field eigenstates. Thus, an ideal adiabatic state has the form ρ = **1**/4 + [(*I*_{z} + *S*_{z})(γ_{I} + γ_{S})*B*_{pol}*/*8*k*_{B}*T*] − [(*I*_{x}*S*_{x} + *I*_{y}*S*_{y})(γ_{I} − γ_{S})*B*_{pol}*/*4*k*_{B}*T*]. We achieve an adiabatic transition by decreasing the guiding field gradually, as a decaying exponential with time constant 1 s.

We perform state tomography to characterize the initial state (density matrix) mentioned above. The complete form of the density matrix ρ of a two-spin system can be expressed in the Pauli basis as ρ = **I**·*V*·**S**, where **I** = [*I*_{x}, *I*_{y}, *I*_{z}], **S** = [*S*_{x}, *S*_{y}, *S*_{z}]^{T}, and *V* is a 4 × 4 matrix that represents the coefficients of the term *I*_{ν}*S*_{μ} (ν, μ = 0, 1, 2, 3). The superscript *T* refers to transpose of the matrix. State tomography consists of measuring the matrix *V*, or the coefficients of the 15 nontrivial *I*_{ν}*S*_{μ} terms (*I*_{0}*S*_{0} = **1** is an identity matrix). Details of the measurement procedure can be found in section S2. We give a brief summary in this study. The coefficient of *I*_{ν}*S*_{μ} can be extracted by measuring both the phase and amplitude of the oscillating magnetization signal generated from its evolution under the *J* coupling. Since our magnetometer is sensitive to the magnetic field along the *z* axis, only the *z* component of the magnetization signal is detected. On the basis of table S1, which shows the evolutions of *I*_{ν}*S*_{μ} under *J* coupling, there are only four terms, *I*_{z}, *S*_{z}, *I*_{x}*S*_{y}, and *I*_{y}*S*_{x}, that can generate oscillating magnetization signal along the *z* axis. We could only measure the coefficients of the other terms after applying additional operations and to transform them into one of the four observable terms, for example, *S*_{x} becomes *S*_{z} by applying π/2 rotation on ^{13}C along the *y* axis. Because all four observable terms can generate signals along the *z* axis, it is impossible to determine the coefficient for each of them with a single measurement. Considering this, we obtain each coefficient by averaging four independent measurements. For each measurement, a pulse sequence is specially designed to change the signs of some coefficients, while having no effect on the sign of the coefficient we need to measure. The signal amplitude in the averaged spectrum is then proportional to the coefficient to be measured and independent of all others. The specific pulse sequences are summarized in table S2. Figure 1 (C and D) shows the experimental results for the optimized sudden and adiabatic states, which are displayed in the Pauli basis of a two-spin system. The overlap with the theoretically expected initial states defines fidelities of *f* = 0.99(1) for the sudden state and *f* = 0.97(2) for the adiabatic state. The lower fidelity for the adiabatic state is attributed to the influence of different relaxation rates for the singlet and triplet states (*7*).

### Single-spin control

For two spins at zero magnetic field, the available external controls of nuclear spins are magnetic field pulses along *x*, *y*, and *z* with the Hamiltonians *H*_{η} = −*B*_{η}(γ_{I}*I*_{η} + γ_{S}*S*_{η}), η = *x*, *y*, *z*. For ^{1}H and ^{13}C, the gyromagnetic ratios allow for manipulation of spin **S** (^{13}C) by a π pulse while leaving spin **I** (^{1}H) effectively unchanged _{I}/γ_{S} ≈ 4. An arbitrary rotation of one of the spins, for example, **I**, can be realized by a pulse sequence that begins by rotating the spin **I** by half of the desired angle, as shown in the top panel of Fig. 2A. This also rotates the spin **S** by some angle. Next, a π pulse is applied to the spin **S**, and then the second half rotation is applied to the spin **I**, followed by a π pulse on the spin **S**. With this sequence, the phases accumulated by the spin **S** in the two halves of the rotation cancel. This is also valid for arbitrary rotations of the spin **S**, except that the second half rotation is along the opposite direction, as shown in the lower panel of Fig. 2A. A more detailed description of the implementation of the single-spin control is included in section S3. Notably, previous theoretical work has shown that for any set of coupled spins, it is possible to perform an even number of π rotations for all spins except for one, which undergoes an odd number of π rotations (*14*). Therefore, this approach can be, in principle, extended to multispin heteronuclear systems.

We show the experimental realization of arbitrary individual spin rotations for ^{13}C and ^{1}H in ^{13}C-formic acid in Fig. 2B. The amplitude of the magnetic field pulse is calibrated by experiments similar to that of Emondts *et al.* *7*. The individual pulse is τ_{p} = 50 μs. We initially prepared the ^{13}C-^{1}H nuclear spin system in the adiabatic state. A single magnetic field pulse along *x* with amplitude *B*_{x} produces *z* magnetization with amplitude proportional to (cosθ_{S} – cosθ_{I}), where θ_{S,I} *=* γ_{S,I}*B*_{x}τ_{p}, which we detect with the atomic magnetometer. The dependence of the magnetization signal amplitude on the magnetic field pulse amplitude along *x* is shown in the top panel of Fig. 2B. An individual rotation of ^{13}C results in *z* magnetization proportional to (cosθ_{S} – 1). As previously discussed, individual rotation of ^{13}C means that rotation is performed only on ^{13}C spins while doing nothing (an identity operation) on ^{1}H spins. Similarly, for ^{1}H, the *z* magnetization is proportional to (1 – cosθ_{I}). The evolution under the corresponding selective pulse sequence for ^{13}C and ^{1}H is shown in the middle and the bottom panels of Fig. 2B, respectively. Our results (Fig. 2B) agree with the theoretical analysis.

To estimate the fidelity of the single-spin control, we adopt the Clifford-based randomized benchmarking method. The randomized benchmarking pulse sequences are shown in Fig. 2C. The sudden state is selected as the initial state, as it only contains two components in the Pauli basis (*I*_{z} and *S*_{z}). To measure the coefficient of *S*_{z} independently, we adopt the same temporal averaging method as the state tomography (see Fig. 2C). The signals acquired using four different independent pulse sequences (readout operations), *P* = *e*^{±iπA} and C = *e*^{±i(π/2)B} are applied for each sequence length *m*, where the Clifford gates are realized by combined operations *PC*. Here, *A* ∈ {**1**, *S*_{x}, *S*_{y}, *S*_{z}} and *B* ∈ {*S*_{x}, *S*_{y}, *S*_{z}}. The recovery operation *R* is chosen to return the system to the initial state in the absence of control error. Measuring the decay of the coefficient of *S*_{z} with respect to the number (*m*) of randomized Clifford gates in the benchmarking sequence yields the average fidelity for ^{13}C single-spin control. By averaging the coefficients of *S*_{z} over *k* different randomized benchmarking sequences with the same length *m*, and normalizing this averaged value to that of *m* = 0, the normalized signal *d*_{if} is due to the imperfection of the state initialization and readout, and ϵ_{g} is the average error per Clifford gate (*15*, *16*). We generate *k* = 32 random sequences for each *m*. As shown in Fig. 2D, the randomized benchmarking results yield an average error per Clifford gate ϵ_{g} = 0.0040(2), and an imperfection of the state initialization and readout *d*_{if} = 0.0141. The average fidelity for ^{13}C single-spin control is *f*_{avg} = 1 − 0.0040(2) = 0.9960(2), which is resilient to the state preparation and measurement errors.

In general, we can classify errors in the control of quantum systems into three categories: unitary, decoherent, and incoherent errors (*30*). For our experiment, it is the unitary error which comes from pulse imperfections (amplitude miscalibration and direction misalignment) that principally limits the single-spin control fidelity. We can neglect the decoherent error considering that the coherence time of our system is substantially longer than the entire duration of the sequence. The incoherent error comes mainly from the pulse-field inhomogeneity, which we measure to be ~ 0.2% (fig. S2) over the sample volume. We estimate the incoherent error to be about 10^{−5} per operation—much smaller than the experimentally measured average error. It is worth noting that the error caused by pulse-field inhomogeneity in our zero-field NMR experiments is smaller than that in the conventional high-field NMR case (*17*). This is because a large ratio between the pulse coils diameter and the effective sample volume is possible. Moreover, we calculate the error caused by the slight deviation of γ_{I}/γ_{S} = 3.977(2) from 4 to be ~ 0.0006 (section S3), which may be neglected.

### Two-spin control

A sufficient condition for universal quantum control of a nuclear spin system is the combination of arbitrary single-spin control and a two-spin control via a CNOT gate. The conventional way to generate a CNOT gate is to use the *I*_{z}*S*_{z} (Ising) interaction combined with single-spin operations (*31*). However, at zero magnetic field, the scalar spin-spin coupling retains the *I*_{x}*S*_{x}, *I*_{y}*S*_{y}, and *I*_{z}*S*_{z} terms. An effective *I*_{z}*S*_{z} interaction can be realized by implementing the pulse sequence *Jt*_{p}. As discussed in the study of Bian *et al.* *14*, this operation is equivalent to applying only the *I*_{z}*S*_{z} interaction for time *t*_{p}. Likewise, we can implement **I** is the control spin, **S** is the target spin, **I** about *z*, **S** about *z*, and so on.

In our experiment, the CNOT gate is designed to flip the ^{13}C (target spin) nuclear spin if the ^{1}H (control spin) nuclear spin is in the | ↓ 〉 state. Figure 3A shows the pulse sequence for implementing the CNOT gate in the heteronuclear two-spin system. As discussed in the previous section on single-spin control, our experimental error is dominated by unitary error. Because we can neglect nonunitary errors, we can characterize the CNOT gate by implementing a partial quantum process tomography (see Materials and Methods), where it requires substantially fewer measurements than standard quantum process tomography (*20*). As an example, Fig. 3B shows the state tomography after the CNOT gate is applied on the sudden state (initial state tomography is shown in Fig. 1C). Comparing the initial state with the final state, it is obvious that the CNOT gate keeps *I*_{z} and changes *S*_{z} to *I*_{z}*S*_{z}, which agrees well with the theoretical calculations (table S3). We prepare two independent initial states as the input states and measure the corresponding output states after applying the CNOT gate. One of the two initial states is the sudden state. We prepared the other one by applying a π/2 rotation of the spin **I** about *x* on the sudden state (section S4). On the basis of the measured state tomography results, we reconstruct the CNOT gate by using a numerical minimization technique to find the minimum of the function _{l} denotes *l*-norm, *k*_{i} is the weighting factor of ||B_{i}||_{l}, and ρ_{i} and

## DISCUSSION

Here, we report the experimental implementation of universal quantum control in zero-field NMR, that is, single-spin and two-spin control on a heteronuclear two-spin system. Furthermore, we have evaluated the quality of the control using quantum information–inspired randomized benchmarking and partial quantum process tomography. We have demonstrated single-spin control with an average fidelity of 0.9960(2) for ^{13}C and two-spin control through a CNOT gate with a fidelity of 0.9877(2) in ^{13}C-formic acid. We have determined that the dominant errors for nuclear spin control in zero-field NMR are mainly from pulse imperfections. In addition, we have implemented quantum state tomography, which allows for full characterization of the density matrix of the nuclear spin system at zero magnetic field. Our method removes limitations of the previous nuclear spin control techniques at zero field and offers universal control of heteronuclear spin systems with high fidelity.

One possible application of our method that is now promising for zero-field NMR involves proposed experiments to measure chirality, and perhaps molecular parity nonconservation, via the rank 1 antisymmetric component of the *J*-coupling tensor (*9*, *32*). Observation of these interactions requires an oriented (for example, by a strong electric field) sample, which simultaneously introduces some degree of alignment. This alignment introduces rank 2 interactions like the dipole-dipole coupling (*8*), which are generally large compared to the expected rank 1 couplings. The ability to perform independent arbitrary rotations on spins with different gyromagnetic ratios makes possible the implementation of rank-selective decoupling such as demonstrated in the study of Llor *et al.* (*10*), which can be used to average out rank 2 interactions that would otherwise complicate the measurement, while preserving the rank 1 interactions. Besides this, some NMR-based experiments exploring fundamental physics beyond the standard model, such as Cosmic Axion Spin Precession Experiment in the zero-field regime (*33*, *34*), can benefit from the universal quantum control method, which, for instance, could help in understanding and suppressing systematic effects.

It is worth noting that zero-field NMR spectroscopy at the single-molecule level detected, for example, with nitrogen-vacancy (NV) centers in diamond, could take advantage of the techniques developed here. Previous work has demonstrated single-molecule spectroscopy detected via NV centers (*35*, *36*), and recently developed techniques have shown submillihertz frequency resolution with NV centers at finite magnetic fields (*37*–*39*). Combined with these techniques, our control methods could be useful for nanoscale chemical analysis in the zero-field regime based on a single NV center, as environments that allow for high-resolution measurements may result in increased spectral complexity, which can be investigated and/or reduced using decoupling or spectral-editing pulse sequences. We note that the most significant scalability issue for NMR ensemble quantum computing, the reliance on pseudo-pure states (*29*), is overcome in the single-molecule case. A pure initial spin state for a single molecule can, in principle, be prepared via polarization transfer from the optically pumped NV center (*40*). Combined with the control methods presented here, such an arrangement may enable the construction of nuclear spin quantum devices at the single-molecule level.

## MATERIALS AND METHODS

### Sample preparation

^{13}C-formic acid was obtained from Sigma-Aldrich. The ~200-μl sample was flame-sealed under vacuum in a standard 5-mm glass NMR tube after five freeze-pump-thaw cycles to remove dissolved oxygen, which is otherwise a significant source of relaxation at zero field.

### Experimental apparatus

The oscillating magnetic field signal produced by the evolving nuclear spin magnetization of a NMR sample was measured by a spin-exchange relaxation free (SERF) atomic magnetometer, shown in Fig. 1B. The ^{87}Rb atoms in a vapor cell were pumped with a circularly polarized laser beam propagating in the *y* direction. The laser frequency was tuned to the center of the buffer gas (N_{2})–broadened and shifted D1 line. The magnetic field was measured via optical rotation of linearly polarized probe laser light (detuned by tens of gigahertz from the D2 transition) propagating in the *x* direction. The vapor cell was resistively heated to 180°C. The atomic vapor cell was placed inside a four-layer magnetic shield (MS-1F, Twinleaf LLC), which includes three layers of mu-metal and one innermost layer of ferrite, which minimizes thermal Johnson noise. A set of three orthogonal coils driven by Krohn-Hite Model 523 DC calibrators was used to compensate the residual magnetic field to below 10^{−10} T. The sensitivity of the atomic magnetometer to fields along the *z* axis was optimized to about 10 fT/Hz^{1/2} for frequencies above 100 Hz, allowing for detection of the *z* component of the sample’s nuclear magnetization. Three sets of mutually orthogonal low-inductance Helmholtz coils were used to apply magnetic field pulses, which were generated by the gradient channels of a Magritek Kea2 spectrometer and amplified by AE Techron 7224 power amplifiers.

### Partial quantum process tomography

Standard quantum process tomography requires estimations of *O*(2^{4N}) real parameters to characterize the possible errors of a quantum process, where *N* is the number of qubits. To realize this complete characterization, a complete set of input states ρ_{i} (*i* = 1,…,2^{2N}) needs to be prepared, and for each of them, complete state tomography was required after the quantum process. According to the state tomography results of the input and output states, one can obtain a set of mathematical equations that can be solved to obtain the *O*(2^{4N}) unknown parameters (*21*, *22*). However, when decoherent and incoherent errors are negligible, the quantum process under investigation can be approximated by a unitary operation, which is represented by a unitary matrix with only *O*(2^{2N}) parameters. By performing only partial quantum process tomography, that is, confining the characteristics to only unitary process, the required number of experiments is substantially reduced. As usual, one can then prepare a set of independent initial states as the input states and measure the corresponding output states after applying the unknown unitary operation. A minimum set (sufficient to determine all parameters of the unitary matrix) consists of only two input states if and only if the identity operator is the only operator within the projective unitary group PU(2^{N}) (*21*, *22*). The two states described in section S4, ρ_{1} (referred to as the sudden state above) and ρ_{2} (prepared by applying a π/2 pulse on ^{1}H along the *x* axis to an “imperfect sudden state”), satisfy these requirements. Hence, measurement of the density matrix provides sufficient information to determine the matrices describing the unitary process.

## SUPPLEMENTARY MATERIALS

Supplementary material for this article is available at http://advances.sciencemag.org/cgi/content/full/4/6/eaar6327/DC1

Supplementary Materials and Methods

section S1. Hamiltonians and eigenstates

section S2. State tomography

section S3. Single-spin control

section S4. Two-spin control via CNOT gate

table S1. The evolutions of two-spin operators under the scalar spin-spin coupling.

table S2. Temporal averaging sequences for state tomography.

table S3. The evolution of the two-spin operators under the CNOT gate.

table S4. Reconstructing the CNOT gate based on *l*-norm.

fig. S1. Experimental realization of temporal averaging.

fig. S2. Dependence of NMR signal amplitude on *z* pulse duration.

This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is **not** for commercial advantage and provided the original work is properly cited.

## REFERENCES AND NOTES

**Acknowledgments:**We thank A. Pines, J. Du, U. Poscihinger, D. Suter, F. Schmidt-Kaler, A. Wickenbrock, and J. King for helpful discussions and comments, and R. Picazo Frutos for useful CNOT gate calculations. We would like to particularly thank T. Sjolander for his assistance with initial early-stage experimental efforts.

**Funding:**This research was supported by the DFG (Deutsche Forschungsgemeinschaft) Koselleck Program and the Heising-Simons and Simons Foundations, the European Research Council under the European Union’s Horizon 2020 Research, and Innovative Programme under grant agreement no. 695405 (T.W., J.W.B., and D.B.). M.J. would like to acknowledge support from the China Scholarship Council, enabling his research at the Johannes Gutenberg-University Mainz. J.W.B. acknowledges support from the Helmholtz Postdoctoral Programme. G.F. acknowledges the support from the Canadian Institute for Advanced Research (CIFAR), Natural Sciences and Engineering Research Council (NSERC), and Industry of Canada. X.P. acknowledges the support from the National Key Research and Development Program of China (2018YFA0306600), the National Key Basic Research Program of China (2014CB848700), National Natural Science Foundation of China (grants no. 11425523, 11375167, 11661161018, and 11227901), and Anhui Initiative in Quantum Information Technologies (grant no. AHY050000).

**Author contributions:**M.J. designed the pulse sequences, performed the experiments, analyzed the data, and wrote the manuscript. T.W. set up and characterized the SERF magnetometer, performed the measurements, implemented state tomography, and wrote the manuscript. J.W.B. designed and constructed the apparatus, devised the experimental protocol, analyzed the data, and wrote the manuscript. G.F. designed the randomized benchmarking sequences and analyzed the data. X.P. proposed the experimental concept, devised the experimental protocol, and proofread and edited the manuscript. D.B. provided the overall management of the project, contributed to the design of the experiment, and wrote the manuscript. All authors contributed with discussions and to the final form of the manuscript.

**Competing interests:**The authors declare that they have no competing interests.

**Data and materials availability:**All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors.

- Copyright © 2018 The Authors, some rights reserved; exclusive licensee American Association for the Advancement of Science. No claim to original U.S. Government Works. Distributed under a Creative Commons Attribution NonCommercial License 4.0 (CC BY-NC).