Diamond based quantum technology is a fast emerging field with both scientific and technological importance. With the growing knowledge and experience concerning diamond based quantum systems comes an increased demand for performance. Quantum optimal control (QOC) provides a direct solution to a number of existing challenges as well as a basis for proposed future applications. Together with a swift review of QOC strategies, quantum sensing, and other relevant quantum technology applications of nitrogen-vacancy (NV) centers in diamond, the authors give the necessary background to summarize recent advancements in the field of QOC assisted quantum applications with NV centers in diamond.

## I. INTRODUCTION

The nitrogen-vacancy (NV) center^{1,2} is one of the major platforms in the evolving field of quantum technologies. Its remarkable stability, long spin coherence time, and optical properties make it especially attractive for quantum applications. Like any other quantum system, however, it is subject to experimental imperfections and limitations. Quantum optimal control^{3} (QOC) aims to improve the efficiency of system manipulation under such constraints. In this introductory review article, we aim to provide an overview of the NV center applications that can be improved with QOC and outline the modus operandi for their implementation.

This review has been organized as follows: Sec. II introduces NV centers in diamond and their most useful properties. Section III reviews the basic quantum sensing techniques, and provides a brief account of possible quantum information and computation applications of NV centers. Section IV breaks down the principles and methods of QOC theory. This includes an introduction on the structure of QOC problems and an overview of some of the most common numerical QOC algorithms. Section V reviews the control techniques discussed in Sec. IV applied to the system and methods discussed in Secs. II and III, respectively. This review has been written such that the reader can refer to Secs. II and IV more or less independently. Finally, the Appendixes give a description of the relevant Hamiltonians for the NV center spin system.

## II. THE NITROGEN-VACANCY CENTER

Diamonds host a variety of point defects,^{5,6} i.e., lattice sites where one of the carbon atoms is replaced with a different atom or vacancy. The appearance of color in pure diamond is due to the presence of particular optically active point defects. Ib diamonds, for example, are yellow [see Fig. 2(a)] due to single substitutional nitrogen impurities. Such fluorescent point defects have a unique spectral signature and are called color-centers. Among them are the silicon-vacancy center,^{7} the germanium-vacancy center,^{8} the tin-vacancy center,^{9} the NV center, and several others, which have been extensively studied over the past two decades.^{5,10} It is noteworthy that the color centers in diamond emit photoluminescence (PL), which is bright enough to enable observation of single defect sites with a confocal microscope, e.g., in regular patterns of nanostructures (see Fig. 1 and caption for details). To add the capability for spin manipulation, microwaves (MWs) are applied to the color centers under investigation.

The subject of this review, the NV center, is formed when one of the four carbon atoms in the unit cell of the diamond lattice is replaced by a nitrogen atom, accompanied by the formation of a neighboring vacancy site, shown in Fig. 1. NV centers have three known energetically stable states; NV^{−}, NV^{0}, and NV^{+}. In this review, we limit our focus to NV^{−} (from here on simply called NV). It is the most promising of the three for applications in quantum metrology and quantum information because of its magneto-optical properties. In Secs. II A and II B, we briefly describe these useful characteristics of the NV center for the matter of clarity and self-sufficiency with a main focus on optimal control applications. For more details, we refer the reader to more in-depth reviews on NV centers and related applications.^{2,14,15}

### A. General properties of NV centers in diamond

As a host material, diamond itself has a number of useful properties, including hardness, high refractive index, and nontoxicity. Various techniques can be used to manufacture NV center containing diamond (Fig. 2). The main fabrication methods include high pressure–high temperature (HPHT) synthesis, detonation synthesis, and chemical vapor deposition^{16,17} (CVD). While detonation synthesis only leads to nanodiamonds [see Fig. 2(b)]. HPHT and CVD produce diamonds of various morphologies including bulk and single crystals. Very recently, upscaling single crystal CVD diamond to wafer scales (10 cm) has been accomplished via heteroepitaxy^{13} [see Fig. 2(d)]. Ion implantation^{18} is commonly used to create NV centers in diamond; other methods include doping the crystal during the growth process to incorporate the desired impurity. The availability of a broad range of materials fosters a spectrum of applications including scanning probe diamond tips [Fig. 2(c)] with single NV centers for nanoscale sensing,^{19–24} engineered NV ensemble based sensors,^{25} wide field imaging with NV center ensembles in bulk diamond,^{26} and diamonds coupled to cavities^{27–30} as well as biological application^{31–34} in different environments, temperature, and pressure ranges.

Despite the many advances in material synthesis techniques, diamonds have inherent noise sources that limit the performance of NV center-based applications. In diamonds with exotic geometries like the scanning probes (Fig. 2) as well as systems with shallow NV centers, even the external environment plays a big role. Accordingly, the protection from both inherent and external noise has a high priority for the NV center community to improve performance. Exploring techniques of QOC (Sec. IV) promises to make the aforementioned spin systems more robust against unwanted noise.

Also important for its applicability is the NV center's electronic structure^{35–37} (Fig. 3): The vacancy site contains six electrons (three dangling carbon electrons, two nitrogen electrons, and one electron trapped from a nearby donor in the crystal lattice as shown in Fig. 1), which form a spin triplet system with $ms=\xb11,0$. The electrons are tightly bound to the defect making the NV center a truly atomic sized system.

As depicted in Fig. 3, the excited and ground state spin triplets are separated by 1.945 eV, corresponding to a purely radiative transition [zero-phonon line (ZPL) in Fig. 4(a)] at 637 nm. Additionally, intermediate singlet states occur energetically in-between the triplet states. At thermal equilibrium, the spin population in the ground states is governed by the Maxwell–Boltzmann distribution law.^{38} Upon irradiation with a green laser (*λ* = 532 nm), the population in the ground states is transferred to the excited levels through a combination of radiative absorption and nonradiative relaxation processes, involving the excited levels of the NV center and the conduction band of the diamond crystal. The excitation process is followed by direct radiative decay as well as nonradiative decay through the intermediate states. The radiative transitions between the ground and excited states are spin preserving; the decay via the intermediate states, however, is not (although it is spin dependent, nonetheless). The decay rate from the excited level $ms=\xb11$ spin states to the intermediate singlet state is comparable to the rate of the direct radiative decay to the ground state. For the excited level *m _{s}* = 0 spin state, the decay via the singlet state is negligible. This results in a majority of the population being pumped into the

*m*= 0 ground-level spin state under laser illumination.

_{s}The transition frequency in the absence of an external field between the degenerate $ms=\xb11$ and the *m _{s}* = 0 spin states in the ground-level is 2.871 GHz. An external magnetic field lifts the degeneracy of the $ms=\xb11$ states as depicted in Fig. 3 and experimentally observed in Fig. 4(c) (Zeeman splitting). If the magnetic field is sufficiently strong, the $ms=\xb11$ states are well separated in frequency allowing for the spin system to be approximated as a qubit, with one of the $ms=\xb11$ states and the

*m*= 0 state forming the two qubit levels.

_{s}______________________

**Example 1.** Rabi oscillations

Let us consider an example (also see the example in Sec. IV A), approximating the NV center as a two level system with the ground state $|0\u27e9$ and excited state $|1\u27e9$. This assumption holds when the $ms=\xb11$ spin states are nondegenerate under the influence of a static magnetic field along the NV axis. It is common practice to consider the NV axis as the quantization axis (Fig. 1). The system can be initialized in the *m _{s}* = 0 ground state with a green laser pulse. Subsequently, a MW field of frequency

*ω*is applied to resonantly drive the transition $|0\u27e9\u2194|1\u27e9$, leading to a continuous population transfer. The observed coherent oscillation (Rabi flopping) of the population between the spin states is shown in Fig. 5.

_{nv}Figure 5 also shows the Bloch sphere representation of the NV qubit spin state. The north pole of the Bloch sphere corresponds to the pure $|1\u27e9$ state, whereas the south pole indicates the pure $|0\u27e9$ state. The Bloch vector (red arrow) represents the spin state of the system at a given instance and $x\u0302$ and $y\u0302$ indicate the polarization of the driving field in the rotating frame (see Appendix B). Pulses rotate the state vector with a speed dependent on the driving field strength around an axis dependent on its phase (blue curve). A rotation by 180°, in this case fully transferring the population from *m _{s}* = 0 to

*m*= 1, is referred to as a

_{s}*π*-pulse. $\pi /2$-pulses rotate the state-vector by 90°. In this case, they would create a superposition state between

*m*= 0 and

_{s}*m*= 1. The Hamiltonian for this system in the rotating wave approximation (RWA) (see Appendix B) is given by Eq. (6). If the drive is constantly applied, the system undergoes Rabi oscillations as shown in Fig. 5 with a frequency Ω that is proportional to the strength of the applied microwave field.

_{s}The decay of the amplitude of oscillation is owed to the inherent decoherence and decay processes in the spin system.

______________________

The following points summarize the properties that render NV centers well suited for quantum technology applications:

The NV center has a magnetically active ground-level spin triplet state with the $ms=\xb11$ states exhibiting Zeeman splitting (Fig. 3) in the presence of external fields. This sensitivity toward external fields is the key to the majority of sensing applications.

In addition, the transition between the ground-level spin states can be coherently manipulated with microwaves.

The ground-level spin states also exhibit spin dependent fluorescence due to selection rules and the transition rates mentioned above. It ensures a clear readout contrast between the two qubit levels, which is crucial for quantum applications [see Fig. 4(d)]. Alternatively, other readout schemes based on NV charge state detection are also possible.

The

*m*= 0 spin state of the ground-level triplet can be efficiently initialized via an off-resonant laser excitation; this qubit initialization is a pivotal property for all quantum sensing and quantum computation applications._{s}The nuclear spins in the NV center cluster exhibit dynamic nuclear polarization,

^{39}opening up the possibility of nuclear spin-based quantum computation applications.All these properties are exploitable at room as well as cryogenic temperature.

Additionally, diamond is a biocompatible host, which is crucial for life science applications.

Various other properties (Fig. 4), e.g., stable emission of single photons, also make these spin systems highly suitable for quantum sensing and quantum information applications.

### B. Spin Hamiltonian

Before we explore the vast field of applications of the NV center, it is useful to study the governing Hamiltonian for the spin system in order to understand the theoretical basis of the applications. The NV center spin in the diamond lattice undergoes a variety of interactions because of external magnetic and electric fields, as well as the crystal strain field, and other spins in the crystal lattice. The spin Hamiltonian for the NV center's ground-level spin triplet can be obtained on the basis of the $ms=\xb11$ and *m _{s}* = 0 spin operators. It can be derived by perturbative expansion of the full Hamiltonian of the system in terms of the spin operators (see Appendix A for more details), such that the thermal degrees of freedom average out.

^{40,41}Assuming the NV axis to be the quantization axis, the spin Hamiltonian can be written as

The first term in the Hamiltonian above is the zero-field term, i.e., the system Hamiltonian in the absence of external fields, where $\u210f$ is the reduced Planck constant, $S\u2192\u0302=(S\u0302X,\u2009S\u0302Y,\u2009S\u0302Z)\u22ba$ are the spin operators (see Appendix A), *D* is the axial, and *E* is the nonaxial zero-field parameter, respectively. At room temperature and ambient pressure, $D\u2248$ 2.87 GHz varies by around $\u221280\u2009\u2009kHz/K$ and $1.5\u2009kHz/bar$ with temperature and pressure changes, respectively (see Secs. III A 3 and III A 4).

The second term in the Hamiltonian represents the magnetic field interaction, where $\gamma nv=2\pi \xd728$ MHz/mT is the gyromagnetic ratio for the NV center spin and $B\u2192$ is the external magnetic field.

The electric field interaction with the NV center spin is represented by the third term in the Hamiltonian. $E\u2192=(EX,EY,EZ)\u22ba$ is the effective electric field vector, representing contributions from external electric fields as well as the crystal field, arising from crystal strain and pressure (see Sec. III A 4). $\delta \u2225$ and $\delta \u22a5$ are the axial and transverse coupling constants, respectively, arising from the symmetry of the crystal structure at the site of the NV center. In comparison to the magnetic field, the electric field has a much weaker interaction with the NV spin, with $\delta \u2225$ at around $0.17\u2009Hz/(V\u2009m\u22121)$ and $\delta \u22a5$ of the order of $10\u22123\u2009Hz/(V\u2009m\u22121)$.

The NV center spin interacts with other spin systems in the host crystal and its surroundings. The most dominant interactions are with the ^{15}N or ^{14}N nucleus in the NV center and the ^{13}C nuclear spins in the surrounding diamond lattice. These spin–spin interactions are represented by the hyperfine interaction terms in the Hamiltonian. $Ni$ is the hyperfine interaction tensor between the electron and the $ith$ nuclear spin and $I\u2192\u0302i$ is the nuclear spin operator. There are two main contributions to the hyperfine interaction tensor: First, the isotropic Fermi contact interaction that arises from the interaction of the electron cloud with the nearby nucleus (see Appendix A). Second, the anisotropic magnetic dipole interactions of the NV spin with distant nuclear spins. The magnitude of the latter interaction decays as $1/r3$ with the distance *r* from the nuclear spin and is comparatively weaker than the Fermi contact interaction terms.

On top of the hyperfine coupling, the nuclear spins also interact with the external magnetic field. This is represented as the nuclear Zeeman interaction term, where *γ _{i}* is the gyromagnetic ratio of the corresponding nuclear spin

*i*.

Finally, nuclei like ^{14}N can exhibit quadrupole splitting; this is represented by the last term in the Hamiltonian. Here, $Qi$ represents the quadrupole splitting. As an example, the quadrupole splitting for the ^{14}N nuclei inside the diamond lattice has been estimated to be around 5 MHz.^{42}

The reader is advised to refer to Appendix A for a detailed description of these Hamiltonian terms and their origins.

## III. QUANTUM TECHNOLOGY APPLICATIONS WITH NV CENTERS

We now proceed with the exploration of the versatility of NV centers in terms of their potential applications in quantum technologies. As quantum sensors, they have been utilized for magnetic and electric field sensing (Secs. III A 1 and III A 2), thermometry (Sec. III A 3), strain/pressure measurements (Sec. III A 4), orientation tracking, and more. NV centers have further found application in quantum information related experiments (Sec. III B). In addition, the NV center is also a reliable nonclassical source of single photons and has been utilized in various single photon experiments.^{43,44}

### A. Quantum sensing applications

In principle, NV centers possess the necessary properties to be practical quantum sensors.^{45} The efficient spin state initialization/readout and the sensitivity to various physical parameters have resulted in a variety of diamond based sensing applications. As diamonds are simple to handle in terms of logistics, maintenance, and manipulation in comparison to other (atomic) quantum systems, their application has received a lot of attention. The main focus has been on using the quantum nature of the defect center's spin to detect classical physical signals (called classical detection, in contrast to quantum detection, which is based on the use of entanglement^{45}). In several sensing applications, NV centers have proven to outperform their counterparts. Figure 6 shows one such example, juxtaposing different scanning magnetometers that are commonly implemented for sensing. A summary of the different measurable parameters with NV center-based sensors is provided in Table I. The sensing methods rely on efficient and coherent spin manipulation, whereby experimental imperfections limit their success. In this section, we briefly discuss different sensing protocols, experimental limitations, and other challenges. A review of the current techniques based on QOC (see Sec. IV) to overcome/circumvent the described obstacles and efficiently use the NV centers as quantum sensors is given in Sec. V A. For completeness, we also outline related applications in quantum information and computation.

Sensed parameter . | Parameter/sensitivity dependence . | Reported sensitivities . | References . |
---|---|---|---|

Magnetic field (B) | $\eta B=\sigma [\u2202S/\u2202B]maxtm$ | pT-μT/$Hz$ | Balasubramanian et al. (Ref. 59), Webb et al. (Ref. 72), and Neumamm et al. (Ref. 73) |

Electric field ($E$) | $\eta E=\sigma [\u2202S/\u2202E]maxtm$ | $\u2248100$ V/cm/ $Hz$ | Dolde et al. (Ref. 70) |

Temperature ($T$) | $\delta D\delta T,\u2009\delta E\delta T$ | 10–100 kHz/K, $\u22121.4\xd710\u22124$ Hz/K | Dolde et al. (Ref. 74) and Acosta et al. (Ref. 71) |

Pressure (P) | $\delta D\delta P$ | $105\u2013106$ Pa/$Hz$ | Doherty et al. (Ref. 75) |

Sensed parameter . | Parameter/sensitivity dependence . | Reported sensitivities . | References . |
---|---|---|---|

Magnetic field (B) | $\eta B=\sigma [\u2202S/\u2202B]maxtm$ | pT-μT/$Hz$ | Balasubramanian et al. (Ref. 59), Webb et al. (Ref. 72), and Neumamm et al. (Ref. 73) |

Electric field ($E$) | $\eta E=\sigma [\u2202S/\u2202E]maxtm$ | $\u2248100$ V/cm/ $Hz$ | Dolde et al. (Ref. 70) |

Temperature ($T$) | $\delta D\delta T,\u2009\delta E\delta T$ | 10–100 kHz/K, $\u22121.4\xd710\u22124$ Hz/K | Dolde et al. (Ref. 74) and Acosta et al. (Ref. 71) |

Pressure (P) | $\delta D\delta P$ | $105\u2013106$ Pa/$Hz$ | Doherty et al. (Ref. 75) |

#### 1. Magnetic field sensing

Magnetic field sensing is the most common application of NV centers as quantum sensors. As illustrated in the full Hamiltonian Eq. (1), the external magnetic field interacts directly with the NV spin. In addition to continuous wave spectroscopy experiments [Fig. 4(c)], several nuclear magnetic resonance (NMR)/EPR based spin manipulation techniques^{51} with microwave pulses can be applied to quantify the magnitude of the interaction as well as the directional dependence of the external field to be studied. These techniques pave the way for vector magnetometery,^{20} magnetic field imaging at the nanoscale,^{21} detection of single spins,^{52} and a number of other applications. All these methods rely on efficient initialization (laser), manipulation (microwaves) and readout (typically laser, although several other possibilities exist,^{53,54} see the study by Barry *et al.*^{14} for details) of the spin system.

The most basic sensing protocol is the direct measurement of the Zeeman splitting (see Sec. II B) under the influence of an external magnetic field [Fig. 4(c)]. This technique requires the application of a continuous, off-resonant laser to the spin system. The MW frequency is swept, driving the $ms=0\u2194ms=\xb11$ transition when the resonance condition is met. This in turn results in a measurable decrease in the fluorescence from the NV center [see Fig. 4(c)]. Gruber *et al.*^{55} demonstrated the first of these optically detected magnetic resonance (ODMR) experiments with a single NV center, showing that the splitting of resonant peaks (dips) gives information about the external magnetic field.

Nonpolarized (thus randomly flipping) spins proximal to the NV center create fluctuating magnetic fields at the position of the NV center. The interaction strength of the NV center with the fields fluctuating at the transition frequency between $ms=0\u2009and\u2009ms=\xb11$ can be directly inferred from the lifetime (*T*_{1}) of the spin states. Such relaxometry techniques have been, in particularly, used for life science applications,^{26} magnetic noise sensing,^{56} and surface and material studies.^{57}

Another common method for DC magnetometery is the Ramsey interference pulse technique^{58} depicted in Fig. 7. Balasubramanian *et al.*^{59} first experimentally demonstrated this method with NV centers using ultrapure CVD grown single crystal diamond as a host material. In theory, the Ramsey sequence is the spin equivalent of an optical Mach–Zehnder interferometer. It is based on measuring the phase induced by external perturbations on a superposition state of the spin system. The “mirrors” and “beam splitters” for this interference experiments are formed by the $\pi 2$-pulses applied at MW frequency (Fig. 7). The induced phase $\varphi $ is directly proportional to the external magnetic field component $B\u2225(t)$,

where *τ* is the free spin precession duration. The phase accumulation arises from the Larmor precession of the spin about the magnetic field vector.

Additional pulses can be used to cancel out the phase induced by the DC field, so that the phase information can be used for measuring AC magnetic fields (Fig. 8).

This idea is exploited in the spin-echo pulse sequence^{60} (Fig. 8). The additional *π*-pulse refocuses the signal such that the total phase accumulation in this case is

When the time period of the AC field is an even multiple of the free precession time *τ*, the two terms for phase accumulation above are equal and cancel each other [see Fig. 8(b)]. This way the phase induced by slowly varying fields over the entire sequence is zero. Such spin manipulation experiments with NV centers have been independently reported by several authors in the last decade.^{59,61–63}

The spin-echo protocol with a single refocusing *π*-pulse is the basic building block of the dynamical decoupling (DD) sequences^{64} (Fig. 9) that make use of multiple refocusing *π*-pulses. Decoupling the system from DC or slowly varying fields is accompanied by coupling to a given frequency signal (Fig. 8). The general phase accumulation for a series of *π* pulses over a duration of time *t* can be estimated as

where $M$ is known as the modulation function and reflects whether the phase accumulated over the specific period *τ* in the sequence is positive or negative (Fig. 9).

In the case of a broadband external field (periodically or randomly oscillating), the contribution to the total phase induced by different frequency components depends on the so-called weighing function [Fig. 9(b)] for the given pulse sequence. These weighing functions are similar to those of narrow-band frequency filters, i.e., they enhance signals from resonant frequencies and suppress nonresonant external field contributions.^{65} Decoupling the spin system from the noisy spin bath in the diamond crystal enhances the coherence time of the spin states.^{66} It also improves the sensitivity toward the targeted signal which is limited by the spin dephasing ($T2*$) and spin decoherence (*T*_{2}) times. For more information on the nature, usefulness, and application of these DD-sequences and filter functions for quantum sensing, the reader may refer to the extensive review on the topic by Degen *et al.*^{45} QOC (Sec. IV) offers an alternative approach to enhance the coherence time for systems with high frequency noise such as shallow NV centers. In addition, the hard pulse approach (i.e., using rectangular pulses) is subjected to cumulative errors with respect to the phase and duration of the pulses that become significant for longer DD sequences. QOC provides an elegant solution to avoid such errors, which is useful for sensing applications as well as quantum information and computation applications (Sec. III B) that require high fidelity gate operations.

As an indirect application of magnetic field sensing, gyroscopic measurements with NV centers have been performed.^{67,68}

#### 2. Electric field sensing

The coupling of the magnetic field to the NV spin is much stronger than that of the electric field. Hence, electric field sensing techniques^{69} are experimentally more challenging. However, the external electric field directly influences the spin, as discernible from the Hamiltonian in Eq. (1).

Comparing their coupling, the magnetic field's effect (represented by *γ _{nv}*) is of the order of a few GHz/T,

^{20}whereas the analogous constant of the electric field $EI$ is of sub-Hz/(V m

^{–1})-order,

^{69}making the coupling very weak, as indicated in Sec. II B. Nevertheless, electric fields are also detected quantitatively by the phase induced during the pulse sequence. Hence, similar spin manipulation protocols as employed for magnetic field sensing are used for detecting electric fields. As the signal is much weaker than that for magnetic fields, the challenge lies in separating it from the effects of other strong undesirable interactions.

Dolde *et al.*^{70} exploited the interplay between magnetic Zeeman effect, Stark effect, and crystal strain field in their carefully devised experiment to suppress the magnetic field effects on the NV spin, making the shifts in the electric field transitions more prominently detectable via spin manipulation protocols (Fig. 10).

#### 3. Thermometry

Unlike the electric and magnetic fields, temperature is not directly coupled to the spin system (strictly speaking spin-phonon coupling is still temperature dependent; however, temperature as a parameter does not directly couple to the spin). Instead, temperature fluctuations have a direct effect on the crystal field as they affect the lattice constant of the crystal. This in turn influences the zero-field splitting parameters discussed in Sec. II B. Acosta *et al.*^{71} reported the dependence of the parameters *D* and *E* on temperature, demonstrating that temperatures changes can be directly quantified from ODMR spectra (Fig. 11). They found that the axial zero-field splitting parameter is more sensitive to temperature changes than the nonaxial parameter. Neumann *et al.*^{76} utilized the D-Ramsey spin manipulation protocol to suppress the effect of external magnetic fields, paving the way to an enhanced measurement of temperature changes.

#### 4. Pressure and strain sensing

Similar to the temperature, other physical quantities like pressure and strain affect the crystal field. Changes in these quantities can be studied by their coupling to the zero-field splitting parameter.

Doherty *et al.*^{75} reported the effect of hydrostatic pressure on the ZPL and the ground state ODMR of NV centers at room temperature in a hydrostatic pressure medium (Fig. 12). Crystal strain variations lead to changes in the effective electric field as described in Sec. II B. The reader is referred to Maze *et al.*^{20} for a theoretical description of the effect of strain on the NV center's electronic structure. Teissier *et al.*^{77} reported NV spin–strain coupling in diamond cantilever devices.

### B. Quantum information and computation applications

The same characteristics that make NV centers a promising sensor also qualify them in the fields of quantum information and computation.^{78} As described in Sec. II A, the NV electron spin interacts with the internal N nuclear spin of the NV center and ^{13}C nuclear spins in its close proximity (NV center cluster). Abobeih *et al.*^{79} showed that even a much more precise characterization is possible: They imaged a 27-nuclear spin cluster using a single NV center. Considering the surrounding nuclei, the resulting hyperfine structure^{80} (see Sec. II B and Appendix A) forms a more complex quantum mechanical system than a single electronic qubit. In fact, the majority of quantum computation applications can, in principle, be performed with a nuclear spin qubit, using the NV center electron as a quantum bus qubit for initialization and readout.^{42,81}

This technique has led to various NV-based applications such as quantum error correction (QEC),^{82–84} quantum algorithms,^{85,86} quantum simulation,^{87,88} fault-tolerant quantum repeaters for long-distance communication,^{89} and quantum memory.^{90–92}

Entanglement between optical photons and the NV spin has also been demonstrated experimentally.^{93} In rare cases, two NV centers might be close enough to each other for dipole–dipole interaction.^{74} This provides another possible source of entanglement and is further described in Appendix A. In the proceeding paragraphs, we describe applications mainly regarding the use of NV centers as quantum registers, entangling gates with NV centers, and use of NV center qubits to perform quantum error correction.

Quantum registers are at the heart of quantum computation techniques (Fig. 13). They contain the coupled set of qubits, which are used to perform quantum computations. The nuclear spins in the NV center cluster exhibit long coherence times at room temperature, which is an essential feature for spin system based quantum registers. Recently, Bradley *et al.*^{94} presented a quantum register based on the electron spin of an NV center together with nine nuclear spins depicted in Fig. 13. To efficiently implement gates in such a large system, they simultaneously used dynamical decoupling based gates on the NV center electron spin and selective phase-controlled driving of the nuclear spins. As a result, they saw coherence times from 10 s up to a minute at room temperature. In a different approach, Neumann *et al.*^{95} demonstrated the working concept of a diamond-based spin register containing two optically addressable NV center spin qubits coupled to each other in an ultrapure and isotopically engineered CVD grown diamond. NV center-based spin registers have also been used for quantum simulation of molecules.^{87}

Similar to the way quantum registers form the underlying structure, entanglement generation enables the connections required for any quantum information technology (entanglement also plays a vital role in several quantum sensing applications; for moreinformation, the reader is advised to refer to the study by Degen *et al.*^{45}). For example, Dolde *et al.*^{96} demonstrated NV–NV spin entanglement at room temperature, while Neumann *et al.*^{97} demonstrated entangled two- and three-particle quantum states with ^{13}C nuclear spins in an NV center-based quantum register.

Another essential concept for fault-tolerant quantum computation is QEC. As mentioned above, NV-based spin registers may provide systems with long coherence times and desired entanglement properties. These are prerequisites to implement standard QEC protocols. Taminiau *et al.*^{83} demonstrated error correction with a spin register of nuclear spins from the NV center cluster, using the NV center electron spin as the control qubit. In another work, Unden *et al.*^{98} demonstrated enhanced quantum sensitivity with metrology techniques based on iterative quantum error correction. Casanova *et al.*^{99} performed a complete set of universal quantum gates with an NV center-based spin register, providing a proof of principle for NV center-based quantum computation.

To obtain better control over the qubit system, several QOC based methods have been implemented so far. They helped to overcome decoherence effects caused by the environment and to circumvent experimental limitations. We will review some of these works in Sec. V B.

Furthermore, NV centers have been long known as a nonclassical photon source,^{43,100} which was applied in single and two photon interference experiments.^{101,102} The NV center has also been used for Bell's inequality test related experiments.^{92}

## IV. OPTIMAL CONTROL THEORY

Without the ability to precisely manipulate quantum systems, researching their properties and applying them for quantum technologies is almost impossible. QOC theory^{3,103} improves the shape of dynamical controls (typically electromagnetic field pulses) to achieve a certain goal to maximum precision. The section starts with the details of defining a QOC problem in Sec. IV A followed by a description of different numerical optimization tools in Sec. IV B and concluded by a brief discussion of the limits of QOC (Sec. IV C). The first part is structured according to the schematic in Fig. 14.

In the field of NMR, pulse shaping has been used since the 1980s^{104} and many of the arguments for pulse shape optimization^{105} equally apply to NV centers, which we will focus on. In many cases, the time scales defining the decay of NV centers are large compared to the control time. In that case, it is sufficient to study closed system dynamics. Indeed, specific open system techniques such as population suppression and the exploitation of useful dissipation processes are often not applicable to the problems considered in this review.^{106} Hence, we limit ourselves to a closed system description.

### A. Defining a control problem

The principles of QOC theory derive from early extremization problems such as Johann Bernoulli's brachistochrone curve problem.^{107} Similarly, QOC problems are formulated through a system of equations, which broadly defines three things: First, the system dynamics, i.e., the theoretically obtained description reflecting the system's behavior, for example, given by the Hamiltonian. Alternatively, this first equation might be replaced by a description through the experiment itself. Second and third, the control objectives and control space restrictions. The objectives on the one hand set the goal of the optimization, like, e.g., high fidelity for the transfer to a target state. The control space restrictions, on the other hand, limit the resources that may be used to reach the desired goal. Together, the three aspects are combined into a so-called control landscape. Each set of controls will result in a different value of the “cost function” *J*, a measure for how close the system is to reaching the objective. In the case of a minimization (and throughout this review, we will always assume minimizations, unless stated otherwise), each valley corresponds to a locally optimal combination of controls. The goal of the optimization can now be easily defined as reaching the lowest point in the landscape.

Next, we will discuss in more detail these three ingredients of QOC problems as well as the initial guess, stopping criteria, and robustness.

#### 1. System dynamics

One way to characterize the evolution of a closed quantum system with time dependent controls is through Schrödinger's equation. The system Hamiltonian is usually split into two parts: the drift Hamiltonian $H\u0302d$, which is constant and cannot be manipulated, and the control Hamiltonians $H\u0302ic$ which are multiplied with time-dependent coefficients $ui(t)$ called “control pulses.” The full Hamiltonian then reads

Note that system dynamics for control problems may also be defined through Lindblad-operators and even for non-Markovian dynamics (for a review on open systems QOC see Koch^{106}).

______________________

**Example 2.** Drift and control Hamiltonian

As an example, let us consider a NV center, approximated as a qubit with the ground state $|0\u27e9$ and excited state $|1\u27e9$. In this simple consideration, the goal will be to create a high-fidelity $(\pi 2)x$-rotation similar to the system by Frank *et al.*^{108}

A static magnetic field $B\u2225$ is applied in the *z* direction (the quantization/NV axis) and a circularly polarized microwave field $B\u2192\u22a5$ with an amplitude $B\u22a5(t)$, frequency *ω _{mw,}* and phase $\phi $ is applied orthogonal to $B\u2225$. Let us define the gyromagnetic ratio of the NV center as

*γ*. The rotating frame of $B\u2192\u22a5$ then gives the Hamiltonian,

_{nv}where $\Delta =\omega nv\u2212\omega mw$ is the detuning, $\omega nv=B\u2225\gamma nv$ is the NV's resonant frequency, $\Omega (t)=B\u22a5\gamma nv$ is the Rabi frequency, and $s\u2192\u0302$ are the spin operators in the $|0\u27e9,|1\u27e9$ basis. A derivation of this Hamiltonian can be found in Appendix B.

We can easily identify the drift Hamiltonian $H\u0302d=\Delta s\u0302Z$. Let us assume that both the Rabi frequency $\Omega (t)$ and the phase of the magnetic field $\phi (t)$ can be manipulated dynamically. The control Hamiltonians may then be identified as $H\u03021c=s\u0302X$ and $H\u03022c=s\u0302Y$ and the control pulses as $u1(t)=\Omega (t)\u2009cos\u2009\phi (t)$ and $u2(t)=\Omega (t)\u2009sin\u2009\phi (t)$.

______________________

Once the system has evolved, it is time to test whether the goals have been reached by checking the control objectives.

It should be noted at this point that the rotating wave approximation (RWA), as presented in Appendix B, is widely used to simplify the NV center's Hamiltonian. While it is useful, when the Rabi frequency is much lower than the NV center's resonant frequency, it can have a detrimental effect on a simulation's accuracy, if the Rabi frequency is of a similar scale to the qubit transition. In fact, Scheuer *et al.*^{109} have shown how the inaccurate use of the RWA can affect the outcomes of optimal control procedures designed for NV centers.

#### 2. Control objective(s)

The cost function (or figure of merit) *J* defines what is minimized in any QOC problem. This way it describes the goal of the optimization (terminal cost) and optionally the control limits through penalty-terms (running costs). The terminal costs are determined at the final time of the system's evolution. They quantify, for instance, the distance between the final state and the desired goal state in the relevant Hilbert space. The running costs are usually related to the restrictions on the control pulses, for example, the limited power of a microwave source. In this review, the cost function is defined to be zero, when all objectives are met and to be greater than zero, when they are not met. Note that the running costs have a similar role to the control space restrictions that will be discussed in Sec. IV A 3.

##### a. State to state transfer (terminal cost)

State to state transfer is the most common optimization objective and has been used in many papers.^{108,110–112} The infidelity is a measure for the distance between two states $|\varphi t\u27e9$ and $|\varphi (T)\u27e9$: If they are equal, it gives zero; if they are orthogonal, it has a value of one. The infidelity can be used directly to define the cost function $Jstate$,

describing the distance between $|\varphi (T)\u27e9$, the final state of the system at time *T*, and $|\varphi t\u27e9$, the target state. An alternative way to formulate the transfer is fixing the global phase using $Jstate=1\u2212\u211c{\u27e8\varphi (T)|\varphi t\u27e9}$.

##### b. Unitary gate optimization (terminal cost)

To measure the distance between the unitary *U*(*T*) produced by the controls and the target gate *U _{t}*, we define the cost function,

In the second line, the gate fidelity is defined through the *N*_{0} basis states $|\zeta i\u27e9$ of the initial system and their propagated version $|\varphi i(T)\u27e9=U(T)|\zeta i\u27e9$. Similarly to $Jstate$, we can also define a global phase dependent version of this cost function, $Jgate=1\u2212(1/N0)\u211c{Tr(Ut\u2020U(T))}$. Examples for its application can be found in Refs. 113–116.

##### c. Sensitivity (terminal cost)

In contrast to the previous examples, the sensitivity does not directly contain information about the system. Instead, it quantifies the amount of information about a parameter *θ* (e.g., the magnetic field) that may be derived from a set of measurements.

The sensitivity may be defined as the variance $(\Delta \theta )2$ of the parameter estimate *θ*_{0} obtained from *N _{M}* measurements. Each measurement produces the expectation value of some positive-operator-values measure (POVM)

^{117}Θ. The probability to measure $\theta (|\varphi \u27e9)=x$ probing a wavefunction $|\varphi \u27e9$ is then given by the expectation value $p(x|\theta )=\u27e8\varphi |\Theta |\varphi \u27e9=Tr(\rho \Theta )$, with $\rho =|\varphi \u27e9\u27e8\varphi |$.

The cost function should, however, not contain information about the outcome of the measurement, but rather about its precision. The lower bound of $\Delta \theta $ is given by the Cramér-Rao bound,

a value which is inversely proportional to the Fisher information $F(\theta )$, calculated by

where the second line is specifically related to a discrete number of possible measurement outcomes *N _{x}*.

One may interpret the Fisher information as the curvature of the logarithmic probability distribution: If it is completely flat, hence giving no information, $F(\theta 0)=0$; if it is strongly peaked, indicating a clear parameter estimate, $F(\theta 0)\u226b0$.

The corresponding cost function may be defined as

Reviews introducing Fisher information in the context of quantum sensing and metrology were written by Degen *et al.*^{45} and Pezze *et al.*^{118} The original paper relating Fisher information and quantum mechanics was published in 1994 by Braunstein and Caves.^{119} Applications of Fisher information as a part of optimal control can be found in Refs. 120 and 121.

##### d. Limited power (running cost)

The power of a control pulse is typically calculated as $Pi=\u222b0T|ui(t)|2dt$. To limit *P _{i}* to a reasonable range $Pi\u2208[0,Plim]$, a penalty term can be introduced which adds a high cost to

*J*, if a certain limit is crossed,

The function $\kappa (Pi)$ should give very little to no penalty, if the power is within the acceptable range $\kappa (Pi\u226aPlim)\u21920$ and a high penalty, if it is out of range $\kappa (Pi\u226bPlim)\u2192\u221e$. These criteria can be satisfied by a wide variety of functions and it depends on the chosen system, which one should be used. Examples can be found in a number of references.^{105,122–124}

##### e. Limited bandwidth (running cost)

There are a number of ways to limit the bandwidth of the controls. One solution is to gently punish any quickly oscillating solutions through

where *ϵ* is some small factor.^{125} It should be noted that this expression does not give strict bounds in terms of bandwidth. An alternative, stricter approach is to punish fast oscillations, only if they lie outside a predefined filter function as described by Schäfer *et al.*^{126} and Kosloff's group.^{127,128} A completely different approach is to restrict the basis of the control pulses. This is possible with certain algorithms of the dressed chopped random basis algorithm [(d)CRAB] family including gradient optimization using parametrization (GROUP) and gradient optimization of analytic controls (GOAT) and will be further discussed in Sec. IV B.

There are many more possible terminal costs, each describing a different control problem including partial state transfer, taking into account the full density function, maximizing entanglement,^{129} or adjusting a certain observable.^{130} Similarly, equally many different running costs exist, e.g., to avoid populating fast decaying states.^{131}

______________________

**Example 3.** Gate optimization

In the experiment by Frank *et al.*,^{108} the control objective was to optimize a unitary defined as the Hadamard gate,

Hence, the cost function may be defined as

We can see that this is a good cost function as it is minimal when $U(T)=Ut$ at the final time *T* (up to a global phase). If we were to also include a bandwidth limitation on the two control pulses $u1(t)$ and $u2(t)$, we may simply sum up different cost terms. The resulting cost function, where *ϵ _{i}* are some small factors, would be

______________________

Running costs favor acceptable types of controls, as opposed to physically impossible ones, but if stricter limits are required, control space restrictions might be the more suitable mean of limitation.

#### 3. Control space restrictions

While the running costs (see Sec. IV A 2) can only passively punish controls, which lie outside the achievable frame, control space restrictions actively change the controls to only allow what is experimentally achievable. One might imagine them as a horizontal squeezing and stretching of the control landscape or as the introduction of hard walls (see Fig. 15), opposed to a vertical distortion induced by running costs.

______________________

**Example 4.** Restricting the control amplitude

As an example, let us consider the amplitude of a control pulse $ui(t)$ that should be restricted to $uimax$. The pulse could be cut off at the beginning of each iteration according to

This form ensures maximum exploitation of the amplitude space but is not differentiable; hence, it requires that the control pulse is cut off during an extra step (Fig. 14) before the cost function and/or gradient is evaluated.^{132}

An alternative approach is mapping the control pulse to a restricted subspace using a continuous function. For example, by replacing it with $u\u0303i(t)=uimax\u2009sin\u2009(ui(t))$.^{133}

Another common example for the application of mapping are shape functions. They restrict the overall shape of the pulse, which is useful, if, e.g., the experiment requires a smoothly rising and falling control pulse with $\Gamma (0)=\Gamma (T)=0$, such that $ui\u2032(t)=\Gamma (t)ui(t)$.

______________________

#### 4. Initial guess and stopping criterion

Numerical optimal control techniques are based on iterative algorithms, which require a starting point (called “initial guess”) and a clearly defined situation to stop at, i.e., the stopping criterion. The optimization will in most cases find the closest local minimum to the initial guess (see examples in Fig. 15). Accordingly, it is often helpful to try a number of initial guesses to find which one is closest to the global minimum.

The stopping criterion is simpler to define: It might be based on the maximum number of iterations (limited computation time or experimental run time), a measure for convergence, or the clear definition of a goal.

#### 5. Robustness

Usually, there is some discrepancy between the theoretical model and the experiment. In an optimization, this can be taken into account to ensure that the optimized pulses will work in the presence of such a discrepancy by averaging over cost functions for slightly different systems. Let us consider each system being described by the Hamiltonian $H\u0302i$; then by taking into account $Nrob$ different versions, the cost function becomes

______________________

**Example 5.** Robustness against detuning

The resonance line of the NV center has a finite width and can be described by the normalized distribution $f(\omega )$. Off-center NV centers can, however, still be described with the Hamiltonian $H\u0302$ in Eq. (6) by adjusting the static magnetic field $B||$ and hence the detuning Δ. One may average the cost over $Ndet$ different detunings Δ_{i} to get a robust cost function,

We can see that this cost function will only reach zero, if all $J(H\u0302(\Delta i))$ are zero, ensuring robustness against the detuning. By including the probability distribution $f(B||\gamma nv)$, we ensure that the optimization favors solutions centered on the average detuning.

Due to field inhomogeneities in $B\u22a5$, the Rabi frequency can also have a finite distribution when considering an ensemble of NV centers. In many optimizations, both detuning and Rabi errors are accounted for simultaneously.^{123,134}

______________________

### B. Numerical QOC algorithms

Once the problem has been defined, an algorithm is required to systematically test possible solutions minimizing the cost.^{3} In this review, we will only describe numerical optimization algorithms as they have produced promising results and a variety of packages exist to implement them (see Sec. IV B 5 for more details).

There are, however, alternative strategies, such as geometrical optimal control^{135,136} (GOC) and shortcuts to adiabaticity^{137,138} (STA). They usually rely on a deeper analytical analysis of the control problem and hence access a smaller solution space than QOC, but can nevertheless be effective. One example is the direct application of Pontryagin's minimum principle, which falls under the category of GOC. It has been shown to provide time optimal evolution for NV centers.^{139,140} Similarly, STA has been used to implement specific gates on NV centers^{141} and protect them from decoherence.^{142}

Section IV A started by mentioning the brachistochrone problem, whose solution is usually obtained via an analytical variational approach. In the case of quantum mechanical problems, however, one would produce a set of nonlinear equations which, in most cases, cannot be solved analytically. Instead, a variational approach combined with numerical solving was introduced by Konnov and Krotov,^{143} and Sklarz and Tannor^{144} and further adapted by Ohtsuki *et al.*^{145} Since then, different attempts have been made to numerically solve this class of problems.

In general, two families of QOC algorithms can be identified: gradient-free^{146} and gradient-based.^{105} Gradient-based algorithms determine the derivatives of the cost function with respect to the control pulses to find an improved solution. These methods are usually efficient as they make use of all the available information. Gradient-free methods, on the other hand, can be applied directly to experiments or to complicated problems, where the gradients are not straightforwardly calculated. In this review, the direct experimental implementation is referred to as closed-loop, while a purely simulation based optimization is called open-loop.

We will start by looking at the working principle of gradient-based optimization algorithms, before exploring their gradient-free counterparts.

#### 1. Gradient-based optimization

To understand how gradient-based algorithms work, let us first consider the effect of a small change $\Delta u$ in some control *u*(*t*) on the cost function $J(u(t))$ (see Sec. IV A 2). If the change $\Delta u$ is small enough, we can approximate

We can now deduce that the properties $\Delta u$ should have to decrease *J*. Indeed, it enables us to make small changes and update *u*(*t*) iteratively. Consider $\Delta u=\u2212\u03f5[\u2202J/\u2202u(t)]$, where *ϵ* is a small positive factor. In this case, the new cost function becomes

which is smaller than the previous value, implying an optimization.

In order to avoid functional derivatives and iteratively improve the cost, the control function *u*(*t*) needs to be split up into time independent control parameters $u(k)$. According to the simple updating algorithm above, the new control parameters $u(k)\u2032$ become

More advanced updating algorithms promise faster convergence. Equation (18) could, for example, be extended to second-order.^{143,147} A popular method approximating the second-order term from the first-order term is the limited-memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) quasi-Newton method algorithm.^{148,149}

In the following, we describe the working principles of the gradient ascent pulse engineering (GRAPE) algorithm as an example for the whole class of algorithms. It was originally designed for NMR^{105} but has since found various applications with NV centers. For another comprehensive explanation, we refer to the study by Saywell *et al.*^{150}

______________________

**Example 6.** GRAPE optimization of a state transfer

We start by defining an exemplary cost function *J*, where *J* = 0 implies that the target state $\varphi t$ is reached at a time *T* (also see Sec. IV A 2),

where $U(T)=T\u0302\u2009exp\u2009(\u222b0T\u2212i\u210fH\u0302(t)dt).$

The initial state is defined as $|\varphi (0)\u27e9=|\varphi 0\u27e9$ and $T\u0302$ is the time ordering operator.

In order to take the derivatives of *J*, we choose the piecewise constant control basis, chopping up the control pulses into *N* small slices $ui(k)$ of width $\Delta t$. This gives a new way to formulate the propagator *U*(*T*),

It should be noted that this basis is not the only possible choice but intrinsic to GRAPE (as well as to other gradient-based algorithms like Krotov^{151}). We can now reformulate the cost function as

We start by calculating the derivatives of $\u27e8\varphi t|T\u0302\u220fkU(k)|\varphi 0\u27e9$ with respect to the control parameters,

We have defined the forward propagated state $|\varphi (k)\u27e9$ and the backward propagated state $\u27e8\xi (k)|$, which is usually referred to as the adjoint state. They can both be easily calculated by solving Schrödinger's equation. A graphical representation is given in Fig. 16. We applied the chain rule to find the gradient of *J*. In the case that the control pulses are mapped to a restricted subspace (see Sec. IV A 3), the chain rule can be used again.

The last thing left to evaluate are the following directional derivatives:

______________________

All in all, any gradient-based optimization algorithm relies on calculating the first derivative of the cost function with respect to the control parameters. On top of this specific example of GRAPE, we list below the most commonly used gradient-based QOC algorithms and their natural features (for an illustration of the terms “sequential” and “concurrent”, see Fig. 17):

GRAPE

^{105,149}concurrently optimizes in the piecewise constant basis.Krotov's method

^{116,143,144,147,151,152}sequentially optimizes one control parameter after the other. It also relies on the piecewise constant basis.GROUP

^{153}is based on GRAPE combined with the chain rule and optimizes concurrently. Its chopped basis (CB) is flexible (also see “chopped random basis algorithm (CRAB)” in Sec. IV B 3) but relies on an initial piecewise constant basis.GOAT

^{133}is based on a system of equations of motion obtained by differentiating the full propagator with respect to the control parameters. The parameters are optimized concurrently and its chopped basis is flexible (also see CRAB in Sec. IV B 3).

#### 2. Gradient-free optimization

In an experiment, the gradients described above cannot be calculated analytically. Certain finite-difference methods help to find them regardless.^{155–157} However, if the control landscape is not smooth, this method might prove inefficient or very costly in terms of measurements. This is where gradient-free optimization algorithms shine. Even for certain open-loop optimizations, they can offer an alternative, when their gradient-based counterparts fail: If, e.g., the dynamics of a system are significantly more complicated than those described in Sec. IV B 1, the gradient of the cost function might be hard or impossible to find analytically. One example for such a case is the CRAB algorithm, described below, which was initially introduced to optimize many-body problems using tensor networks to simulate the time dynamics.^{146}

The first step then is to choose an optimization basis. In the following, we will focus on the CRAB algorithm (see Sec. IV B 3) and consider the basis of trigonometric functions but it should be noted that we could also use Slepians, Chebyshev polynomials, or indeed piecewise constant elements. Broadly following Caneva *et al.*,^{122} the expanded control pulses each take the form,

Each pulse is composed of a sum of $Nbe$ basis elements. Each basis element is defined by a frequency $\omega \u2113$ and the control parameters $[A\u2113n,B\u2113n]$. The index *n* stands for the iteration number.

If the number of available basis elements is restricted (i.e., only a certain region of frequency space is accessible), the basis is called chopped. Especially in the case of bandwidth limitations, only optimizing in the accessible restricted control space can be a powerful tool to avoid introducing distorting penalty terms (see Sec. IV A 2). Decreasing the number of parameters also shrinks the size of the search space, potentially making the optimization a lot more efficient.

#### 3. CRAB

The chopped random basis algorithm (CRAB)^{122,146} is defined by the optimization of a random choice of basis elements taken from a truncated function space. Intuitively, one might instead chose the basis elements to coincide with the principal harmonics of the pulse. However, Caneva *et al.*^{122} showed that randomness can be surprisingly effective, especially if the energy scales of the system are not fully known. Indeed, a larger function space is covered, if multiple optimizations are done with different randomized bases. The elements that make up the basis of our example in Eq. (28) are defined by the frequencies $\omega \u2113$ and are illustrated in Fig. 18. These frequencies are chosen according to

where $\omega max$ is the maximum admissible frequency and $\u2113={1,2,\u2026,Nbe}$ is an index, which selects the chunk of the frequency space that $\omega \u2113$ is chosen from. Let us further choose the random numbers $r\u2113$ from an interval $[\u22120.5,0.5]$. Then the bandwidth of the control pulses is automatically limited to $[0,\omega max]$, where a typical choice is $\omega max=2\pi Nbe/T$ (*T* refers to the length of the pulse). By changing $\omega max$, we can change the bandwidth. Moreover, we can see that the available frequency space has been split into $Nbe$ regions permitting the optimization to make use of the entire space. It also conditions the optimization problem to have clearly distinct control parameters. It should be noted that the number of basis elements should be dependent on the number of degrees of freedom inherent to the system.^{145,158–160}

During the optimization, the $2Nbe$-dimensional landscape will be followed using any updating algorithm (it could even be gradient-based as in GOAT and GROUP). The most common choice is the gradient-free Nelder-Mead algorithm^{161} (hence, the description of this algorithm under gradient-free algorithms) but others such as covariance matrix adaption evolution strategy (CMA-ES),^{162} genetic algorithms, or reinforcement learning are possible.

#### 4. dCRAB

In the basic version of CRAB, the basis elements are fixed and the local control landscape is explored for all $Nbe$ frequencies simultaneously. This leads to a restriction in the number of frequencies that can efficiently be optimized. Using the dressed chopped random basis algorithm (dCRAB), much fewer basis elements with $\omega d,\u2113$ need to be optimized at a time [$Nbe($dCRAB$)<Nbe($CRAB$)$]. Instead, when one CRAB routine converges, we move on to $\omega d+1,\u2113$. This enables the method to include an arbitrarily large number of bases and to derive the solutions without—whenever no other constraints are present—being trapped by local optima. The extra iterations changing up the basis after each CRAB-run are called superiterations and the index *d* refers to the $dth$ superiteration. Their effect is illustrated in Fig. 19. If their number is fixed to $NSI$, the full description of the pulse can be summed up at the end of the optimization $uopt$, with all optimized parameters $Ad,\u2113opt,Bd,\u2113opt$ as

In each superiteration, only the parameters with corresponding index *d* are optimized. By repeatedly changing the basis, dCRAB does not get caught in local minima for most control problems and thus allows retaining this advantageous property of unconstrained control algorithms in a parametrized (e.g., bandwidth limited) setting. Rach *et al.*^{158} explored the improvement from CRAB to dCRAB in detail considering the random Ising model. They found that convergence may be achieved by taking enough parameters to fix the degrees of freedom present in the optimization problem. The underlying algorithm used for both CRAB and dCRAB performed best for a basis with $10\u201320$ parameters. This allowed dCRAB to outperform CRAB as it requires less optimization parameters per optimization (i.e., superiteration).

All in all, dCRAB promises faster convergence with respect to CRAB as fewer parameters are optimized in parallel and instead, new basis elements are chosen sequentially. An example for its experimental application to NV centers, among others, can be found in the work of Frank *et al.*^{108} where a Hadamard gate was optimized.

#### 5. Optimal control packages

In the past years, a number of QOC algorithms were implemented in ready-to-use software packages. In this section, we present four of these packages that we deem to be closest to applications with NV centers. An overview over some of their distinguishing features is given in Table II. Nevertheless, more solutions exist.

Name . | QOC algorithm . | Gradient required . | Access . | Specialty . |
---|---|---|---|---|

RedCRAB (Refs. 163 and 164)^{a}^{,}^{b}^{,}^{c} | dCRAB | No | On request | Allows connection directly to experiment |

dynamo (Ref. 154)^{a} | GRAPE, Krotov | Yes | GitHub | Many preprogrammed optimization options |

qutip (Refs. 165 and 166)^{b} | GRAPE, CRAB | Yes, no | pip, Conda, etc. | All-round quantum simulation |

Krotov package (Ref. 167)^{b} | Krotov | Yes | pip, Conda, etc. | Connects to qutip, many preprogrammed optimization options |

Name . | QOC algorithm . | Gradient required . | Access . | Specialty . |
---|---|---|---|---|

RedCRAB (Refs. 163 and 164)^{a}^{,}^{b}^{,}^{c} | dCRAB | No | On request | Allows connection directly to experiment |

dynamo (Ref. 154)^{a} | GRAPE, Krotov | Yes | GitHub | Many preprogrammed optimization options |

qutip (Refs. 165 and 166)^{b} | GRAPE, CRAB | Yes, no | pip, Conda, etc. | All-round quantum simulation |

Krotov package (Ref. 167)^{b} | Krotov | Yes | pip, Conda, etc. | Connects to qutip, many preprogrammed optimization options |

^{a}

Environment: matlab.

^{b}

Environment: python.

^{c}

Environment: command line.

RedCRAB (Refs. 163 and 164) is a python based program, aiming to remotely optimize any experiment or simulation with gradient-free methods. It can be linked to the experimental setup via matlab, python, terminal, or simple file transfer and is, hence, very versatile. RedCRAB makes use of the dCRAB alogithm and provides pulse updates. As it does not require any knowledge about the quantum system itself, it is compatible even with more complicated many-body systems and tensor-network simulations. RedCRAB is available from the authors on request.

dynamo (Ref. 154) was originally developed as a GRAPE (and Krotov) implementation in matlab. It allows the user to choose their own Hamiltonian and dissipator terms as well as one of the available figures of merit. Hence, it combines simulation and optimization for certain problems dealing with small quantum systems. It allows for the optimization of robust pulses and includes a large number of examples. The full version is available on GitHub.

qutip (Refs. 165 and 166) is an open source python library for simulating quantum systems. One of its features is a quantum optimal control implementation. As such, it offers limited optimization techniques with GRAPE and CRAB. Conveniently, the optimization settings are defined with the usual qutip structure. The library is available, for example, via pip or Conda.^{168}

The Krotov package^{167} is an open source python library built on top of qutip. As such, it offers optimization via Krotov's method. It includes an extended range of settings in comparison to qutip's own QOC implementation. The library is available, for example, via pip and Conda.

Other QOC packages include spinach^{169} and simpson,^{170} which focus on NMR applications, as well as QEngine,^{153,171} which includes a GROUP implementation designed especially for ultracold atom physics. GRAPE was also recently implemented in the grape-tensorflow python package,^{172} using methods known from machine learning to calculate the gradients.

### C. Limits of control: Controllability and the QSL

Whether or not a QOC problem is (approximately) solvable is not always simple to answer. However, by examining a number of characteristics of the Hamiltonian, some general predictions can be made.

First of all, one may ask whether the control objective is in principle reachable. This can be addressed by examining the controllability of the system.^{173} The drift and control Hamiltonians define a certain state (and also gate) space that is reachable. A system is called controllable when all states (gates) in the Hilbert space are accessible in finite time. It has been shown that if the rank of the dynamical Lie algebra generated by the different terms of the Hamiltonian corresponds to the rank of the control space (and fulfills certain symmetry criteria), the system is fully controllable. Alternatively, the question of state-controllability can be examined via a geometric approach based on graph theory, which can be more convenient to check, especially for larger systems.^{174} For more information on controllability, please refer to the following books.^{173,175} For open quantum systems, the deleterious effect of the environment usually cannot be completely canceled and only a subset of the whole set of states (gates) can be reached.^{106}

If the controllability criteria are fulfilled, the question remains whether the controls are complex and energetic enough to navigate the Hilbert space to the specified target. In general, the quantum speed limit (QSL), i.e., the smallest possible control time needed for a system to reach its target, is influenced by two factors. First, the dynamical equation determines how fast the system may change. This is usually quantified by the so-called Schatten p-norm of the dynamical operator (see Ref. 176 for details). Second, the exact distance between the initial system and the objective needs to be taken into account.

______________________

**Example 7.** Quantum speed limit

The minimum time it takes to evolve a system into a target state is mostly dependent on two things: The Hamiltonian $H\u0302$ and the distance between the initial and the target state $\u27e8\varphi 0|\varphi t\u27e9$. For a time-independent Hamiltonian, we obtain the Bhattacharyya-bound,^{177,178}

The time $TQSL$ is called the quantum speed limit (QSL). It can be interpreted as follows: If the Hamiltonian has a high energy variance calculated on the initial state $\Delta E=\u27e8\varphi 0|H\u03022|\varphi 0\u27e9\u2212\u27e8\varphi 0|H\u0302|\varphi 0\u27e92$, then any other state is reached more quickly. It might be more intuitive to consider the case that |$\varphi 0$⟩ is an eigenstate of $H\u0302$; hence, it will never change and as $\Delta E=0$, the speed limit will go toward infinity. The distance to the target state finally determines the exact time scale.

______________________

For a more general and complete picture of the QSL, the reader is advised to refer to the following Refs. 176 and 178.

Similarly to the QSL, the information speed limit (ISL) can also restrict the minimum length of the control pulse. Behind this is the idea that the information encoded in the control pulse has to be sufficient to steer the system to the target. For example, in the noiseless case, the degrees of freedom in the control (the number of independent frequencies in a bandwidth-limited control field or the number of kicks in a bang-bang control^{179}) should at least reflect the dimension of the system.^{159} Note that in the presence of noise in the system or in the controls, more degrees of freedom are required to transmit the same amount of information.

## V. QOC FOR NV CENTERS

### A. Quantum sensing

The sensitivity of NV center-based sensors depends on the coherence times (*T*_{2}) of the spin states, which in turn are theoretically only strictly limited by their lifetimes. Other limiting factors include efficient and coherent spin manipulation, which is inherently subjected to experimental imperfections and limitations. Several material synthesis techniques^{14} have been developed to fabricate NV centers in ultrapure host crystals with minimal noise due to paramagnetic impurities and crystal field induced phenomena (strain) that diminish the coherence time (*T*_{2}) of the spin qubit. Additionally, dynamical decoupling protocols discussed in Sec. III A 1 have shown promising results enhancing the coherence time. Yet, the currently achieved sensitivities fall short of the theoretical limits set by the spin state lifetimes.

A material independent approach, which is the focus of this review, is to design specialized spin manipulation protocols that are optimized for efficiency in consideration of noise and experimental limitations/imperfections. The critical processes in the sensing techniques discussed so far are spin state initialization, state-to-state transfer, and spin state readout. All these steps require the system to evolve in a specified way given a certain set of constraints. Broadly speaking, this catches the essence of QOC theory, as described in Sec. IV. QOC techniques have shown promising results in fields like NMR^{103,180} and atomic physics related experiments.^{129,181} In the past decade, a number of interesting results have been obtained by using optimal control for NV spin systems.

Häberle *et al.*^{111} showed that quantum limited sensitivities for magnetic field sensing can be achieved using QOC based spectroscopy techniques (Fig. 20). In this work, the team used a single NV qubit system to image nanoscale magnetic fields with scanning probes. The aim of the work was to obtain a wider dynamic range for the spectroscopic MW pulses using QOC. An open-loop numerical optimization technique (GRAPE, see Sec. IV B 1 for more details) was used to obtain frequency selective, high bandwidth MW pulses for state transfer. Their results showed photo-shot-noise limited sensitivities of around 4.5 $\mu T/Hz$ and a dynamic range of more than 2.2 mT, as well as improved robustness against fluctuations in MW power.

Nöbauer *et al.*^{124} exploited a Floquet theory^{182} based approach for open-loop optimization limiting MW pulses to a certain frequency domain (Fig. 21). They obtained pulses that were robust against MW amplitude variation and frequency detuning. They first demonstrated the working principle employing a single NV using different MW detunings from the resonant frequency. They further concluded that the optimized pulse is ideal for NV ensembles that require the same spin manipulation pulse to be effective for a number of systems with different resonant frequencies and hence detunings as seen in the matrix plot in Fig. 21 shows the comparison of regular rectangular control pulses and the optimized pulses, demonstrating two orders of magnitude enhancement in sensitivity. This is demonstrated in a proof-of-principle experiment with a spin echo sequence for magnetic field sensing.

Poggiali *et al.*^{121} demonstrated a different approach (Fig. 22) making use of a modified cost function based on the Fisher information to enhance the sensitivity of NV centers to a wide range of AC magnetic fields (Fig. 22). The Fisher information of the measurement [see Sec. IV A 2 specifically Eq. (10)] takes into account the signal of interest as well as the noise. The sensitivity is related to the Fisher information via Eq. (9). A gradient-free minimization technique (see Sec. IV B 2) was used to find the optimal temporal distance between pulses and adjust the initial phase of the signal. Finally, they experimentally demonstrated enhanced sensitivity by up to a factor of two for a single qubit system compared to CPMG (Ref. 183) pulse sequences (a type of dynamical decoupling sequence, see Sec. III A 1). Along this line, Müller *et al.*^{120} showed how optimal control-designed frequency filter functions allow a speed-up of the measurement and fast detection of fluctuating signals.

In another work, Scheuer *et al.*^{109} demonstrated a novel technique for spin qubit control in the ultrafast driving regime beyond the rotating wave approximation (see Appendix B). When the Rabi frequency of the drive becomes comparable to the transition frequency (in the reference about 30 MHz), the RWA breaks down and the system is no longer described by Eq. (6). To overcome this artificial constraint on the pulse duration, an optimal control pulse considering the counter-rotating terms was designed. They used the CRAB algorithm (see Sec. IV B 3) to optimize standard *π*- and $\pi 2$-pulses in this regime and experimentally demonstrated Ramsey and spin-echo sensing protocols.

Ziem *et al.*^{184} optimized resonance imaging of ^{19}F nuclei using GRAPE. The nuclei were part of patterned calcium fluoride on the diamond surface. The optimized pulses significantly improved the robustness of their DD protocol against variations in the driving field in comparison to a standard XY16-N sequence.

Recently, Konzelmann *et al.*^{110} showed that QOC pulses can enhance the robustness of temperature sensing for biological applications. They used nanodiamonds in an agarose matrix to demonstrate enhanced signal quality for fast temperature fluctuation measurements in dynamic biological media. For this purpose, a cooperative D-Ramsey pulse sequence, specifically designed for temperature measurements,^{185} was optimized using the matlab based dynamo package that uses a GRAPE optimization algorithm (see Sec. IV B 5 for more details). Here, the typical state-to-state transfer fidelity serves as the cost function for the optimization (Fig. 23).

### B. Quantum information and computation

The usefulness of QOC techniques has been demonstrated repeatedly in the field of quantum information and computation. As the basic theoretical protocols and experimental setup need to fulfill similar fundamental demands as for the described sensing techniques, similar optimization strategies come into play.^{188}

Dolde *et al.*^{74} realized entanglement of two nuclear spins over a distance of 25 nm by entangling them with one NV center each, which in turn were coupled through dipole–dipole interaction. They used GRAPE (see Sec. IV B 1) to realize optimized PSWAP and NOT gates, which worked despite the hyperfine interactions that interfere with standard controls. The optimized pulses allowed for 20 NOT gate repetitions without significant loss of fidelity, while standard pulses already showed poor performance after a single gate.

Waldherr *et al.*^{82} demonstrated three-qubit phase-flip error correction using three nuclear spins and the NV center as an ancilla. While the system was entirely manipulated via the NV center spin, the hyperfine couplings complicated its control. This was solved by applying microwave pulses of two different frequencies simultaneously, finding their shape with a GRAPE-implementation.

In order to construct optimal $\pi /2$—as well as spin-inversion pulses—Frank *et al.*^{108} designed and experimentally implemented closed-loop optimization for single NV centers (Fig. 24). Their dCRAB implementation autonomously found an optimal solution for the desired goals within the experimental error. Their techniques are translatable to a number of quantum computing applications as $\pi /2$-pulses form the building blocks of most common quantum gates. In the case of moderate detuning, the closed-loop pulses outperformed any open-loop-generated sequences. More details on the algorithm can be found in Sec. IV B 4.

Said *et al.*^{113} compared different strategies to entangle a NV center with a ^{13}C nuclear spin, namely sequential pulses, composite pulses, and numerically optimized pulses (GRAPE). They concluded that the optimized pulse, did not only outperform the others in robustness but was also faster than the composite pulse.

Tsurumoto *et al.*^{112} utilized a GRAPE algorithm to optimize a state-to-state transfer pulse applied to a NV center, which was utilized to transfer photon polarization to a nuclear spin qubit.

Recently, Chen *et al.*^{186} proposed a QOC technique based on a combination of open-loop and closed-loop optimization to demonstrate the working principle of a NV-based quantum processor.

## VI. CONCLUSION

NV centers are a valuable platform for a whole family of quantum applications. As the boundaries of existing implementations of different quantum sensing and quantum computation schemes are being explored, QOC offers a route to transverse these limits. We have reviewed a number of existing applications of QOC to NV center-based systems and provided a recipe for the application of QOC with a special focus on NV centers. It has been shown that QOC methods can increase the precision in qubit control and manipulation, especially in the presence of environmental factors such as surrounding nuclei. These advantages have also been exploited to improve NV-based sensors. Their versatility in combination with QOC shows to be especially effective when the limiting factor is defined by the experimental constraints and/or limited knowledge of the system. Enhanced control also provides a mean to efficiently implement quantum algorithms in NV center-based quantum registers. All combined, QOC enhances the capabilities that are crucial to building a NV center-based quantum computer. QOC methods provide the boost that may lead diamond-based quantum systems into the realm of commercial quantum technologies.

## AUTHORS' CONTRIBUTIONS

P.R. and N.O. contributed equally to this work.

## ACKNOWLEDGMENTS

This work has received funding from the European Union's Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie Grant Agreement Nos. 765267 (QuSCo), 820394 (AsteriQs), and 817482 (PASQuanS). This work was partially supported by the Italian PRIN 2017, the QuantERA projects QTFLAG and QuantHEP, the DFG via the TWITTER project.

## DATA AVAILABILITY

The data that support the findings of this study are available from the corresponding author upon reasonable request.

### APPENDIX A: SPIN HAMILTONIAN

In a solid state system, spin interactions are mostly mediated through magnetic fields. In general, the spin interaction energies are very small in comparison to electronic interaction energies (Fig. 3) for systems like diamond crystal. The energy of the system $E$ can be expanded as

$E0$ represents all the nonspin-interaction energies and $s\u0302n$ are the relevant spin bases (i.e., of different atoms, the NV center itself, etc.). The Hamiltonian for such spin interaction energies is called the spin Hamiltonian. For a NV centerlike system, the spin Hamiltonian can be obtained in terms of spin operators for the corresponding singlet spin state basis,

Terms of different order in the expansion (A1) represent different kinds of spin interactions. For our purposes, it suffices to consider the terms up to second-order. Consequently, all the different types of interactions can be formalized in the same way through interaction tensors and spin operators. We now look into the details of these different types; for simplicity, $\u210f$ is assumed to be equal to 1 in the following equations.

##### 1. Linear terms

These terms mainly represent the interaction of the spin with external fields, whose origin may also lie within the crystal

where $S\u2192\u0302$ is the spin operator, $B\u2192$ is the magnetic field, and $Z$ is the Zeeman interaction tensor. In the Hamiltonian discussed in Sec. II B, the magnetic interaction term is of this nature. The coupling tensor in that case is a diagonal matrix multiplied with the gyromagnetic ratio of the NV center.

##### 2. Bilinear terms

These terms represent spin–spin interactions such as dipolar coupling, exchange interactions, and hyperfine couplings

where $I\u2192\u0302$ is the nuclear spin operator vector and $N$ is the hyperfine coupling tensor. In the Hamiltonian presented in Eq. (1) in Sec. II B, the interaction of the NV spin with other spins is bilinear in nature. In this case, the hyperfine coupling tensor may be simplified and described by the two main contributing interactions; the axial coupling constant $Naxial$ and the transverse coupling constant $Ntran$

Note that the Fermi contact interaction term is given by^{187}

and the dipole interaction term is given by

$fN$ is an order of magnitude larger than $dN$ for the ^{14}N and ^{15}N nuclei.^{187}

We may specifically consider the interaction between two different NV center spins. The Hamiltonian for these dipole–dipole interactions can be written as

where $S\u03021$ and $S\u03022$ are the spin operators for the respective NV centers and $r\u2192$ is the spatial vector, which joins them. This interaction is relatively weak in comparison to other spin interactions. Nevertheless, NV–NV interactions have been a matter of interest in several works in the literature (for example, see Dolde *et al.*^{74}).

##### 3. Quadratic terms

These terms usually represented the interaction of spin with itself, although the source of the interaction can indirectly be due to an external field. Nuclear quadrupole interaction in NMR and electron zero-field splitting terms are of this nature. They are represented as

where $D$ is the quadrupole coupling tensor. $D$ is in good approximation a symmetric matrix. The zero-field splitting terms for the Hamiltonian in Eq. (1) in Sec. II B are of this nature. For a NV center, this tensor can, to a good approximation,^{37} be written on the basis of spin matrices as

where *D* is the zero-field splitting and *E* is the nonaxial zero-field parameter. For most practical purposes, one can consider $E\u22480$.

The effect of an electric field on the spin is rather more complicated and for a solid state system, it depends on symmetry conditions. For a $C3v$ symmetry system like the NV center, the effect of a linear electric field can be described by the following approximate Hamiltonian:^{69,188}

where $Ei$ are the components of the effective electric field. External strain/pressure is manifested as a crystal strain electric field and is incorporated in the effective electric field. $Pij$ are the components of a third rank coupling tensor.^{188} These coupling constants can be determined by electron paramagnetic resonance experiments. In practice, $P15$ arises from the mixing of the $ms=\xb11$ and *m _{s}* = 0 spin states

^{188}and is negligible with respect to the other coupling terms.

### APPENDIX B: THE ROTATING WAVE APPROXIMATION

In the following, the approximate Hamiltonian for a NV qubit is derived using the RWA. It is a simplified version of the second term of Eq. (1).

First, let us consider a single NV center in a magnetic field. The magnetic field is composed of two parts: The static component $B\u2225$ points along *z* and a microwave field with amplitude $2B\u22a5$ oscilates along *x* with a frequency *ω _{mw}* and phase $\phi $. The magnetic field $B\u2192$ can thus be written in a slightly odd form, the usefulness of which will become apparent in the following steps:

The splitting of the energy levels of the NV center ground state due to the static magnetic field allows the description as a two level system only considering $|0\u27e9$ and $|1\u27e9$. $\sigma \u2192\u0302$ are the Pauli matrices used to describe the corresponding spin operators which are denoted with $s\u2192\u0302=(\u210f/2)\sigma \u2192\u0302$ to distinguish them from the three level system $S\u2192\u0302$ and generic $s\u2192\u0302$ spin operators. The resulting Hamiltonian reflects the interaction between the field and the NV spin

with $A\u0302+=B\u22a5(cos\u2009(\omega mwt+\phi )s\u0302X+sin\u2009(\omega mwt+\phi )s\u0302Y)$ and $A\u0302\u2212=B\u22a5(cos\u2009(\omega mwt+\phi )s\u0302X\u2212sin\u2009(\omega mwt+\phi )s\u0302Y)$.

In the rotating frame of the microwave field with the transformation $U=exp(i\omega mws\u0302Zt/\u210f)$, this Hamiltonian becomes

Using the following relations, the corresponding spin operators may be determined,

The different terms in the rotating frame, after some algebra and trigonometric identities, can be written as

One may notice that the terms in $UA\u0302\u2212U\u2020$ are of much higher frequency than the rest. Hence, in the rotating wave approximation, it is assumed that they average out and their contribution is negligible. Under this approximation, the Hamiltonian in the rotating frame depends only on the Rabi frequency $\Omega =\gamma nvB\u22a5$, the detuning $\Delta =\omega nv\u2212\omega mw$, with the NV center's resonant frequency $\omega nv=\gamma nvB\u2225$, and the phase $\phi $,