Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Algorithmic decomposition for efficient multiple nuclear spin detection in diamond


Efficiently detecting and characterizing individual spins in solid-state hosts is an essential step to expand the fields of quantum sensing and quantum information processing. While selective detection and control of a few 13C nuclear spins in diamond have been demonstrated using the electron spin of nitrogen-vacancy (NV) centers, a reliable, efficient, and automatic characterization method is desired. Here, we develop an automated algorithmic method for decomposing spectral data to identify and characterize multiple nuclear spins in diamond. We demonstrate efficient nuclear spin identification and accurate reproduction of hyperfine interaction components for both virtual and experimental nuclear spectroscopy data. We conduct a systematic analysis of this methodology and discuss the range of hyperfine interaction components of each nuclear spin that the method can efficiently detect. The result demonstrates a systematic approach that automatically detects nuclear spins with the aid of computational methods, facilitating the future scalability of devices.


Diamond nitrogen-vacancy (NV) centers have recently attracted much attention in magnetic resonance and related fields of research such as quantum metrology1,2,3,4,5 and quantum information processing6,7,8,9 because of their good quantum coherence. The spin states of NV centers show long coherence times10,11 even at room temperature12,13, can be manipulated by microwaves14,15, can be connected optically over long distances16, and can be operated in a wide range of temperatures through the measurement of optically detected magnetic resonance (ODMR) using spin-dependent fluorescence17. The NV center electron spin is also used as a sensitive probe of surrounding spins (most commonly used are 13C nuclear spins interacting with NV center electron spin by hyperfine coupling) as schematically shown in Fig. 1a. Owing to the long coherence times of these nuclear spins18, detecting and manipulating naturally trapped nuclear spins in diamond through NV centers is emerging as a promising pathway to enable controlled quantum systems such as spin qubit registers19,20,21,22,23,24, quantum networks25,26, quantum simulation platforms18,27, and quantum memories28,29,30. Because naturally occurring 13C nuclear spins are randomly located around an NV center electron spin31,32, the efficient and automatic characterization of hyperfine interactions of individual nuclear spins is a prerequisite step towards building scalable quantum systems based on this platform.

Figure 1

Nitrogen vacancy (NV) center-based electron-nuclear spin register and CPMG pulse technique. (a) Schematic diagram of the NV-center system. NV-center has spin quantum number S = 1 electron spin and interacts with nearby 13C nuclear spins via the hyperfine coupling. Two states of the electron spin, \(m_{s} = 0\) and \(m_{s} = - 1\), were chosen, and microwave pulses were resonant to these two states. (b) Schematic of Carr–Purcell–Meiboom–Gill (CPMG) dynamical decoupling pulse sequence. Each box indicates a single quantum gate that rotates the state vector around a specific axis in the Bloch sphere. (c) Example of CPMG spectroscopy data stemming from nearby single nuclear spin. \(P_{x}\) represents the probability that the NV center spin state is preserved as a function of inter \(\pi\)- pulse duration \(\tau\). The signal was simulated with a pulse repetition number N = 32, applied magnetic field B0 = 400 G along the NV center axis, and hyperfine interaction tensor components A = B = 50 kHz.

Automatic methods that efficiently and objectively detect and characterize the underlying nuclear spins are required for further scalability of this platform. The detection of nuclear spins in diamond relies on the hyperfine coupling to NV center electron spin, and combined effects from each spin are reflected in the spectrum signal31,32. To identify each spin individually, the signal should be decomposed into multiple spectra, each resulting from a single nuclear spin. Therefore, as the spin system size increases, detecting individual nuclear spin signals from the observed magnetic resonance spectrum requires a more intricate analysis process. Applying for larger-scale spin systems, systematic and reliable approaches, currently lacking in the field of NV center-based nuclear spectrum analysis, are required.

In this study, we propose and demonstrate a computer-aided algorithm for analyzing nuclear spectra in diamond, resolving periodic dips automatically and determining hyperfine interaction tensor components of the nuclear spins weakly coupled to an NV center. Central to the algorithm, we adapted the Gaussian mixture model based on signal partitioning algorithms33 to identify each dip from the signal, enabling analysis of the hyperfine interaction tensor components of each nuclear spin. We demonstrate systematic and automatic decomposition of both virtual and experimental dynamical decoupling-based nuclear spectroscopy data. We also show that the algorithm is capable of detecting the magnitude of hyperfine interaction tensor within the uncertainty of 20%, by comparing the results to those from a more complex and demanding multidimensional spectroscopy method applied to the same nuclear spins23. Our result provides a useful, fast and general tool for analyzing a wide variety of spectroscopy data; this is a key tool for expanding the number of available coherent resources in a system using hyperfine coupling to NV centers and nuclear spins.

Materials and methods

The characteristic signal

In NV center-based nuclear magnetic resonance spectroscopy, dynamical decoupling pulse sequences are applied to detect a weak signature of individual nuclear spin signals. Periodic pulses are used to decouple the interaction of the NV center with a spin bath while amplifying specific nuclear Larmor precession resonant with the inter \(\pi\)-pulse period (Fig. 1b)31. In this study, we analyze Carr-Purcell-Meiboom-Gilbert (CPMG)34,35 type dynamical decoupling sequences. We choose this sequence because it forms the basic work horse of spin detection20,21,31,36, is of low experimental complexity and forms the starting point for more extensive characterization methods23,37,38.

The interaction of the NV center with an individual nuclear spin is reflected in sudden dips in the measured electron coherence occurring periodically as a function of total phase evolution time. The analytic expression for the NV center coherence in the presence of nuclear spin is given by31,

$$P_{x} = \frac{M + 1}{2}$$
$$M = 1 - (1 - \hat{n}_{0} \cdot \hat{n}_{1} )\sin^{2} \frac{N\phi }{2}$$

where \(P_{x}\) is the probability that the initial state is preserved, N is the number of the repeated unit decoupling sequence, \(\hat{n}_{0}\) and \(\hat{n}_{1}\) are the rotation axes of the nuclear spin depending on the initial state of the electron spin with magnetic quantum number \(m_{s}\) = 0, − 1, respectively, \(\phi\) is the net rotation angle around the axis \(\hat{n}_{i}\) (i = 0,1) following the relation \(cos\phi = \cos \alpha \cos \beta - m_{z} \sin \alpha \sin \beta\), and \(1 - \hat{n}_{0} \cdot \hat{n}_{1} = m_{x}^{2} \frac{(1 - \cos \alpha )(1 - \cos \beta )}{{1 + \cos \alpha \cos \beta - m_{z} \sin \alpha \sin \beta }}\), where \(\alpha = \tilde{\omega }\tau\), \(\beta = \omega_{L} \tau\), \(m_{z} = (A + \omega_{L} )/\tilde{\omega }\), \(m_{x} = B/\tilde{\omega }\), and \(\tilde{\omega } = \sqrt {(A + \omega_{L} )^{2} + B^{2} }\). For example, Fig. 1c shows numerically simulated spectroscopy data with a single nuclear spin near an NV center. The spectra show sharp dips in the coherence of the electron spin, with a position and amplitude determined by the parallel (perpendicular) hyperfine interaction tensor components A (B).

In a typical dynamical decoupling experiment using a diamond chip with naturally abundant 13C nuclear spins, the spectroscopy signal shows a complicated spectrum stemming from each nuclear spin surrounding the electron spin superposed with a broad background signal. The random location of nuclear spins and the non-linearity of the signal makes stereotypical signal library construction impractical, and the peak detection and analysis should be performed for each given NV center and the uniquely associated nuclear spin bath31,32. These factors forbid direct application of conventional Nuclear Magnetic Resonance (NMR) spectrum analysis methods to NV center-based NMR signal processing.

The purpose of our computer-aided spectrum analysis is to accurately determine individual nuclear spins and obtain both longitudinal and transverse hyperfine parameters automatically. The signal analysis process can be divided into three steps: decomposition of a given signal into Gaussians using signal partitioning algorithm33; extraction of a single spin signal; and calculation of the hyperfine interaction of each spin. Each stage is fully automated and executed in sequential order, using user-defined parameters which are summarized in Table 1.

Table 1 User-defined parameters used in the algorithm.

Signal decomposition into Gaussians

The first step of this method is to apply the signal partitioning algorithm to decompose the given CPMG-based dynamical decoupling signal into a combination of Gaussian functions. The algorithm first automatically divides the spectroscopy data into fragments, then each fragment is determined by a distinct splitting dip in the data. The data is divided so that nominally only one coherence dip exists in one fragment. All fragments are then decomposed into Gaussians based on Expectation–Maximization (EM) iterations. All Gaussian outputs with an  amplitude smaller than the threshold are eliminated during the post-processing. MATLAB packages: Signal Processing Toolbox, Bioinformatics Toolbox, Curve Fitting Toolbox, and Parallel Computing Toolbox are used for the implementation of the algorithm33.

Detection of single nuclear spins

Resonance dips stemming from nuclear spins appear in the CPMG signal when the condition \(\hat{n}_{0} \cdot \hat{n}_{1} = - 1\) is met. In terms of phase evolution time in the kth fragment \(\tau_{k}\), this condition can be approximated as

$$\tau_{k} = \frac{\pi }{{\tilde{\omega } + \omega_{L} }}\left( {\left( {2k - 1} \right) + \left( { - 1} \right)^{k - 1} \left( {\frac{1}{2\sqrt 2 }\left( {\frac{B}{{\omega_{L} + A}}} \right)^{2} - \frac{1}{4\sqrt 2 }\left( {\frac{B}{{\omega_{L} + A}}} \right)^{4} } \right)} \right) + O\left( {\left( {\frac{B}{{\omega_{L} + A}}} \right)^{6} } \right)$$

where \(\omega_{L}\) is the Larmor frequency of the 13C nuclear spins, and \(\tilde{\omega } = \sqrt {(\omega_{L} + A)^{2} + B^{2} }\). This approximation can be derived from finding the intersection between the curves \(\tan (\alpha /2)\tan (\beta /2) = 1/m_{z}\) and \(\beta = \frac{{\omega_{L} }}{{\tilde{\omega }}}\alpha\) in the βα plot, using Taylor expansion with \(\frac{B}{{\omega_{L} + A}}\), where A(B) is the parallel(perpendicular) hyperfine interaction tensor component, \(\alpha = \tilde{\omega }\tau\), \(\beta = \omega_{L} \tau\), and \(m_{z} = (A + \omega_{L} )/\tilde{\omega }\). When \(B < < \omega_{L}\), further approximation yields a linear \(\tau_{k}\) vs. k as follows:

$$\tau_{k} = \frac{(2k - 1)\pi }{{\tilde{\omega } + \omega_{L} }}$$

Therefore, the nuclear spin is identified by collecting the position of the kth coherence dip as a function of k, and fitting the result with a straight line. In this study, the dip positions from the signal decomposition process are partitioned into time windows, following the period \(T = \frac{\pi }{{\omega_{L} }}\), and each dip position is marked with the relative time \(\Delta \tau_{k}\) with respect to the center of the time window \(\Delta \tau_{k} = \tau_{k} - \left( {k - \frac{1}{2}} \right)T\).

When collected, dip positions \(\Delta \tau_{k}\) vs. k form a fan diagram, and the CPMG line fit method composed of the dip grouping and a line fitting process is applied to the plot. With the constraint that all lines start from \((k,\Delta \tau_{k} ) = (0.5,0)\), satisfying Eq. (4), the objective of this process is to find a set of line configurations that explains the positions of all dips in the \(\Delta \tau - k\) plot. We use a sequential process to reduce the computational load during the process. First, a set of line candidate lists is built based on the individual dip positions. For each dip located at \((k_{0} ,\Delta \tau_{0} )\) in the \(\Delta \tau - k\) plot, a list of line candidates starting from \((k,\Delta \tau ) = (0.5,0)\) and having slope \(\frac{d\tau }{{dk}} = \frac{{\Delta \tau_{0} }}{{\left( {k_{0} - 0.5} \right)}}\) is generated.

Second, for all line candidates in the list, we find the nearest dips to the line for each k, and calculate the squared distance of τ between the dips and the line. The mean squared distance of each line was calculated using \(\overline{{d^{2} }} = \frac{{\sum\limits_{k = 1}^{{k_{\max } }} {\min \left( {\Delta \tau_{line} (k) - \Delta \tau_{dip} (k)_{\min } ,d_{\max } } \right)}^{2} }}{N}\), where \(\Delta \tau_{line} (k) = \left( {\frac{d\tau }{{dk}}\left( {k - 0.5} \right) + 0.5} \right)\) is the position of the line at period number k, and Δτdip(k)min is the position of the dip with the closest distance to the line in consideration. To prevent picking dips too far from the line, a maximum value dmax of the distance between the line and a dip is set. The line candidate having the least mean distance value among the k values is considered as the best fit, and the dip positions used in the calculation are grouped as signals of the same nuclear spin. Third, the examined line candidate as well as a determined group of dip positions are removed from the \(\Delta \tau - k\) plot. This process is repeated until all the points in the \(\Delta \tau - k\) plot are exhausted.

During the line selection process where kmax is the maximum time window index within the data aimed to be analyzed, lines with slopes larger than \(T/2k_{\max }\) (smaller than \(- T/2k_{\max }\)) have k values with 0(2) dips within them. Furthermore, all of the following dips within time windows with k values larger than the window with 0(2) dips show the discrepancy between its time window index k and dip numbering index. To solve this discrepancy, additional dips with coordinates \((k \pm m,\Delta \tau_{k} \mp mT), \, m < M{, }m = {\text{integer}}\), where M is the number of additional layers of dips, are added for each dip in position \((k,\Delta \tau_{k} )\) in the \(\Delta \tau - k\) plot. This procedure expands the period window to (2 M − 1)T, and the range of slope that can be fit into a straight line is expanded to \(( - (2M - 1)T/2k_{\max } ,(2M - 1)T/2k_{\max } )\).

Fitting and post selection

The full-width-half-maximum (FWHM) of each dip grouped in the CPMG line fit and the slope obtained in the CPMG line fit are used as the two constraints determining (A, B) of each nuclear spin. For the first constraint, the envelope of the CPMG signal represented by a Lorentzian is used,

$$1 - \hat{n}_{0} \cdot \hat{n}_{1} = \frac{2}{{1 + \left( {\frac{{(\tilde{\omega } + \omega_{L} )\tilde{\omega }(\tau - \tau_{k} )}}{B}} \right)^{2} }}$$

which is valid for \(\tau - \tau_{k} < < \frac{B}{{(\tilde{\omega } + \omega_{L} )\tilde{\omega }}}\). From the Gaussian peak decomposition, we gain the standard deviation σ of the best Gaussian fit to the dip, giving the FWHM of the fit as \(2\sigma \sqrt {2\ln 2}\). Using this value as the FWHM of the Lorentzian envelope, the first relation between A, B, and σ can be derived as follows:

$$\sigma = \frac{1}{{\sqrt {2\ln 2} }}\frac{B}{{(\tilde{\omega } + \omega_{L} )\tilde{\omega }}}$$

The second constraint comes from the slope obtained during the CPMG line fit process from the relation,

$$\frac{d\tau }{{dk}} = \left( {\frac{2\pi }{{\tilde{\omega } + \omega_{L} }} - T} \right)$$

Using the calculated A and B as the initial guess, the fit function implemented in MATLAB is used to obtain the final estimation of A and B. While using the fit function, we apply a filter on the root-mean-square error (RMSE) calculation to prevent unphysical fitting results due to interception of nearby dips originating from other nuclear spins. The filter is built based on the initial (A, B) values as follows:

$$filter(\tau ) = \left\{ {\begin{array}{*{20}c} {1,} & {\tau \in [\tau_{k} - \sigma ,\tau_{k} + \sigma ]} \\ {0,} & {otherwise} \\ \end{array} } \right.$$

The fitting process is applied to all lines that were selected in the CPMG line fit method. However, some of the chosen lines can be based on mixed dips that come from several different nuclear spins with differing interaction strength. To remove the incorrectly selected lines, a post-selection process is applied to the fitted (A, B) pairs. The (A, B) pairs that come out from the fitting process are regarded as candidates for a good nuclear spin interaction representation. The Beam Search39, a heuristic search strategy for memory saving based on the breadth-first search, is applied to find the optimal (A, B) pair configuration, which reconstructs the most similar signal compared to the given CPMG signal. The algorithm calculates the RMSE value with the filter for each (A, B) pair configuration similar to the fitting process.

Results and discussion

We first build up our systematic approach with an example of virtually generated CPMG signals. We simulate the CPMG signal with randomly selected hyperfine interaction tensor components of ten individual nuclear spins within 2 nm radius from the NV center for a given \(\pi\) pulse repetition number N = 32. Approximately 50,000 random coordinates, which represent nuclear spins more than 2 nm away from the electron spin, in the diamond lattice having interaction strength of A < 8 kHz, B < 0.25 kHz were chosen to reproduce the spin bath signal (Fig. 2a). Figure 2b shows the Gaussian decomposition33 of the input signal where the position, amplitude, and standard deviation value of each Gaussian are obtained using the algorithm described in the method section. Figure 2c shows the plot of the positions of the dips in the ∆τ- k fan diagram. As explained above, the automatic CPMG line fit method is applied to obtain the hyperfine interaction, which finds the best configuration of straight lines starting near origin covering most of the data points as shown in Fig. 2c, using solid lines. For each line found from the fit, A and B values are calculated by solving Eqs. (4), and (6). These hyperfine parameters are used as initial guesses to fit each dip iteratively based on Eq. (2) to reach the final hyperfine interaction tensor components. The procedure is applied to each detected nuclear spin, and the accuracy of the fit is determined by comparing the reconstructed and input CPMG signal. As shown in Fig. 2d, the reconstructed CPMG signal, using the converged hyperfine interaction tensor components, shows excellent agreement with the input configuration of the spins. This shows less than 5% error compared to the values used in the signal generation. It also demonstrates the capability of the algorithm to automatically search the given nuclear spectra. The error of hyperfine interaction was calculated as,

$$Error = \frac{{\sqrt {(A_{orig} - A_{obt} )^{2} + (B_{orig} - B_{obt} )^{2} } }}{{\sqrt {A_{orig}^{2} + B_{orig}^{2} } }}$$
Figure 2

Algorithm execution with virtual CPMG data. (a) Simulated dynamical decoupling signal with ten nuclear spins. The hyperfine interaction tensor components of each nuclear spin were randomly generated. (b) Decomposition of the coherence dip with Gaussians by partitioning algorithm. Decomposed Gaussians are plotted with different colors depending on their amplitude. (c) The position of the coherence dips \(\Delta \tau\) as a function of k. Each point indicates a single dip extracted by Gaussian decomposition in the CPMG signal. The symbols represent the amplitude of the Gaussian used to fit each dip (For the Gaussian amplitude a, red asterisk: \(a \ge 0.5\); blue circle: \(0.3 \le a < 0.5\); black cross: \(0.15 \le a < 0.3\); dots: \(a < 0.15\)). The colors of each marker correspond with the colors of decomposed Gaussians in (b). Lines are guides for the eye to group the points originating from the same nuclear spin. All ten nuclear spins used to generate the CPMG signal were detected. (d) Comparison of the generated data and the signal reconstructed from the detected spin parameters. The error of the hyperfine interaction tensor components of each nuclear spin is less than 5%.

where \(A_{orig}\),\(B_{orig}\) are the (A, B) value of the original hyperfine interaction, and \(A_{obt}\),\(B_{obt}\) are the (A, B) value of the obtained hyperfine interaction, the result of our program.

We turn to discuss more systematic analyses of the performance of the developed algorithm. We first test the performance with numerically generated CPMG spectrums of a single nuclear spin with varying A and B. Figure 3a shows the error of the hyperfine interaction strength from a single nuclear spin signal. The small A domain (\(\left| A \right| < {\text{5 kHz}}\)) was not detectable because of the overlap of the coherence dip signal with virtually generated spin bath and other nuclear spin signals with similar dip periods. As A becomes larger in the large A domain (\(\left| A \right| > 70{\text{ kHz}}\)), the slope of the line in ∆τ − k plot becomes steeper. In the spin detection stage, this program considers only two additional clone layers (M = 3) of the point set while applying the CPMG line fit method to the ∆τ − k plot to ensure a manageable computation time. As a result, the range of detectable slopes is limited, and a step jump of the error in the large A domain is observed. Additionally, the small B domain (B < 5 kHz) was not detectable because of the small size of the dips (smaller than the size of the threshold 0.05 given during the Signal decomposition process), and the large B domain (B > 120 kHz) was hardly detectable because the shape of each of the dips deviates from a simple Lorentzian form to a more complex shape with several ripples around the dip typical for a CPMG dynamical decoupling sequence. We expect that more advanced techniques such as pattern analysis based on machine learning combined with numerical fits can enhance the detectability in this strongly coupled regime.

Figure 3

Program performance analysis. (a) Performance tests using signals originating from a single nuclear spin. The dark blue color indicates (A, B) values where the spin could not be detected (b,c). Spectroscopy resolution test using signals originating from 2 nuclear spins using the hyperfine parameters of the interference spin as (b) (25, 25) kHz, and (c) (50, 50) kHz. (d) Performance test using signals originating from randomly selected 20 spins. The color bar for (ad) represents error for (A, B) values obtained by the algorithm. All errors were calculated using the distance on the AB plot between the original (A, B) used to produce the signal and the (A, B) obtained using this algorithm. The errors were averaged from the results of 1,000 random configurations. (e) Averaged dip frequency difference between the original and obtained (A, B) values for all performance test results. (f) Probability of signal dip overlap for all spins used in the performance test. The gray color in the 2D map displayed in (d-f) represents the (A, B) values that cannot be achieved by the dipole–dipole interaction with nuclear spins in the diamond lattice. All signals were simulated with a pulse repetition number N = 32, applied magnetic field B0 = 400 G. Pulse duration τ was varied from 0 to 50 μs with 5 ns interval.

Since the algorithm is based on a nuclear spectrum, stemming from all nuclear spins interacting with the NV center together, it is important to determine the minimum resolution of the hyperfine coupling parameter that the algorithm can reliably distinguish. We analyze simulated CPMG signal, originating from two different spins to estimate the resolution of the dip frequency \(f_{p} = \frac{{\tilde{\omega } + \omega_{L} }}{4\pi }\). One nuclear spin with fixed hyperfine interaction tensor components was used as the reference signal while the hyperfine coupling of the second nuclear spin was varied. Figure 3b,c show the error of the obtained hyperfine parameters of the second nuclear spin as a function of parameter variation from the reference spin. The results show that the main factor significantly affecting the resolution of the program is A since it is directly related to the slope of each line in the spin detecting stage as well as the dip frequency of the nuclear spin. We empirically find that the obtained dip frequency resolution of the current algorithm is about 2 kHz, which showed an error less than 20%.

We further analyze the accuracy and applicability of this program by repeatedly testing the algorithm with virtual CPMG data sets containing multiple random nuclear spins, covering a wide range of A and B. The values are based on possible lattice points in diamond and calculating the hyperfine interaction from a purely dipole–dipole coupling—neglecting the contact hyperfine and extended wavefunctions for simplicity—between the 13C nuclear spin and the electron spin of the NV center using,

$$H = - \frac{{\mu_{0} \gamma_{e} \gamma_{n} \hbar^{2} }}{{4\pi \left| {\mathbf{r}} \right|^{3} }}(3({\mathbf{S}}_{e} \cdot {\hat{\mathbf{r}}})({\mathbf{I}}_{n} \cdot {\hat{\mathbf{r}}}) - {\mathbf{S}}_{e} \cdot {\mathbf{I}}_{n} )$$

where \(\mu_{0} = 4\pi \times 10^{ - 7}\) H/m is the magnetic permeability of free space, \(\gamma_{e}\) = 20,824 MHz/T (\(\gamma_{n}\) = 10.708 MHz/T ) is the gyromagnetic ratio of the NV center electron (13C nuclear ) spin, \({\mathbf{S}}_{e}\) is the vector of electron spin-1 operators, and \({\mathbf{I}}_{n}\) is the nuclear spin-1/2 operators vector. We confine the lattice points to be within 2 nm from the NV center, and consider spins having hyperfine interaction values within the range − 100 kHz < A < 100 kHz (5 kHz < B < 100 kHz). Twenty lattice points in this range were randomly chosen to simulate the signal, and by repeating our algorithm, we record the error of the analysis result for each nuclear spin used to generate the signal.

Figure 3d shows the average error between the input hyperfine coefficients and the output of this method by accumulating 1,000 configurations of 20 random spins. From this result, we find that the region of 80% confidence is 5 kHz <|A|< 70 kHz and 15 kHz <|B|< 80 kHz. The region of both |A| and |B| is constrained from the limitation of detecting a single nuclear spin signal as shown in Fig. 3a. In addition, for |B|, the overlap of the dips coming from different nuclear spins appears in the many spin signals, narrowing the allowed range of this parameter. The loss in confidence can be ascribed to two main factors; (1) the accuracy of the period of the dips, and (2) the accuracy of estimating the amplitude of each dip. The period of each nuclear spin signal is estimated using a large collection of dip points. This is generally robust to the presence of other nuclear spin signals, leading to frequency resolution 2 kHz (Fig. 3e). However, the amplitude of each dip can be disturbed when overlapped with other spin signals. As a result, the error of the hyperfine parameters mainly comes from the error in fitting the amplitude of the dip, affecting the accuracy of the perpendicular hyperfine interaction element B. As shown in Fig. 3b,c, when the dip frequency coming from two different nuclear spins is similar within 2 kHz, the dips coming from different spins interfere with each other. This brings in a non-linear distortion to the dip amplitude. It is found that among spins in the 80% confidence region, an average of 20% of the spins has another nuclear spin whose dip frequency difference is within 2 kHz, making it difficult to fit the signal from each nuclear spin independently (Fig. 3f). The effect of the interfering nuclear spin signal can be approximated from Eq. (2). When some error in B comes in, represented as \(\delta B\), the size of the dip is \(P = \sin^{2} \left( {\frac{N}{2}\frac{B}{{\sqrt {(\omega_{L} + A)^{2} + B^{2} } }}} \right)\), and the error of the dip becomes \(\frac{\delta P}{P}\sim 2\frac{\delta B}{B}\) up to the order of \(O\left( {\left( {\frac{B}{{\omega_{L} + A}}} \right)^{4} } \right)\), for A, BωL. This result shows that the error in the amplitude of the dip P directly affects the error of B. From this relation, it can be interpreted that if an additional spin signal with its dip size of 0.2 is overlapped with the original signal, the output B value is expected to show 20% error.

We now show the application of the method to the experimental NV center-based nuclear spectroscopy data. The data was collected from a single NV center system at a low temperature with varying τ from 6 to longer than 50 μs11. The experimental data in ref. 11 were re-analyzed, and our algorithm reports 14 distinct nuclear spins (Fig. 4a). As an output of the algorithm, the hyperfine interaction tensor components of each spin were obtained. The simulated signal from these hyperfine parameters matched well with the experimental data, as shown in Fig. 4b. The obtained hyperfine interaction tensor components are given in Table 2. Based on the accuracy analysis performed above, spins 1, 2, 4, 10, 11, 12, and 14, marked with asterisk in the table, are in the reliable (A, B) region, and as expected, they show values less than 20% difference compared to the reported values from the experimental multidimensional spectroscopy on the same NV center and nuclear spin environment23 (Table 2).

Figure 4

Analysis result for experimental data. (a) Detection of nuclear spins in the \(\Delta \tau - k\) plot. Each point represents a single dip in the CPMG signal. Lines are guides for eye to group the points originating from the same nuclear spin. Points resting on a single line come from the same nuclear spin. Fourteen nuclear spins were detected in this data. The marker symbol follows the definition given in Fig. 2c. (b) Comparison of the experimental data and the signal reconstructed from the detected spin parameters. (c,d) Individual spin spectra from the reconstructed signal around (b) τ = 12 μs and (c) τ = 38 μs. The arrows mark the position of the dips coming from the spin bath and S5-9 in Table 2.

Table 2 Obtained hyperfine interaction tensor components between 13C and electron spin and reference values from experimental data23.

This algorithm reported additional spins 3, 5, 6, 7, 8, 9 and 13, whose (A, B) values are out of the 80% confidence range. Spin 3 and 13 have their consistent match among the values of ref. 23, even though their B values were below the confidence threshold. Spin 5–9 show dip periods similar to the spin bath and overlap with each other as shown in Fig. 4c. For longer τ, the coherence dips for spin 5–9 become distinguishable from one another as shown in Fig. 4d. The reported hyperfine values of spin 5, 7, 8 and 9 show large deviations from all values in ref. 23, and spin 6 has a consistent match in ref. 23. While the algorithm treats each line/dip position group as coming from a single nuclear spin, due to limited spectral resolution of the CPMG data, it is highly likely that each spin label contains more than one nuclear spin. In the small A (< 5 kHz) regime, only the coherence dip period information, but not the individual A and B values, is reliable. Nevertheless, to explain the experimental coherence values significantly below 1 at the location of each of the dips coming from spin 5–9, at least one nuclear spin is necessary per coherence dip period. Overall, for the reported spins with (A, B) values out of the 80% confidence range, the dip period information of the spins can aid to set a spectral region to focus on when adapting more advanced spin spectroscopy methods with higher spectral resolution.

In this algorithm, the CPMG signal was simulated and analyzed based on Eqs. (1) and (2). For the purpose of extracting the hyperfine interaction coefficients A and B, these equations can be applied to spin-1/2 systems within dipolar hyperfine interaction approximation. Therefore, the application of this algorithm is not limited to the NV center-13C coupling in the natural diamond environment which we demonstrated. We expect that applying this algorithm to different spin environments, such as in silicon carbide, would be possible.

In these equations, the interaction between the 13C nuclear spins was neglected because of the small interaction strength compared to the one between the NV center electron spin and the 13C nuclear spin. However, the nuclear-nuclear couplings can be significant, especially for larger τ and N, and can cause broadening or splitting of the dips11,23. This could impair the analytical performance of this program. Additional consideration of the interaction between 13C nuclear spins in the fitting stage will increase the capability of this program even for results obtained from the large time region.

Additionally, under the same nuclear spin environment, the CPMG signal of larger N values shows more disordered results because the number of nuclear spins with detectable dips within the CPMG signal increase, elevating the probability of dip overlap between different nuclear spins in the resulting signal. Similar problems can arise in analyzing the CPMG signal obtained under an environment with13C concentration higher than natural abundance. In this algorithm, it is assumed that a single straight line in the spin detection stage represents a single nuclear spin. However, it is possible that multiple nuclear spins with different hyperfine interaction tensor components share their dip frequency, and form a single line as implied in Fig. 3b,c. In this case, because the multiple spin signal is considered as a signal originating from a single nuclear spin in this algorithm, the fitting accuracy can be reduced. Since treating signals from a single straight line as a multiple spin signal takes more complex calculations and a longer time, it was not considered in this algorithm. Considering multiple nuclear spins in the fitting stage will increase the accuracy of the analysis.

These limitations bring in difficulty in analyzing CPMG signals coming from sequences with a large pulse repetition number. Nevertheless, the CPMG signals with large N values are useful for detecting weakly coupled nuclear spins because the size of dips in the CPMG signal coming from a nuclear spin with small perpendicular hyperfine interaction strength becomes magnified, and the coherence time of the NV center increases. Further improvements in solving the non-linearity (for example, a combination of our numerical fit procedure with a more advanced machine learning approach, and including the nuclear spin-nuclear spin interactions to the model) should improve the general performance of our algorithm in the future.


In this study, we have proposed and demonstrated an automated algorithmic method to analyze the CPMG dynamical decoupling nuclear spectrum to detect 13C nuclear spins near the NV center in diamond. Our algorithm decomposes spectroscopy signals into Gaussians using the signal partitioning algorithm33, detects nuclear spins automatically, and returns hyperfine interaction tensor components of each nuclear spin. We confirmed that our program successfully works for both simulated signals and an extended experimental data set. Moreover, we analyzed the range of applicability and limitations of this methodology, which can be improved with additional consideration of the interaction between nuclear spins, and signal processing regarding non-linearity due to multiple nuclear spins. With the possibility to be generalized to other spin-1/2 systems, our results show the first step of a systematic algorithmic approach, providing a useful and general tool for sensing complex spin structures, and furthermore, expanding quantum systems based on spin qubits.

Data availability

All data generated within this study are available from the corresponding author on request.


  1. 1.

    Unden, T. et al. Quantum metrology enhanced by repetitive quantum error correction. Phys. Rev. Lett. 116, 230502 (2016).

    ADS  PubMed  Article  Google Scholar 

  2. 2.

    Zaiser, S. et al. Enhancing quantum sensing sensitivity by a quantum memory. Nat. Commun. 7, 12279 (2016).

    ADS  CAS  PubMed  PubMed Central  Article  Google Scholar 

  3. 3.

    Degen, C. L., Reinhard, F. & Cappellaro, P. Quantum sensing. Rev. Mod. Phys. 89, 035002 (2017).

    ADS  MathSciNet  Article  Google Scholar 

  4. 4.

    Rosskopf, T., Zopes, J., Boss, J. M. & Degen, C. L. A quantum spectrum analyzer enhanced by a nuclear spin memory. NPJ Quantum Inf. 3, 33 (2017).

    ADS  Article  Google Scholar 

  5. 5.

    Kim, D. et al. A CMOS-integrated quantum sensor based on nitrogen–vacancy centres. Nat. Electron. 2, 284–289 (2019).

    CAS  Article  Google Scholar 

  6. 6.

    Wrachtrup, J. & Jelezko, F. Processing quantum information in diamond. J. Phys.: Condens. Matter 18, S807 (2006).

    ADS  CAS  Google Scholar 

  7. 7.

    Doherty, M. W. et al. The nitrogen-vacancy colour centre in diamond. Phys. Rep. 528, 1–45 (2013).

    ADS  CAS  Article  Google Scholar 

  8. 8.

    Waldherr, G. et al. Quantum error correction in a solid-state hybrid spin register. Nature 506, 204 (2014).

    ADS  CAS  PubMed  Article  Google Scholar 

  9. 9.

    Cramer, J. et al. Repeated quantum error correction on a continuously encoded qubit by real-time feedback. Nat. Commun. 7, 1–7 (2016).

    Article  Google Scholar 

  10. 10.

    Bar-Gill, N., Pham, L. M., Jarmola, A., Budker, D. & Walsworth, R. L. Solid-state electronic spin coherence time approaching one second. Nat. Commun. 4, 1–6 (2013).

    Article  Google Scholar 

  11. 11.

    Abobeih, M. H. et al. One-second coherence for a single electron spin coupled to a multi-qubit nuclear-spin environment. Nat. Commun. 9, 2552 (2018).

    ADS  CAS  Article  Google Scholar 

  12. 12.

    Balasubramanian, G. et al. Ultralong spin coherence time in isotopically engineered diamond. Nat. Mater. 8, 383 (2009).

    ADS  CAS  PubMed  Article  Google Scholar 

  13. 13.

    Herbschleb, E. et al. Ultra-long coherence times amongst room-temperature solid-state spins. Nat. Commun. 10, 1–6 (2019).

    CAS  Article  Google Scholar 

  14. 14.

    Hanson, R., Dobrovitski, V., Feiguin, A., Gywat, O. & Awschalom, D. Coherent dynamics of a single spin interacting with an adjustable spin bath. Science 320, 352–355 (2008).

    ADS  CAS  PubMed  Article  Google Scholar 

  15. 15.

    Tamarat, P. et al. Spin-flip and spin-conserving optical transitions of the nitrogen-vacancy centre in diamond. New J. Phys. 10, 045004 (2008).

    ADS  Article  Google Scholar 

  16. 16.

    Hensen, B. et al. Loophole-free Bell inequality violation using electron spins separated by 1.3 kilometres. Nature 526, 682–686 (2015).

    ADS  CAS  PubMed  Article  Google Scholar 

  17. 17.

    Taylor, J. et al. High-sensitivity diamond magnetometer with nanoscale resolution. Nat. Phys. 4, 810 (2008).

    CAS  Article  Google Scholar 

  18. 18.

    Unden, T. et al. Coherent control of solid state nuclear spin nano-ensembles. NPJ Quantum Inf. 4, 39 (2018).

    ADS  Article  Google Scholar 

  19. 19.

    Dutt, M. G. et al. Quantum register based on individual electronic and nuclear spin qubits in diamond. Science 316, 1312–1316 (2007).

    PubMed  Article  Google Scholar 

  20. 20.

    Zhao, N. et al. Sensing single remote nuclear spins. Nat. Nanotechnol. 7, 657 (2012).

    ADS  CAS  PubMed  Article  Google Scholar 

  21. 21.

    Shi, F. et al. Sensing and atomic-scale structure analysis of single nuclear-spin clusters in diamond. Nat. Phys. 10, 21 (2014).

    CAS  Article  Google Scholar 

  22. 22.

    Liu, G.-Q. et al. Single-shot readout of a nuclear spin weakly coupled to a nitrogen-vacancy center at room temperature. Phys. Rev. Lett. 118, 150504 (2017).

    ADS  PubMed  Article  Google Scholar 

  23. 23.

    Abobeih, M. et al. Atomic-scale imaging of a 27-nuclear-spin cluster using a quantum sensor. Nature 576, 411–415 (2019).

    ADS  CAS  PubMed  Article  Google Scholar 

  24. 24.

    Bradley, C. et al. A ten-qubit solid-state spin register with quantum memory up to one minute. Phys. Rev. X 9, 031045 (2019).

    CAS  Google Scholar 

  25. 25.

    Nemoto, K. et al. Photonic quantum networks formed from NV—centers. Sci. Rep. 6, 26284 (2016).

    ADS  CAS  PubMed  PubMed Central  Article  Google Scholar 

  26. 26.

    Humphreys, P. C. et al. Deterministic delivery of remote entanglement on a quantum network. Nature 558, 268 (2018).

    ADS  CAS  PubMed  Article  Google Scholar 

  27. 27.

    Ju, C. et al. NV-center-based digital quantum simulation of a quantum phase transition in topological insulators. Phys. Rev. B 89, 045432 (2014).

    ADS  Article  Google Scholar 

  28. 28.

    Fuchs, G., Burkard, G., Klimov, P. & Awschalom, D. A quantum memory intrinsic to single nitrogen–vacancy centres in diamond. Nat. Phys. 7, 789 (2011).

    Article  Google Scholar 

  29. 29.

    Poem, E. et al. Broadband noise-free optical quantum memory with neutral nitrogen-vacancy centers in diamond. Phys. Rev. B 91, 205108 (2015).

    ADS  Article  Google Scholar 

  30. 30.

    Lai, Y.-Y., Lin, G.-D., Twamley, J. & Goan, H.-S. Single-nitrogen-vacancy-center quantum memory for a superconducting flux qubit mediated by a ferromagnet. Phys. Rev. A 97, 052303 (2018).

    ADS  CAS  Article  Google Scholar 

  31. 31.

    Taminiau, T. H. et al. Detection and control of individual nuclear spins using a weakly coupled electron spin. Phys. Rev. Lett. 109, 5 (2012). 

    Article  Google Scholar 

  32. 32.

    Nizovtsev, A. P. et al. Non-flipping 13C spins near an NV center in diamond: hyperfine and spatial characteristics by density functional theory simulation of the C510 [NV] H252 cluster. New J. Phys. 20, 023022 (2018).

    ADS  Article  Google Scholar 

  33. 33.

    Polanski, A., Marczyk, M., Pietrowska, M., Widlak, P. & Polanska, J. Signal partitioning algorithm for highly efficient gaussian mixture modeling in mass spectrometry. PLoS ONE 10, e0134256 (2015).

    PubMed  PubMed Central  MATH  Article  Google Scholar 

  34. 34.

    Carr, H. Y. & Purcell, E. M. Effects of diffusion on free precession in nuclear magnetic resonance experiments. Phys. Rev. 94, 630 (1954).

    ADS  CAS  Article  Google Scholar 

  35. 35.

    Meiboom, S. & Gill, D. Modified spin-echo method for measuring nuclear relaxation times. Rev. Sci. Instrum. 29, 688–691 (1958).

    ADS  CAS  Article  Google Scholar 

  36. 36.

    Kolkowitz, S., Unterreithmeier, Q. P., Bennett, S. D. & Lukin, M. D. Sensing distant nuclear spins with a single electron spin. Phys. Rev. Lett. 109, 137601 (2012).

    ADS  PubMed  Article  Google Scholar 

  37. 37.

    Zopes, J. et al. Three-dimensional localization spectroscopy of individual nuclear spins with sub-Angstrom resolution. Nat. Commun. 9, 1–8 (2018).

    CAS  Article  Google Scholar 

  38. 38.

    Zopes, J., Herb, K., Cujia, K. & Degen, C. L. Three-dimensional nuclear spin positioning using coherent radio-frequency control. Phys. Rev. Lett. 121, 170801 (2018).

    ADS  CAS  PubMed  Article  Google Scholar 

  39. 39.

    Lowerre, B. T. The Harpy Speech Recognition System. Ph.D. thesis, Carnegie Mellon University, Pittsburgh, PA, USA (1976).

Download references


This work was supported by the National Research Foundation of Korea (NRF) Grant funded by the Korean Government (MSIT) (No.2018R1A2A3075438, No.2019M3E4A1080144, No.2019M3E4A1080145) and the Creative-Pioneering Researchers Program through Seoul National University (SNU). This work was supported by the Netherlands Organisation for Scientific Research (NWO/OCW) through a Vidi grant, and as part of the Quantum Software Consortium programme (Project No. 024.003.037/3368). This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. 852410). This project (QIA) has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 820445.

Author information




H.O. and J.Y. designed and implemented the program. K.J. and K.K. provided technical help. M.H.A. and T.H.T. provided theoretical background and experimental data. D.K. conceived and supervised the project. H.O, J.Y., and D.K. wrote the manuscript.

Corresponding author

Correspondence to Dohun Kim.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher's note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Oh, H., Yun, J., Abobeih, M.H. et al. Algorithmic decomposition for efficient multiple nuclear spin detection in diamond. Sci Rep 10, 14884 (2020).

Download citation

Further reading


By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing