[figure]style=plain,subcapbesideposition=top

# Experimental test of the Jarzynski equality in a single spin-1 system using
high-fidelity single-shot readouts

Wenquan Liu  CAS Key Laboratory of Microscale Magnetic Resonance and School of
Physical Sciences, University of Science and Technology of China, Hefei
230026, China  CAS Center for Excellence in Quantum Information and Quantum
Physics, University of Science and Technology of China, Hefei 230026, China
School of Science, Beijing University of Posts and Telecommunications,
Beijing, 100876, China  Zhibo Niu  CAS Key Laboratory of Microscale Magnetic
Resonance and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Hefei 230026, China  Wei Cheng  CAS Key Laboratory of Microscale
Magnetic Resonance and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Hefei 230026, China  Xin Li  Center for Quantum Technology Research and
Key Laboratory of Advanced Optoelectronic Quantum Architecture and
Measurements (MOE), School of Physics, Beijing Institute of Technology,
Beijing 100081, China  Chang-Kui Duan  CAS Key Laboratory of Microscale
Magnetic Resonance and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Hefei 230026, China  Zhangqi Yin<EMAIL_ADDRESS>Center for Quantum
Technology Research and Key Laboratory of Advanced Optoelectronic Quantum
Architecture and Measurements (MOE), School of Physics, Beijing Institute of
Technology, Beijing 100081, China  Xing Rong<EMAIL_ADDRESS>CAS Key
Laboratory of Microscale Magnetic Resonance and School of Physical Sciences,
University of Science and Technology of China, Hefei 230026, China  CAS Center
for Excellence in Quantum Information and Quantum Physics, University of
Science and Technology of China, Hefei 230026, China  Hefei National
Laboratory, University of Science and Technology of China, Hefei 230088, China
Jiangfeng Du<EMAIL_ADDRESS>CAS Key Laboratory of Microscale Magnetic
Resonance and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Hefei 230026, China  Hefei National Laboratory, University of Science
and Technology of China, Hefei 230088, China

###### Abstract

The Jarzynski equality (JE), which connects the equilibrium free energy with
non-equilibrium work statistics, plays a crucial role in quantum
thermodynamics. Although practical quantum systems are usually multi-level
systems, most tests of the JE were executed in two-level systems. A rigorous
test of the JE by directly measuring the work distribution of a physical
process in a high-dimensional quantum system remains elusive. Here, we report
an experimental test of the JE in a single spin-1 system. We realized
nondemolition projective measurement of this three-level system via cascading
high-fidelity single-shot readouts and directly measured the work distribution
utilizing the two-point measurement protocol. The validity of the JE was
verified from the non-adiabatic to adiabatic zone and under different
effective temperatures. Our work puts the JE on a solid experimental
foundation and makes the NV center system a mature toolbox to perform advanced
experiments of stochastic quantum thermodynamics.

Processes in nature usually deviate from equilibrium, but most thermodynamic
principles describing non-equilibrium processes are only presented in the form
of inequalities[1, 2, 3]. Although the fluctuation-dissipation theorem is
valid in the close-to-equilibrium regime[4, 5], an accurate description of all
out-of-equilibrium processes has not been established until the proposition of
the Jarzynski equality (JE)[6, 7]:

$\langle e^{-\beta W}\rangle=e^{-\beta\Delta F}.$ (1)

The JE connects the equilibrium free energy difference $\Delta F$ of a system
with the ensemble average of the exponentiated work $\langle e^{-\beta
W}\rangle$ during a switching process at inverse temperature $\beta$. The
equality is valid regardless of the speed of the switching process. Thus, the
JE gives a shortcut to estimate the free energy difference between two system
configurations, especially for systems whose equilibrium states and reversible
processes are hardly or not accessible.

The JE has been examined in various classical systems[8, 9, 11, 14, 10, 12,
13], but its test in the quantum domain remains inadequate. The inadequacy
lies in the fact that practical quantum systems usually possess many energy
levels, yet most experimental tests have been limited to two-level systems[15,
16, 17]. There is one test executed in a multi-level trapped-ion system, but
the work distribution was mimicked via a classical pre-sampling method because
the phonon state measurement is destructive[18]. To put the JE on a solid
experimental foundation, a rigorous test that directly measures the work
distribution of a physical process is still urgently needed. However,
measurement of work is not easy. In fact, as one of the most basic notions of
physical science, work is not an observable but corresponds to some
correlation functions [20, 19]. In classical systems, it can be measured by
continuously tracing the displacement of the particle and the force applied to
it during the switching process. This method fails in quantum scenarios as the
uncertainty principle constrains our ability to precisely measure operators
that do not commute. For isolated quantum systems, this problem can be
addressed by the two-point measurement (TPM) protocol[21, 22, 23]. In the TPM
protocol, two high-fidelity nondemolition projective measurements on the
energy basis are applied before and after the switching process to determine
the quantity of work. However, it is challenging to realize such projective
measurements, especially for high-dimensional quantum systems. Thus, a
rigorous test of the JE in a high-dimensional quantum system remains an open
issue.

Here, we report an experimental test of the JE in a single spin-1 nuclear
spin. We realized high-fidelity nondemolition projective measurement of the
three-level system by cascading single-shot readouts[1]. Then the TPM protocol
was implemented by performing two projective measurements of the nuclear spin
that sandwich the switching process to measure the work of the process. With
examinations starting from different thermal states and experiencing switching
processes with different speeds, we tested the JE at different effective
temperatures and in both adiabatic and nonadiabatic regions. Our results show
that the JE is valid in this high-dimensional spin system.

Figure 1:  Illustration of the two-point measurement protocol. First, the
system is in the thermal state of the initial Hamiltonian $H(0)$. Then the
system is projected into an energy eigenstate by a projective measurement.
Next, the driving Hamiltonian changes from $H(0)$ to $H(\tau)$, which is
called the switching process. Eventually, a second projective measurement
determines the final state of the system. Work statistics of the switching
process can be obtained via this protocol.

The scheme of the TPM protocol to establish the JE is illustrated in Fig. 1.
First, the Hamiltonian is $H(0)$ and the system is prepared in the thermal
state $\rho_{thm}^{0}=e^{-\beta H(0)}/Z^{0}$, where $Z^{0}={\rm Tr}[e^{-\beta
H(0)}]$ is the partition function of the initial thermal state. Second, the
first projective measurement is carried out and the system is projected to an
energy eigenstate $|n(0)\rangle$ of $H(0)$ with probability $P_{n}^{0}={\rm
Tr}[\rho_{thm}^{0}|n(0)\rangle\langle n(0)|]$. Next, the switching process is
performed, while the driving Hamiltonian changes from $H(0)$ to $H(\tau)$. The
state of the system becomes $\rho^{\tau}_{n}=U|n(0)\rangle\langle
n(0)|U^{\dagger}$, where $U=\mathcal{T}e^{-i\int_{0}^{\tau}H(t)dt}$ is the
evolution operator and $\mathcal{T}$ is the time-ordering operator. Finally,
the second projective measurement on $\rho^{\tau}_{n}$ is applied to obtain
$P_{m|n}^{\tau}={\rm Tr}[\rho^{\tau}_{n}|m(\tau)\rangle\langle m(\tau)|]$, the
probability of finding the system in the energy eigenstate $|m(\tau)\rangle$
of $H(\tau)$ conditioned that the evolution begins with the system in
$|n(0)\rangle$. The work done on the system in the trajectory from
$|n(0)\rangle$ to $|m(\tau)\rangle$ is defined as
$W_{m|n}=\epsilon_{m}^{\tau}-\epsilon_{n}^{0}$ with $\epsilon_{n}^{0}$ and
$\epsilon_{m}^{\tau}$ being the eigenenergy of $|n(0)\rangle$ and
$|m(\tau)\rangle$, respectively. Through the TPM protocol, the work
distribution is obtained as

$\displaystyle P(W)=\sum_{n,m}P_{n}^{0}P_{m|n}^{\tau}\delta(W-W_{m|n}).$ (2)

Hence, the JE can be expressed as $\sum_{n,m}P_{n}^{0}P_{m|n}^{\tau}e^{-\beta
W_{m|n}}=e^{-\beta\Delta F}$. We can then compare the exponentiated free
energy difference extracted by this formula with the definition
$e^{-\beta\Delta F}=\frac{\rm{Tr}[e^{-\beta H(\tau)}]}{\rm{Tr}[e^{-\beta
H(0)}]}$ to test the JE.

Figure 2:  Energy level of the NV center system and single-shot readouts of
the nuclear spin. (a) Diagram of the states we utilized. The red dashed box
encircles the energy levels that we implemented the switching process.
$\pi_{+1}$ and $\pi_{-1}$ are selective $\pi$ pulses that act on corresponding
energy levels. (b) The photon counting histograms obtained by repeating the
single-shot readout of $|+1\rangle_{n}$ (top panel) and $|-1\rangle_{n}$
(bottom panel). Insets are the quantum circuits. The histograms are divided
into two parts by properly chosen thresholds that distinguish different
nuclear spin states.

We tested the JE with a single spin-1 nuclear spin of the NV center in
diamond. The NV center is a point defect in diamond that consists of an
electron spin formed by the vacancy and a nuclear spin of the ${}^{14}\rm{N}$
atom. The spin quantum number of both the electron spin and the nuclear spin
is 1. With a static magnetic field applied along the NV symmetry axis, the
ground state Hamiltonian can be written as $H_{\rm
NV}=2\pi(DS_{z}^{2}+\omega_{e}S_{z}+PI_{z}^{2}+\omega_{n}I_{z}+AS_{z}I_{z})$.
Here $D=2.87\ {\rm GHz}$ is the zero-field splitting of the electron spin,
$P=-4.95\ {\rm MHz}$ is the nuclear quadrupolar interaction constant and
$A=-2.16\ {\rm MHz}$ is the hyperfine coupling constant, $\omega_{n}$
($\omega_{e}$) is the Zeeman frequency of the nuclear (electron) spin. $I_{z}$
and $S_{z}$ are the spin-1 operators of the nuclear spin and electron spin,
respectively. The energy levels we utilized are depicted in Fig. 2(a) with
$|...\rangle_{n}$ ($|...\rangle_{e}$) encoding the nuclear (electron) spin
state. The electron spin can be optically polarized to state $|0\rangle_{e}$
via a 532-nm laser pulse[25]. The photoluminescence (PL) rate of the NV center
with the electron spin state being $|0\rangle_{e}$ is about $30\%$ higher than
that with the electron spin state being $|-1\rangle_{e}$[26, 27]. So
$|0\rangle_{e}$ will be denoted as the bright state and $|-1\rangle_{e}$ the
dark state in the following. The evolution of the nuclear spin and the
electron spin can be accurately manipulated via radio frequency (RF) and
microwave (MW) pulses, respectively.

Figure 3:  Pulse sequence to test the JE and corresponding experimental
results. (a) Diagram of the pulse sequence. The repeat times were set as
${\rm{\textbf{N}}}={\rm{\textbf{N}^{\prime}}}=900$. (b) Theoretical
anticipation (blue) and measured values (green) of the thermal state for
$\beta|\lambda|=0.5$. (c) The conditional probabilities obtained from the TPM
protocol for $\beta|\lambda|=0.5$ and $\tau=200\ {\rm\mathrm{\upmu s}}$. (d)
The work statistics obtained from (c). All error bars in (b)-(d) show one
standard deviation.

Test of the JE was performed on the nuclear spin of the ${}^{14}{\rm N}$ atom
with the electron spin state being $|0\rangle_{e}$. Nondemolition projective
measurement of the nuclear spin is realized by cascading two high-fidelity
single-shot readouts with the electron spin playing the auxiliary role. In
principle, we can detect whether the nuclear spin is in one of its three
possible states without altering its state by executing the single-shot
readout one time[1]. The top panel of Fig. 2(b) shows the procedure of single-
shot readout of $|+1\rangle_{n}$, which contains the following steps: (I)
applying a selective MW $\pi_{+1}$ pulse (optimized by gradient ascent pulse
engineering algorithm[10]) to flip the electron spin from the bright state to
the dark state when the nuclear spin is in $|+1\rangle_{n}$; (II) readout the
electron spin state via optical excitation and fluorescence collection to
infer the nuclear spin state; (III) repeating (I) and (II) for $\rm{N}$ times.
The photon number collected during a single run of steps (I) and (II) is not
sufficient to distinguish the electron spin state, so step (III) is necessary
to realize high-fidelity readout. Note that, the state of the electron spin
will be re-polarized to the bright state after step (II)[25], which makes step
(III) feasible. During the application of laser pulses in the readout process,
the NV center is pumped to the excited states. The spin flip-flop processes
take place and may lead to a change in the nuclear spin state. Thus, by
repeating the single-shot readout to consecutively detect the nuclear spin
state, we can obtain the photon-counting histogram as shown by the top panel
of Fig. 2(b). The histogram contains two peaks that can be separated by an
appropriate threshold (red dashed line). When the number of photons $c_{+1}$
collected during a single-shot readout is smaller than the threshold $T_{+1}$,
we judge the nuclear spin is in state $|+1\rangle_{n}$, otherwise the nuclear
spin state is $|0\rangle_{n}$ or $|-1\rangle_{n}$. Single-shot readout of
state $|-1\rangle_{n}$ can be realized by the same procedure but replace the
selective MW $\pi_{+1}$ pulse with $\pi_{-1}$ pulse. The result is displayed
in the bottom panel of Fig. 2(b). The projective measurement of the spin-1
nuclear spin was realized by cascading single-shot readout of $|+1\rangle_{n}$
and $|-1\rangle_{n}$. Hence, the state of the nuclear spin is determined after
combining the results of two comparisons between photon numbers and
thresholds. The nuclear spin state is $|+1\rangle_{n}$ when $c_{+1}<{T_{+1}}$
and $c_{-1}>T_{-1}$, $|0\rangle_{n}$ when $c_{+1}>{T_{+1}}$ and
$c_{-1}>T_{-1}$, and $|-1\rangle_{n}$ when $c_{+1}>{T_{+1}}$ and
$c_{-1}<T_{-1}$. The events where $c_{+1}<{T_{+1}}$ and $c_{-1}<T_{-1}$ are
excluded.

The fidelity of the single-shot readout depends on both the longitudinal
relaxation time of the nuclear spin and the separation of the peaks in the
photon-counting histogram. The nuclear spin state can flip during the
application of 532-nm laser pulses due to the longitudinal relaxation that
happens at the excited state of the NV center[3, 2]. To suppress such
relaxation, our experiment was implemented under a magnetic field of about
$7400\ \rm{G}$, and the direction of the magnetic field is along the NV
symmetry axis[1]. With this, the longitudinal relaxation time of the nuclear
spin under laser illumination was measured to be 3.8 (5) ms for
$|+1\rangle_{n}$, 3.5 (3) ms for $|0\rangle_{n}$, and 4.2 (2) ms for
$|-1\rangle_{n}$, respectively (see section I of the Supplementary
Information). The separation of the peaks can be improved by increasing the
repeat time in each single-shot readout or increasing the PL rate of the NV
center. But the repeat time cannot be arbitrarily increased due to the finite
longitudinal relaxation time of the nuclear spin. In fact, the repeat time
needs to be optimized, especially when cascading two single-shot readouts (see
section III of the supplementary Information for details). As for the
fluorescence collection, we utilized the solid immersion lenses technology[31]
and the PL rate was about 700 kps. With these methods, fidelities of 0.98(2)
and 0.98(1) have been realized in making correct readouts of whether the
nuclear spin state is $|+1\rangle_{n}$ and $|-1\rangle_{n}$, respectively.
Based on this, high-fidelity projective measurement of the spin-1 nuclear spin
can be realized, which is crucial for an experimental test of the JE (See
section IV of the Supplementary Information for details).

In our experiment, the driving Hamiltonian during the switching process was
chosen as

$\displaystyle\left\\{\begin{array}[]{cl}H(t)=\lambda[a(t)I_{z}+b(t)I_{x}]\\\
a(t)=1-\frac{t}{4\tau}\ \ \ b(t)=1-|2\frac{t}{\tau}-1|\\\ \end{array},\right.$
(5)

where $\tau$ is the time duration, $\lambda=-\sqrt{2}\pi\times 5$ kHz and
$b(0)$ and $b(\tau)$ were set to zero for the simplicity of measurement. This
Hamiltonian was constructed in an appropriate rotating frame by applying
detuned RF pulses (see section V of the Supplementary Information). The
thermal state of the initial Hamiltonian $H(0)$ was prepared via a series of
laser, MW, and RF pulses as shown in Fig. 3(a). First, a single-shot readout
was implemented to prepare the nuclear spin in state $|+1\rangle_{n}$ via
post-selection. The 532-nm laser can induce transitions between the negatively
charged NV center ($\rm{NV}^{-}$) and the neutrally charged NV center
($\rm{NV}^{0}$)[5, 6, 7], so a 594-nm laser pulse was applied to post-select
the experiment trials done with $\rm{NV}^{-}$[8, 9]. Then the thermal state
was prepared by the following steps: (I) applying selective RF rotations
$R_{\theta}^{+1,0}$ and $R_{\theta^{{}^{\prime}}}^{-1,0}$ to prepare the
coherent Gibbs state[37] of $H(0)$ where
$\theta=2\arccos\sqrt{e^{-\lambda\beta}/(1+2\cosh{(\beta\lambda)})}$ and
$\theta^{{}^{\prime}}=2\arccos\sqrt{1/(1+e^{-\lambda\beta})}$; (II) applying
two selective $\pi_{+1}$ pulses separated by a free evolution time $t_{w}=10\
\mathrm{\upmu s}$. $t_{w}$ is about six times longer than the dephasing time
of the electron spin ($1.4(1)\ \mathrm{\upmu s}$), so that the coherence
between $|+1\rangle_{n}$ and $|0\rangle_{n}$ (also $|-1\rangle_{n}$) would be
dissipated; (III) executing the similar procedure in (II) but replacing the
pulse $\pi_{+1}$ with $\pi_{-1}$. The coherence between $|0\rangle_{n}$ and
$|-1\rangle_{n}$ can be dissipated, resulting in the nuclear spin in the
thermal state of $H(0)$. The population of the initial thermal state can be
obtained via the first projective measurement. Fig. 3(b) shows the results
where the effective temperature was set as $\beta|\lambda|=0.5$. The
population of $|+1\rangle_{n}$, $|0\rangle_{n}$ and $|-1\rangle_{n}$ is
measured to be $0.519(7)$, $0.276(5)$, and $0.204(5)$, respectively, yielding
a fidelity of $99.82\%$ with the theoretical anticipation and the practical
inverse temperature $\beta_{\rm exp}|\lambda|=0.49(2)$.

We carried on the test after the thermal state was prepared by following the
steps in Fig. 3(a). The nuclear spin state was in one eigenstate of $H(0)$
after the execution of the first projective measurement. Then the 594-nm laser
pulse was applied again to exclude experiment trials done with ${\rm NV}^{0}$.
Next, detuned RF pulses were applied to construct Hamiltonian $H(t)$ and
realize the switching process. Finally, the second projective measurement was
performed to obtain the conditional probability $P_{m|n}^{\tau}$. The
conditional probabilities are plotted in Fig. 3(c) by taking the switching
process with $\tau=200\ \mathrm{\upmu s}$ as an example. The diagonal elements
of the bar graph represent the probabilities of the states remaining
unchanged, the off-diagonal elements are the probabilities of transitions
between different states. The probabilities of each trajectory are non-zero,
indicating that the evolution is not adiabatic. To quantitatively illustrate
the adiabaticity of the switching process, we define the adiabaticity
factor[11] as

$\mathcal{F}_{A}\triangleq\min_{m,n}\min_{0\leq
t\leq\tau}\frac{(\epsilon^{t}_{m}-\epsilon^{t}_{n})^{2}}{|\langle
m(t)|\frac{dH}{dt}|n(t)\rangle|},$ (6)

where $|m(t)\rangle$ and $|n(t)\rangle$ are the instantaneous eigenstates of
$H(t)$, $\epsilon^{t}_{m}$ and $\epsilon^{t}_{n}$ are the corresponding
instantaneous eigenenergies. The switching process is adiabatic when
$\mathcal{F}_{A}\gg 1$ and it’s non-adiabatic otherwise. In the case
considered here, the adiabaticity factor $\mathcal{F}_{A}=1.77$, which agrees
that Fig. 3(c) shows the result of a non-adiabatic process. The work
distribution can be acquired from the population of the thermal state and the
conditional probabilities, i.e. $P(W=W_{m|n})=P_{n}^{0}\cdot P^{\tau}_{m|n}$,
and the result is shown in Fig. 3(d). With the knowledge of the work
statistics, the validity of the JE can be tested. The ensemble average of the
exponentiated work here is $\langle e^{-\beta W}\rangle=0.97(1)$ and the
theoretical prediction of the right-hand side of the JE is $e^{-\beta\Delta
F}=0.966(3)$. Hence, the JE is verified within the error of one standard
deviation in this case.

We tested the JE at different effective temperatures. The effective inverse
temperatures in Fig.4(a)-(c) were preset as $\beta|\lambda|=0,0.5,0.7$,
respectively, with $\beta|\lambda|=0$ corresponding to infinitely high
temperature and the other two representing finite ones. The practical inverse
temperatures were measured to be $\beta_{\rm exp}|\lambda|=0.02(1)$, $0.49(2)$
and $0.71(2)$. The dots in Fig.4 are the results of $\langle e^{-\beta
W}\rangle$ and the bands show the results of the exponentiated free energy
difference $e^{-\beta\Delta F}$. Both the error bar of the dots and the width
of the bands display one standard deviation. All the dots are in the area
covered by the bands, showing the validity of the JE under different effective
temperatures.

To further investigate the universality of the JE, we carried out experiments
with different switching times. The switching time was set as $\tau=$ 5, 50,
125, 200, and 2500 $\mathrm{\upmu s}$. The corresponding adiabaticity factor
varies from 0.04 to 22.09, which covers three magnitudes ranging from a non-
adiabatic one to an adiabatic one. When $\tau=5\ \mathrm{\upmu s}$, the
Hamiltonian and the corresponding energy eigenstates change rapidly, so non-
adiabatic flips happen during the evolution (see section VI of the
Supplementary Information). In contrast, the Hamiltonian and the corresponding
energy eigenstates vary slowly when $\tau=2500\ \mathrm{\upmu s}$. The
evolution of the quantum system follows the trajectory of the energy
eigenstates and non-adiabatic flip barely happens. The experiment results are
displayed separately in three sub-figures of Fig. 4. It is found that,
regardless of the time duration of the switching process, the ensemble average
of the exponentiated work always equals the exponentiated difference in free
energy within the margin of error. This demonstrates that the JE is valid
ranging from the adiabatic region to the nonadiabatic region.

Figure 4:  Results of the JE test. The effective inverse temperatures were set
as $\beta|\lambda|=$ 0, 0.5, and 0.7 in (a)-(c), respectively. Practical
temperatures are given in each subfigure. Black dots and orange bands show the
mesured values of $\langle e^{-\beta W}\rangle$ and $e^{-\beta\Delta F}$,
respectively. The error bars and the width of the bands show one standard
deviation.

In conclusion, we tested the JE in a single spin-1 nuclear spin system.
Nondemolition projective measurements of the three-level nuclear spin have
been realized, which enables direct measurement of the quantum work through
the standard TPM protocol. The validity of the JE was experimentally verified
by tests executed at different effective temperatures and for evolutions
ranging from the nonadiabatic region to the adiabatic region. Our test
solidates the crucial application of the JE in estimating the free energy
difference of practical high-dimensional quantum systems, especially via fast
out-of-equilibrium processes. It is noted that the high fidelity of the
single-shot readout is essential for testing the JE. Infidelity, or errors in
spin state readout, will lead to incorrect assessment of work and other
trajectory-based physical quantities. Such an incorrect assessment becomes
more devastating as the single-shot fidelity decreases, and can even obstruct
the testing of the JE and other related theorems. (see section IV of the
Supplementary Information) So, our realization of high-fidelity single-shot
readout makes the NV center system a promising platform to scrutinize other
important thermodynamic theorems and investigate rich thermodynamic phenomena.
Such as the information-related JE[39, 40, 41], the Crooks fluctuation
theorem[42], the generalized JE for arbitrary initial states[43, 44],
suppression of work fluctuation[45, 46, 47], and quantum stochastic
thermodynamics with feedback involved[48, 49, 50, 51].

We thank Yang Wu and Yunhan Wang for the helpful discussion. This work was
supported by the National Key R&D Program of China (Grant Nos. 2018YFA0306600
and 2016YFB0501603), the National Natural Science Foundation of China (Grant
Nos. 12174373, 61771278 and 12261160569), the Chinese Academy of Sciences
(Grant Nos. XDC07000000, GJJSTD20200001, QYZDY-SSW-SLH004, and QYZDB-SSW-
SLH005), Innovation Program for Quantum Science and Technology (Grant No.
2021ZD0302200), Anhui Initiative in Quantum Information Technologies (Grant
No. AHY050000) and Hefei Comprehensive National Science Center. X. R. thanks
the Youth Innovation Promotion Association of Chinese Academy of Sciences for
their support. W. L. is funded by Beijing University of Posts and
Telecommunications Innovation Group. Z. Y. is supported by Beijing Institute
of Technology Research Fund Program for Young Scholars.

W. L. and Z. N. contributed equally to this work.

## References

  * [1] M. Esposito, U. Harbola and S. Mukamel, Rev. Mod. Phys. 81, 1665-1702(2009).
  * [2] M. Campisi, P. H$\ddot{\mathrm{a}}$nggi and P. Talkner, Rev. Mod. Phys. 771-791(2011).
  * [3] G. T. Landi and M. Paternostro, Rev. Mod. Phys. 93, 035008(2021).
  * [4] H. B. Callen and T. A. Welton, Phys. Rev. 83, 34 (1951).
  * [5] R. Kubo, J. Phys. Soc. Jpn. 12, 570-586 (1957).
  * [6] C. Jarzynski, Phys. Rev. Lett. 78, 2690 (1997).
  * [7] C. Jarzynski, Phys. Rev. E 56, 5018 (1997).
  * [8] J. Liphardt, S. Dumont, S. B. Smith, I. Tinoco Jr. and C. Bustamante, Science 296, 1832-1835 (2002).
  * [9] J. Berg, Phys. Rev. Lett. 100, 188101 (2008).
  * [10] F. Douarche, S. Ciliberto, A. Petrosyan, and I. Rabbiosi, Europhys. Lett. 70, 593-599 (2005).
  * [11] V. Blickle, T. Speck, L. Helden, U. Seifert, and C. Bechinger, Phys. Rev. Lett. 96, 070603 (2006).
  * [12] N. C. Harris, Y. Song and C.-H. Kiang, Phys. Rev. Lett. 99, 068101 (2007).
  * [13] G. Hummer and A. Szabo, Proc. Natl. Acad. Sci. U.S.A. 98, 3658-3661 (2001).
  * [14] O.-P. Saira, Y. Yoon, T. Tanttu, M. Möttönen, D. V. Averin, and J. P. Pekola, Phys. Rev. Lett. 109, 180601 (2012).
  * [15] A. Solfanelli, A. Santini, and M. Campisi, PRX Quantum 2, 030353 (2021).
  * [16] T. B. Batalh$\widetilde{\mathrm{a}}$o, A. M. Souza, L. Mazzola, R. Auccaise, R. S. Sarthour, I. S. Oliveira, J. Goold, G. De Chiara, M. Paternostro, and R. M. Serra, Phys. Rev. Lett. 113, 140601 (2014).
  * [17] F. Cerisola, Y. Margalit, S. Machluf, A. J. Roncaglia, J. P. Paz and R. Folman, Nat. Commun. 8, 1241 (2017).
  * [18] S. An, J.-N. Zhang, M. Um, D. Lv, Y. Lu, J. Zhang, Z.-Q. Yin, H. T. Quan and K. Kim, Nat. Phys. 11, 193-199 (2015).
  * [19] P. H$\ddot{\mathrm{a}}$nggi, and P. Talkner, Nat. Phys. 111, 108-110 (2015).
  * [20] P. Talkner, E. Lutz, and P. H$\ddot{\mathrm{a}}$nggi, Phys. Rev. E 75, 050102(R) (2007).
  * [21] H. Tasaki, arXiv preprint cond-mat/0009244 (2000).
  * [22] J. Kurchan, arXiv preprint cond-mat/0007360 (2000).
  * [23] S. Mukamel, Phys. Rev. Lett. 90, 170604 (2003).
  * [24] P. Neumann, J. Beck. M. Steiner, F. Rempp, H. Fedder, P. R. Hemmer, J. Wrachtrup, and F. Jelezko, Science 329, 542-544 (2010).
  * [25] J. Harrison, M. J. Sellars, M. J. and N. B. Manson, J. Lumin. 107, 245-248 (2004).
  * [26] F. Jelezko, T. Gaebel, I. Popa, A. Gruber and J. Wrachtrup, Phys. Rev. Lett. 92, 076401 (2004).
  * [27] M. W. Doherty, N. B. Manson, P. Delaney, F. Jelezko, J. Wrachtrup and L. C.L. Hollenberg, Phys. Rep. 528, 1-45 (2013).
  * [28] B. Rowland and J. A. Jones, Philos. Trans. R. Soc. A 370, 4636-4650 (2012).
  * [29] J. R. Maze, A. Gali, E. Togan, Y. chu, A. Trifonov, E. Kaxiras and M. D. Lukin, New J. Phys. 13, 025025 (2011).
  * [30] V. Jacques, P. Neumann, J. Beck, M. Markham, D. Twitchen, J. Meijer, F. Kaiser, G. Balasubramanian, F. Jelezko, and J. Wrachtrup, Phys. Rev. Lett. 102, 057403 (2009).
  * [31] J. P. Hadden, J. P. Harrison, A. C. Stanley-Clarke, L. Marseglia, Y.-L. D. Ho, B. R. Patton, J. L. O’Brien, and J. G. Rarity, Appl. Phys. Lett. 97, 241901 (2010).
  * [32] T. Gaebel, M. Domhan, C. Wittmann, I. Popa, F. Jelezko, J. Rabeau, A. Greentree, S. Prawer, E. Trajkov, P.R. Hemmer and J. Wrachtrup, Appl. Phys. B: Lasers Opt. 82, 243-246 (2006).
  * [33] N.B.Manson and J.P.Harrison, Diam. Relat. Mater. 14, 1705-1710 (2005).
  * [34] G. Waldherr, J. Beck, M. Steiner, P. Neumann, A. Gali, Th. Frauenheim, F. Jelezko, and J. Wrachtrup, Phys. Rev. Lett. 106, 157601 (2011).
  * [35] N. Aslam, G. Waldherr, P. Neumann, F. Jelezko, F. and J. Wrachtrup, New J. Phys. 15, 013064 (2013).
  * [36] Y. Doi, _et al_. Phys. Rev. X 4, 011057 (2014).
  * [37] H. Kwon, H. Jeong, D. Jennings, B. Yadin, and M. S. Kim, Phys. Rev. Lett. 120, 150602 (2018).
  * [38] T. Albash and D. A. Lidar, Rev. Mod. Phys. 90, 015002 (2018).
  * [39] V. Vedral, J. Phys. A 45, 272001 (2012).
  * [40] J. M. R. Parrondo, J. M. Horowitz and T. Sagawa, Nat. Phys. 11, 131-139 (2015).
  * [41] D. Barker, M. Scandi, S. Lehmann, C. Thelander, K. A. Dick, M. Perarnau-Llobet and V. F. Maisi, Phys. Rev. Lett. 128, 040602 (2022).
  * [42] G. E. Crooks, Phys. Rev. E 60, 2721 (1999).
  * [43] Z. Gong and H. T. Quan, Phys. Rev. E 92, 012131 (2015).
  * [44] T. M. Hoang, R. Pan, J. Ahn, J. Bang, H. T. Quan and T. Li, Phys. Rev. Lett. 120, 080602 (2018).
  * [45] G. Xiao and J. Gong, Phys. Rev. E 90, 052132 (2014).
  * [46] G. Xiao and J. Gong, Phys. Rev. E 92, 022130 (2015).
  * [47] K. Funo, J.-N. Zhang, C. Chatou, K. Kim, M. Ueda, and A. del Campo, Phys. Rev. Lett. 118, 100602 (2017).
  * [48] G. Manzano, F. Plastina, and R. Zambrini, Phys. Rev. Lett. 121 120602 (2018).
  * [49] Y. Masuyama, K. Funo, Y. Murashita, A. Noguchi1, S. Kono1, Y. Tabuchi, R. Yamazaki, M. Ueda, and Y. Nakamura Nat. Commun. 9, 1291 (2018).
  * [50] M. Naghiloo, J. J. Alonso, A. Romito, E. Lutz, and K.W. Murch Phys. Rev. Lett. 121 030604 (2018).
  * [51] T. Yada, N. Yoshioka, and T. Sagawa, Phys. Rev. Lett. 128 170601 (2022).

Supplementary Material

##  I Experiment Setup and Sample Property

Figure S1:  Experimental setup of our experiment.

The experimental setup is shown in Fig. S1, it consists of three parts: the
microwave system, the optical system and the sample.

The microwave system generates and transmits microwave (MW) and radio-
frequency (RF) pulses to manipulate the NV center. The MW pulses used in our
experiment were modulated by an IQ mixer (Marki IQ0618LXP). The continuous
wave LO-component was provided by a microwave synthesizer (NI FSW-0020). The
pulsed I-component and Q-component were generated by the same port of an
arbitrary wave generator (Keysight M8190A). The pulses were split into two
parts by a power divider (Mini Circuit ZN2PD-183W-s+) and then modulated by
attenuators (Mini Circuit RCDAT-6000-30) and phase shifters (Narda-ATM P1503)
before being fed into the I and Q port of the mixer. The modulated signals
passed through a switch (Quantic PMI P1T-DC40G-65-T-24FM-1NS) and then were
amplified by an amplifier (Mini-Circuits, ZVE-3W-183+) before being fed into a
diplexer (Marki DPX0R5+DPX-0508). The RF pulses were generated by another port
of the arbitrary wave generator. The pulses passed through a switch (Mini
Circuit ZASWA-2-50DRA+), amplified by an amplifier (Mini Circuit LZY-22+), and
then fed into the diplexer. Finally, the MW and RF pulses combined by the
diplexer were fed into a home-designed coplanar waveguide to manipulate the
evolution of the NV center.

The optical system contains three components, the 532-nm component, the 594-nm
component, and the fluorescence collection component. The 532-nm component
generates 532-nm laser pulses to initialize and readout the spin state of the
NV center. A polarizing beam splitter (PBS121) selects the S-polarized beam of
the continuous 532-nm laser (generated by MSL-III-532-150mW). The selected
beam went through an acousto-optic modulator (ISOMET, AOMO 3200-121) twice to
obtain 532-nm laser pulses and to decrease the laser leakage. A quarter-wave
plate (WPQ05ME-532) together with a mirror was utilized to change the
polarization and transmission direction of the laser pulses so they can pass
through the acousto-optic modulator twice. Afterwards, the laser pulses were
coupled into an optical fiber via a reflective collimator (F810FC-543) after
the expansion of a beam expander (GBE05-A). The 594-nm component generates
594-nm laser pulses to detect the charge state of the NV center. The laser
pulses were generated utilizing a similar light path as the 532-nm laser
pulses by replacing some instruments (laser: MGL-F-593.5-100mW, quarter-wave
plate: WPQ05ME-588, reflective collimator: RC04FC-P01). The 532-nm and 594-nm
laser pulses were coupled by a wavelength division multiplexer (RGB46HA), and
then reflected by a dichroic mirror and a mirror. Finally, the laser pulses
were focused on the sample by an oil object (Olympus, PLAPON 60*O, NA 1.45).
The fluorescence emitted by the sample went through the same oil object and
was collected by an avalanche photodiode (Perkin Elmer, SPCM-AQRH-14). The
photon counting was processed by a counter card.

Figure S2:  Property of the NV center in our experiment. (a)-(c), conditional
$T_{1}$ of the nuclear spin under 532-nm laser illumination, the experimental
sequences are shown in the insets. (d) Conditional $T_{2}^{*}$ of the electron
spin, the resonant Ramsey sequence was applied. (e) Image of the solid
immersion lens in diamond.

Our sample is an NV center in a [100] face bulk diamond. The nitrogen
concentration of the diamond is less than 5 p.p.b. and the abundance of
${}^{13}{\rm C}$ is at the natural level of $1.1\%$. A solid immersion lens
was etched into the surface of the diamond[4] to increase the fluorescence
collection as shown in Fig. S2 (e). The diamond was placed on a homemade
coplanar waveguide in the confocal setup. The static magnetic field was
provided by a cylindrical permanent magnet. A three-axis stage was utilized to
adjust the position of the magnet, such that the direction of the magnetic
field is along the symmetry axis of the NV center. In our experiment, the
static magnetic field was $B\approx 7400\ {\rm G}$ to effectively suppress the
spin flip-flop process caused by the 532-nm laser[1, 2, 3] to prolong the
longitudinal relaxation time of the nuclear spin.

The conditional longitudinal relaxation of the nuclear spin was measured by
inserting a 532-nm laser pulse of time duration $\tau$ between two single-shot
judgments of the corresponding nuclear spin state. The results are shown in
Fig. S2 (a)-(c), the average $T_{1,n}$ is $3.8(3){\rm ms}$. It is noticed that
the laser application will cause some polarization of the nuclear spin, so the
final population in Fig. S2 (a)-(c) does not satisfy a thermal distribution.
In each projective measurement of the nuclear spin, the NV center receives
approximately 0.4 ms-long laser illumination, which is tolerable given the
longitudinal relaxation times shown here. The dephasing time of the electron
spin was measured via Ramsey sequences after polarizing the nuclear spin into
state $|-1\rangle_{n}$. The result shows that the dephasing time is
$T_{2}^{*}=1.4(1)\ {\rm\mu s}$ as displayed in Fig. S2 (d).

##  II Charge State Measurement

There are three kinds of charge states for an NV center, the negatively
charged NV center ($\rm NV^{-}$), the neutrally charged NV center ($\rm
NV^{0}$), and the positively charged NV center ($\rm NV^{+}$). Only NV- was
used in our experiment, but an NV- can be turned into an NV0 under 532-nm
laser illumination[5, 6, 7]. This transition can invalidate our MW and RF
pulses because NV centers in different charge states possess different level
structures and different resonant frequencies. A 594-nm laser pulse can excite
the $\rm NV^{-}$ to the first excited state but can not excite the $\rm
NV^{0}$. Thus, we inserted two 594-nm laser pulses in the experimental
sequence to exclude the experiment trials that were not done with NV-[8, 9]
(see fig.3 of the main text). To determine the threshold for the charge state
judgment, the sequence shown in the inset of Fig. S3 was repeated, and the
threshold was extracted from the photon counting histogram in Fig. S3.
Eventually, with the charge state measurement results, the experiments carried
out with NV- could be selected.

Figure S3:  Photon counting histogram of the single-shot readout of the charge
state of the NV center. Data was collected from 80000 runs of the sequence
shown in the inset. The threshold is set to $3$ to distinguish the $\rm
NV^{-}$.

##  III Projective Measurement of the Spin-1 Nuclear Spin

In this section, the projective measurement of the nuclear spin will be
introduced. Since the projective measurement is realized by cascading two
single-shot readouts, we will introduce the single-shot readout first. The
procedure of the single-shot readout is introduced in subsection A, and the
definition, the experimental acquisition, and the optimization of the fidelity
of the single-shot readout are given in subsection B. In subsection C, we will
explain how to properly cascade the single-shot readout to form the projective
measurement of the nuclear spin and show its performance.

###  III.1 Procedure of the single-shot readout

The quantum circuit of the single-shot readout is shown in Fig. S4 (a).
$|\psi\rangle_{n}$ denotes the state of the nuclear spin to be judged, and the
electron spin is polarized into state $|0\rangle_{e}$ before the readout.
$\pi_{k}$ is a selective MW $\pi$ pulse that flips the electron spin from the
bright state to the dark state when the nuclear spin state is $|k\rangle_{n}$
($k=\pm 1$ in this experiment). The unit of the single-shot readout, which
consists of a $\pi_{k}$ pulse and a readout of the electron spin (via a 532-nm
laser pulse), is repeated $\rm{N}$ times to form a single-shot readout. The
time trace of fluorescence collected by repeating the single-shot readout of
$|+1\rangle_{n}$ is shown in Fig. S4 (b) (where we have chosen ${\rm N}=900$),
and the dots represent the photon number collected. With an appropriately
chosen threshold $T$, we can judge the nuclear spin state in $|+1\rangle_{n}$
when the photon number is smaller than $T$ and judge the nuclear spin state in
$|0\rangle_{n}$ or $|-1\rangle_{n}$ when the photon number is larger than $T$.
The red line demonstrates one typical result.

Figure S4:  Illustration the single-shot readout. (a) The quantum circuit of
the single-shot readout. (b) Photoluminescence trace obtained from the circuit
with ${\rm{N}}=900$ and $k=+1$. The lower platform of the red line indicates
the nuclear spin is in $|+1\rangle_{n}$, the upper platform indicates the
nuclear spin is in $|0\rangle_{n}$ or $|-1\rangle_{n}$. (c) Maximal fidelity
$F_{\rm{N}}$ versus bound size $b$. (d) The photon counting histograms
obtained with $b=9$.

###  III.2 Fidelity of the single-shot readout

With the nuclear spin state distinguished by a threshold $T$, we can define
the fidelity of the single-shot readout as $F=\frac{F_{1}+F_{1}}{2}$, where
$F_{1(2)}=1-\frac{1}{2\bar{n}_{1(2)}}$ with $\bar{n}_{1(2)}$ denoting the
average number of points of the photon numbers being consecutively smaller
(greater) than $T$. In Fig. S4 (b), $\bar{n}_{1(2)}$ is the average length of
the lower (upper) platforms. Since $\bar{n}_{1(2)}$ can be regarded as the
longitudinal relaxation time of state $|+1\rangle_{n}$ ($|0\rangle_{n}$ or
$|-1\rangle_{n}$), the fidelity represents the possibility of the state
remaining unchanged after we made a judgment on the nuclear spin. In practice,
the fidelity depends on the choice of $T$, the repeat time $\rm{N}$, and the
accuracy of the selective $\pi_{k}$ pulse if the longitudinal relaxation time
of the nuclear spin is fixed. All these three parameters need to be optimized
to obtain a high-fidelity single-shot readout of the nuclear spin state.

We first show how to optimize $\rm N$ and $T$. For every ${\rm N}$, we can
find an optimal threshold $T_{\rm{N}}$ to achieve maximal fidelity
$F_{{\rm{N}}}$ by traversing over $T$. Then the optimal $\rm{N}$ can be
obtained by finding the highest $F_{\rm{N}}$. Meanwhile, the corresponding
$T_{\rm{N}}$ is the optimal threshold. Experimentally, we carried out the unit
of the single-shot readout 100 times per run to ensure the number of collected
photons is not too small. Thus $\rm{N}$ is always a multiple of 100, that is
${\rm N}=100b$, with $b$ denoting how many 100 repeats were bundled. Fig. S4
(c) shows the dependence of $F_{\rm{N}}$ on the bundle size $b$, where we can
see that the optimal fidelity is achieved when $b=9$. Fig. S4 (d) displays the
corresponding histogram of the photon counts. With the threshold $T$ set as
107, the optimal fidelity $F=0.98(2)$ can be acquired.

Figure S5:  Photon counting histograms of the single-shot readout of the
nuclear spin state of the NV center with different selective $\pi$ pulses and
the optimized selective $\pi$ pulse. (a)-(b), the results obtained by single-
shot readouts that distinguish $|+1\rangle_{n}$ and $|-1\rangle_{n}$ with
square-wave $\pi$ pulses, respectively. (c) The amplitude (upper graph) and
phase (lower graph) of the optimized selective $\pi_{+1}$ pulse. (d) The
robustness against noise of the pulse in (c). (e)-(f), the results obtained by
single-shot readouts that distinguish $|+1\rangle_{n}$ and $|-1\rangle_{n}$
with optimized $\pi$ pulses, respectively.

Then we discuss how the performance of the selective $\pi_{k}$ pulse affects
the optimal fidelity of the single-shot readout. The goal of the $\pi_{k}$
pulse is to flip the electron spin to the dark state when the nuclear spin
state is $|k\rangle_{n}$ and keep the electron spin in the bright state if the
nuclear spin state is not $|k\rangle_{n}$. Then the state of the nuclear spin
can be acquired via the fluorescence difference of the electron spin. However,
shift of the resonance frequency, fluctuation of the pulse Rabi frequency, and
crosstalk between different nuclear spin subspaces can cause the failure of
the $\pi_{k}$ pulse. So we designed an optimized selective $\pi_{k}$ pulse
utilizing the gradient ascent pulse engineering algorithm[10]. The optimized
pulse contains ten segments, the Rabi frequency ($\Omega/2\pi$) and pulse
phase $\phi_{+1}$ of each segment are shown in Fig. S5 (c). The performance of
the optimized $\pi_{+1}$ pulse is given in Fig. S5 (d), from where we can see
the fidelity of the pulse remains higher than 0.999 for a wide range of
resonance frequency detuning $\delta/2\pi$ and relative pulse amplitude
fluctuation. As for the $\pi_{-1}$ pulse, we need only to replace of phase of
$\pi_{+1}$ with $\phi_{-1}=\pi-\phi_{+1}$. The photon counting histograms
obtained via naive square-wave ($\Omega_{rabi}=200{\rm{kHz}}$) and optimized
$\pi_{k}$ pulses are shown in Fig. S5 (a)-(b) and (e)-(f), respectively. The
corresponding fidelities are $0.96(2)$ (Fig. S5 (a)), $0.95(2)$ (Fig. S5 (b))
and $0.98(2)$ (Fig. S5 (e)), $0.98(1)$ (Fig. S5 (f)), respectively.

Figure S6:  (a) The circuit of the projective measurement in our experiment.
(b) The conditional probability obtained from a TPM protocol with an empty
control sequence in its switching process. The error bars represent one
standard deviation.

###  III.3 The projective measurement

The projective measurement of the nuclear spin is realized by cascading two
single-shot readouts that distinguish $|+1\rangle_{n}$ and $|-1\rangle_{n}$,
respectively. The bundle sizes $b$ and $b^{{}^{\prime}}$ for the two single-
shot readouts are decided with the guidance of Fig. S4 (c). For the two
single-shot readouts, $b$ and $b^{{}^{\prime}}$ should be both chosen in the
flat high-fidelity interval so that both single-shot readouts are done with
high fidelity. On the other hand, the length of the laser pulse applied to the
system during a projective measurement is proportional to $b+b^{{}^{\prime}}$.
To avoid a significant relaxation, $b+b^{{}^{\prime}}$ should also be in the
flat interval, so we chose $b=b^{{}^{\prime}}=9$.

The circuit of the projective measurement of the nuclear spin state is in Fig.
S6 (a). The transition matrix of executing two consecutive projective
measurements is shown in Fig. S6 (b) to illustrate the fidelity of the
projective measurement. The matrix was obtained by repeating the pulse
sequences shown in Fig. S6 (a). Off-diagonal elements are the probabilities of
spin-flip and diagonal elements are the probabilities of the state remaining
unchanged. Ideally, the off-diagonal elements should be zero, however, in a
practical NV center system, the inevitable longitudinal relaxation causes the
spin-flip during the projective measurement.

##  IV The influence of single-shot readout infidelity to an experimental test
of the Jarzynski equality

Experimentally, the Jarzynski equality was tested via the two-point
measurement protocol. Two projective measurements were executed before and
after the switching process to obtain the work distribution. Each projective
measurement of the three-level nuclear spin contains two single-shot readouts.
Infidelity of the single-shot readout means errors in spin state judgment,
which will lead to incorrect assessments of work and further result in the
measured ensemble averaging value $\langle e^{-\beta W}\rangle$ deviating from
$e^{-\beta\Delta F}$. The deviation increases as the single-shot readout
fidelity declines, and can even prevent a check of the Jarzynski equality.
Below we analyze this problem in detail.

To start, we make an assumption about the infidelity of the single-shot
readout, that is it comes from the quantum jumps of the nuclear spin which
occurs when applying laser pulses to realize the readout. To characterize the
infidelity, we define the following probabilities. During a single-shot
readout, the probabilities that no quantum jump occurs when the nuclear spin
is in state $|$+1$\rangle_{n}$, $|0\rangle_{n}$, and $|$-1$\rangle_{n}$ are
$p_{+1}$, $p_{0}$, and $p_{-1}$, respectively. The probability that a quantum
jump occurs and the nuclear spin jumps from $|\pm 1\rangle_{n}$ to
$|0\rangle_{n}$ is $1-p_{\pm 1}$. The probability that $|0\rangle_{n}$ jumpes
to $|\pm 1\rangle_{n}$ is $p_{0}^{\pm}$ and satisfy
$p_{0}+p_{0}^{+}+p_{0}^{-}=1$.

The total time of laser application during the single-shot readout was about
0.2 ms. As indicated by the longitudinal relaxation time of the nuclear spin
given in Fig. S2 (a)-(c), the probabilities that the quantum jumps occur are
about 0.05. The probability that two or more quantum jumps occur during the
single-shot readout should be very small (about 0.003 or less). Thus, as an
approximation, we consider the case that the quantum jump occurs at most once
during the single-shot readout in the subsequent analysis.

Based on the assumption and approximation above, we analyze the influence of
infidelity on a single-shot readout by taking the nuclear spin state being
$|$+1$\rangle_{n}$ before the readout as an example. The probability that no
quantum jump occurs during the single-shot readout is $p_{+1}$. In this case,
record of the single-shot readout will be ‘$|$+1$\rangle_{n}$’, and the spin
state will remain $|$+1$\rangle_{n}$ after the readout. If a quantum jump
occurs during the single-shot readout, the spin state after readout will be
$|0\rangle_{n}$. The record of the single-shot readout depends on the moment
at which the quantum jump occurs. As seen in Fig. S4 (a), a single-shot
readout is realized by repeating the pulse sequence for N times. We denote the
average number of photons to be collected for a single application of the
pulse sequence as $\rm{C_{+1}}$ and $\rm{C^{\rm{not}}_{+1}}$ depending on
whether the nuclear spin state is $|$+1$\rangle_{n}$ or not. Then, the central
value of the left (right) peak in Fig. S4 (d) is $\rm{N}\cdot C_{+1}$
($\rm{N}\cdot C^{\rm{not}}_{+1}$) and the threshold is
$\rm{N\cdot(C_{+1}+C^{not}_{+1})/2}$. If the quantum jump occurs in the first
half of the single-shot readout (the time period of applying the $\rm{1^{st}}$
to the $\rm{(\frac{N}{2})^{st}}$ pulse sequence), then the number of photons
collected will exceed the threshold and record of the single-shot readout will
be ‘Not $|$+1$\rangle_{n}$’. Otherwise, the record will be
‘$|$+1$\rangle_{n}$’. The quantum jump occurs randomly during the single-shot
readout procedure, so the probability of it occurring in the first or second
half should be equal, and both are $(1-p_{+1})/2$. In conclusion, the
influence of infidelity on a single-readout readout is (I) a wrong record,
(II) a jump of the spin state, or both.

Projective measurement of the three-level nuclear spin was realized by
cascading two single-shot readouts and the outcome was derived by combining
the records of these single-shot readouts. The influence of the single-shot
readout infidelity on the projective measurement can be analyzed similarly. In
short, when performing a projective measurement on nuclear spin state
$|i\rangle_{n}$, the existence of quantum jumps can lead to an outcome
$|j\rangle_{n}$ while the spin state after measurement is $|k\rangle_{n}$.
Here $i,j$, and $k$ $\in\\{+1,0,-1\\}$. We denote the probability of this
event as $P^{i}_{j,k}$. For different combinations of $i,j$, and $k$, the
expressions of $P^{i}_{j,k}$ are summarized in Table. S1.

Table S1: The probability $P^{i}_{j,k}$ spin state before projective measurement |  spin state after projective measurement |  measurement outcome
---|---|---
$|$+1$\rangle_{n}$ | $|0\rangle_{n}$ |  $|$-1$\rangle_{n}$
$|$+1$\rangle_{n}$ |  $|$+1$\rangle_{n}$ | $p_{+1}^{2}+p_{0}^{+}(1-p_{+1})/2$ | $p_{0}^{+}(1-p_{+1})/2$ | 0
$|0\rangle_{n}$ | $p_{+1}(1-p_{+1})+p_{0}(1-p_{+1})/2$ | $p_{0}(1-p_{+1})/2$ | 0
$|$-1$\rangle_{n}$ | $p_{0}^{-}(1-p_{+1})/4$ | $p_{0}^{-}(1-p_{+1})/4$ | $p_{0}^{-}(1-p_{+1})/4$
$|0\rangle_{n}$ |  $|$+1$\rangle_{n}$ | $p_{+1}p_{0}^{+}/2$ | $p_{0}p_{0}^{+}+p_{+1}p_{0}^{+}/2$ | 0
$|0\rangle_{n}$ | $p_{0}^{+}(1-p_{+1})/2$ | $p_{0}^{2}+p_{0}^{+}(1-p_{+1})/2+p_{0}^{-}(1-p_{-1})/2$ | $p_{0}^{-}(1-p_{-1})/2$
$|$-1$\rangle_{n}$ | 0 | $p_{0}p_{0}^{-}/2$ | $p_{0}p_{0}^{-}/2+p_{-1}p_{0}^{-}$
$|$-1$\rangle_{n}$ |  $|$+1$\rangle_{n}$ | 0 | $p_{0}^{+}(1-p_{-1})$ | 0
$|0\rangle_{n}$ | 0 | $p_{-1}(1-p_{-1})/2+p_{0}(1-p_{-1})$ | $p_{-1}(1-p_{-1})/2$
$|$-1$\rangle_{n}$ | 0 | $p_{0}^{-}(1-p_{-1})/2$ | $p_{-1}^{2}+p_{0}^{-}(1-p_{-1})/2$

Finally, we analyze the influence of single-shot readout infidelity on the
measured work distribution. According to the two-point measurement protocol,
the work distribution can be written as
$P(W)=\sum_{x,y}P_{|x(0)\rangle\to|y(\tau)\rangle}\cdot\delta(W-W_{y|x}),$
with $W_{y|x}=\epsilon_{y}^{\tau}-\epsilon_{x}^{0}$ denoting the work applied
to the nuclear spin for trajectory $|x(0)\rangle\to|y(\tau)\rangle$ and
$P_{|x(0)\rangle\to|y(\tau)\rangle}$ being the probability of this trajectory.
Theoretically, this probability is

$P_{|x(0)\rangle\to|y(\tau)\rangle}^{\rm{theo}}=P_{x}^{0}\cdot
P_{y|x}^{\tau},$ (S1)

where $P_{x}^{0}$ is the population of state $|x(0)\rangle$ in the initial
thermal state and $P_{y|x}^{\tau}$ is the probability that $|x(0)\rangle$
evolved to $|y(\tau)\rangle$ after the switching process. However, taking into
account the effects of quantum jumps, $P_{|x(0)\rangle\to|y(\tau)\rangle}$
needs to be revised as

$P_{|x(0)\rangle\to|y(\tau)\rangle}^{\rm{simu}}=\sum_{i,j,k,l}P_{i}^{0}\cdot
P^{i}_{x,j}\cdot P_{k|j}^{\tau}\cdot P^{k}_{y,l},$ (S2)

where $P^{i}_{x,j}$ and $P^{k}_{y,l}$ denote the outcome of the first and
second projective measurement are $|x(0)\rangle$ and $|y(\tau)\rangle$,
respectively. According to these outcomes, the work for this experimental
trial will be taken as $W_{y|x}$.

The revision of work distribution will result in the measured ensemble
averaging value $\langle e^{-\beta W}\rangle$ deviating from $e^{-\beta\Delta
F}$. This deviation can be defined as

$\Delta=\langle e^{-\beta W}\rangle-e^{-\beta\Delta
F}=\sum_{x,y}P_{|x(0)\rangle\to|y(\tau)\rangle}\cdot e^{-\beta
W_{y|x}}-e^{-\beta\Delta F}.$ (S3)

We performed a simulation to calculate $\Delta$ and show the influence of
single-shot readout infidelity on an experimental test of the Jarzynski
equality. In the simulation, the Hamiltonian model in Eq. (3) of the main text
was utilized and the inverse temperature was set as $|\lambda\beta|=0.7$.
$\Delta F$ and $W_{y|x}$ can be calculated from the Hamiltonian. Two single-
shot readout fidelities, $F=$ 90% and 98% were considered. Based on these
fidelities, the probabilities defined above can be obtained as follows. When
repeatedly executing the single-shot readout, the probability that the nuclear
spin stays in state $|i\rangle_{n}~{}(i=+1,0,-1)$ for $k$ consecutive data
points can be expressed as $P_{i}(k)=p_{i}^{k-1}(1-p_{i})$. As a result, the
average number of points that the spin state being $|i\rangle_{n}$ is
$\bar{n}^{i}(p_{i})=\sum_{k=1}^{+\infty}k\cdot P_{i}(k)=\frac{1}{1-p_{i}}$. In
addition, as given in subsection III. B, the dependence of single-shot readout
fidelity $F$ on $\bar{n}$ can be estimated as
$F^{i}=1-\frac{1}{2\bar{n}^{i}}$. Thus, the probabilities $p_{+1}$, $p_{0}$,
and $p_{-1}$ can be obtained from the given fidelity $F$. In our simulation,
these probabilities are
$\\{p_{+1}=p_{0}=p_{-1}=0.81,p_{0}^{+}=p_{0}^{-}=0.095\\}$ when $F=90\%$ and
$\\{p_{+1}=p_{0}=p_{-1}\approx 0.96,p_{0}^{+}=p_{0}^{-}\approx 0.02\\}$ when
$F=98\%$.

Figure S7:  Influence of single-shot readout infidelity to an experimental
test of the Jarzynski equality. The black lines denote the value of $\langle
e^{-\beta W}\rangle-e^{-\beta\Delta F}$ predicted by the Jarzynski equality.
The red lines are the simulation results with the single-shot readout
fidelities being 90% (a) and 98% (b), respectively. The error bars are chosen
from the experimental data and represent the 95% confidence interval.

The resulting deviation $\Delta$ is displayed in Fig. S7. The figures show
that a worse single-shot readout fidelity will result in a larger deviation.
Some deviations can even exceed the $95\%$ confidence interval when the
fidelity is only 90%. Thus, the high fidelity of the single-shot readout is
crucial for an experimental test of the Jarzynski equality.

##  V Realization of the Switching Process in the NV Center System

The internal Hamiltonian of the nuclear spin that we implemented the switching
process on is

$H_{0}=2\pi(PI_{z}^{2}+\omega_{n}I_{z}),$ (S4)

where $P=-4.95\ {\rm MHz}$ is the nuclear quadrupolar interaction constant,
$\omega_{n}$ is the Zeeman frequency of the nuclear spin. $I_{z}$ is the
spin-1 operator of the nuclear spin. To construct
$H(t)=\lambda[a(t)I_{z}+b(t)I_{x}]$ from $H_{0}$, we choose the following
interaction picture

$U_{rot}(t)=e^{i\int_{0}^{t}(\lambda a(\tau)I_{z}-H_{0})d\tau}.$ (S5)

Then we consider the off-diagonal terms of $H(t)$, the Hamiltonian of the
nuclear spin and the detuned radio-frequency (RF) pulses we apply is

$H_{C}(t)=2\pi\sqrt{2}\left\\{2\Omega_{1}(t)\cos{\left[\int\omega_{1}(t)\mathrm{d}t+\phi_{1}(t)\right]}+2\Omega_{2}(t)\cos{\left[\int\omega_{2}(t)\mathrm{d}t+\phi_{2}(t)\right]}\right\\}I_{x},$
(S6)

where $\Omega_{1}(t)$, $\omega_{1}(t)$ and $\phi_{1}(t)$ ($\Omega_{2}(t)$,
$\omega_{2}(t)$ and $\phi_{2}(t)$) are the amplitude, angular frequency and
phase of the first (second) RF pulse. The total Hamiltonian of the NV center
is

$H_{tot}(t)=H_{0}+H_{C}(t).$ (S7)

In the interaction picture of Eq. S5, $H_{tot}$ becomes

$H_{tot}^{rot}(t)=U_{rot}(t)H_{tot}(t)U_{rot}^{\dagger}(t)-iU_{rot}(t)\frac{\partial
U_{rot}^{\dagger}(t)}{\partial t}\\\ =\lambda
a(t)I_{z}+U_{rot}(t)H_{C}(t)U_{rot}^{\dagger}(t).$ (S8)

We choose

$\displaystyle\omega_{1}=P+\omega_{n}-\lambda a(t),$ (S9)
$\displaystyle\omega_{2}=P-\omega_{n}+\lambda a(t),$

so in the condition of ratoting wave approximation, the total Hamiltonian can
be simplified as

$\begin{pmatrix}\lambda
a(t)&2\pi\Omega_{1}(\cos{\phi_{1}}-i\sin{\phi_{1}})&0\\\
2\pi\Omega_{1}(\cos{\phi_{1}}+i\sin{\phi_{1}})&0&2\pi\Omega_{2}(\cos{\phi_{2}}+i\sin{\phi_{2}})\\\
0&2\pi\Omega_{2}(\cos{\phi_{2}}-i\sin{\phi_{2}})&-\lambda a(t)\end{pmatrix}.$
(S10)

Furthermore, the amplitudes and phases are set to

$\displaystyle\Omega_{1}=\frac{\lambda b(t)}{2\sqrt{2}\pi},$ (S11)
$\displaystyle\Omega_{2}=\frac{\lambda b(t)}{2\sqrt{2}\pi},$
$\displaystyle\phi_{1}=\phi_{2}=0.$

The target Hamiltonian $H(t)$ is realized.

Figure S8:  Numerical simulations of the switching process with different
switching time. The evolution starts from three possible initial states: (a),
(d), (g) $|+1\rangle_{n}$; (b), (e), (h) $|0\rangle_{n}$; (c), (f), (i)
$|-1\rangle_{n}$. $|+1(t)\rangle$, $|0(t)\rangle$ and $|-1(t)\rangle$ are the
instantaneous eigenstates of $H(t)$.

##  VI Adiabaticity of the Switching Process

To quantitatively illustrate the adiabaticity of the switching processes, we
define the adiabaticity factor[11] as

$\mathcal{F}_{A}\triangleq\min_{m,n}\min_{0\leq
t\leq\tau}\frac{(\epsilon^{t}_{m}-\epsilon^{t}_{n})^{2}}{|\langle
m(t)|\frac{dH}{dt}|n(t)\rangle|},$ (S12)

where $|m(t)\rangle$ and $|n(t)\rangle$ are the instantaneous eigenstates of
$H(t)$, $\epsilon^{t}_{m}$ and $\epsilon^{t}_{n}$ are the corresponding
instantaneous eigenenergies. The switching process is adiabatic when
$\mathcal{F}_{A}\gg 1$, and it’s non-adiabatic otherwise.

The simulations of real-time inner product between the state of the nuclear
spin and the instantaneous eigenstates are shown in Fig. S8. The switching
time is $\tau=5,\ 200,\ 2500\ \mathrm{\upmu s}$, respectively. The
corresponding adiabaticity factors are 0.04, 1.77 and 22.09, respectively. In
Fig. S8 (a)-(c), the time duration is $\tau=5\ \mathrm{\upmu s}$. Although the
nuclear spin state remains unchanged at the end of the switching process, non-
adiabatic transitions take place during the process, which agrees with the
adiabatic factor $\mathcal{F}_{A}=0.04$. Fig. S8 (d)-(f) displays the result
of a typical non-adiabatic process with $\tau=200\ \mathrm{\upmu s}$. Non-
adiabatic transition happens throughout the entire process and the transition
probability is non-zero for all trajectories at the end of the switching
process. Fig. S8 (g)-(i) shows the case of $\tau=2500\ \mathrm{\upmu s}$. The
evolution of the states follow the change of the eigenstates, which indicates
that the process of $\tau=2500\ \mathrm{\upmu s}$ is an adiabatic one.

##  VII Experimental Data Processing

The inverse temperature, the ensemble average of exponentiated work and free
energy difference are calculated via Monte Carlo (MC) simulation. First, the
inverse temperature $\beta_{\rm exp}$ was calculated using the measured joint
probability from the projective measurements. In our experiment, we measured
the joint probability $P_{m,n}=P^{0}_{n}P^{\tau}_{m|n}$ with errors calculated
by binomial statistics. In the $k$th ($k=1,2...10^{4}$) run of the MC
simulation, we firstly generated random probabilities
$\\{p_{m,n}^{k}\\}_{m,n=1}^{3}$, where each $p_{m,n}^{k}\sim
N(P_{m,n},\sigma^{2}_{P_{m,n}})$. So the diagonal elements of the initial
thermal state $\rho^{k}$ are $\rho_{nn}^{k}=\sum_{m=1}^{3}p_{m,n}^{k}$. To
determine the inverse temperature $\beta^{k}$, the physically reasonable
thermal state $\rho_{\beta}^{k}=\frac{1}{Z_{\beta}}e^{-\beta^{k}H(0)}$ that
has the maximal fidelity $F_{\beta}=({\rm
Tr}\sqrt{\sqrt{\rho_{\beta}^{k}}\rho^{k}\sqrt{\rho_{\beta}^{k}}})^{2}$ was
found, where $\beta^{k}$ is the inverse temperature in this run. Second, in
each run of the MC simulation, the estimation of the ensemble average of the
exponentiated work is $\langle
e^{-\beta^{k}W}\rangle=\sum_{m,n=1}^{3}p^{k}_{m,n}e^{-\beta^{k}W_{m|n}}$,
where $W_{m|n}$ is the work done on the system in the trajectory from
$|n(0)\rangle$ to $|m(\tau)\rangle$. Finally, the $e^{-\beta\Delta F}$ term in
the Jarzynski equality could be estimated as $e^{-\beta^{k}\Delta
F}=\frac{{\rm Tr}[e^{-\beta^{k}H(t)}]}{{\rm Tr}[e^{-\beta^{k}H(0)}]}$. Note
that, unlike the simulations to obtain the inverse temperature and the
ensemble average of exponentiated work, we averaged the joint probabilities
obtained from experiment trials done with different time duration of the
switching process but with the same preset temperature in the MC simulations
to obtain $e^{-\beta^{k}\Delta F}$. Thus, the theoretical prediction of
$e^{-\beta\Delta F}$ is displayed as a band in each sub-figure in Fig. 4 in
the main text. After the simulation has run $K=10^{4}$ times, we statistically
analyzed $\\{\beta^{k}\\}_{k=1}^{K=10^{4}}$, $\\{\langle
e^{-\beta^{k}W}\rangle\\}_{k=1}^{K=10^{4}}$ and $\\{e^{-\beta^{k}\Delta
F}\\}_{k=1}^{K=10^{4}}$ to determine $\beta_{\rm exp}$, $\langle e^{-\beta
W}\rangle$ and $e^{-\beta\Delta F}$ and their errors.

## References

  * [1] Neumann, P. _et al_. Single-shot readout of a single nuclear spin. _Science_ 329, 542-544 (2010).
  * [2] Jacques, V. _et al_. Dynamic polarization of single nuclear spins by optical pumping of nitrogen-vacancy color centers in diamond at room temperature. _Phys. Rev. Lett._ 102, 057403 (2009).
  * [3] Maze, J. R. _et al_. Properties of nitrogen-vacancy centers in diamond: the group theoretic approach. _N. J. Phys._ 13, 025025 (2011).
  * [4] Hadden, J. P. _et al_. Strongly enhanced photon collection from diamond defect centers under microfabricated integrated solid immersion lenses. _Appl. Phys. Lett._ 97, 241901 (2010).
  * [5] Gaebel, T. _et al_. Photochromism in single nitrogen-vacancy defect in diamond. _Appl. Physics. B-Lasers O_ 82, 243-246 (2006).
  * [6] Manson, N. B. & Harrison J. Photo-ionization of the nitrogen-vacancy center in diamond. _Diamond Related Materials_ 14, 1705-1710 (2005).
  * [7] Waldherr, G. _et al_. Dark states of single nitrogen-vacancy centers in diamond unraveled by single shot NMR. _Phys. Rev. Lett._ 106, 157601 (2011).
  * [8] Aslam, N., Waldherr, G., Neumann, P., Jelezko, F. & Wrachtrup J. Photo-induced ionization dynamics of the nitrogen vacancy defect in diamond investigated by single-shot charge state detection. _N. J. Phys._ 15, 013064 (2013).
  * [9] Doi, Y. _et al_. Deterministic electrical charge-state initialization of single nitrogen-vacancy center in diamond. _Phys. Rev. X_ 4, 011057 (2014).
  * [10] Rowland, B. & A. Jones, J. Implementing quantum logic gates with gradient ascent pulse engineering: principles and practicalities. _Phil. Trans. R. Soc. A_ 370, 4636-4650 (2012).
  * [11] Albash, T. & Lidar, D. A. Adiabatic quantum computation. _Rev. Mod. Phys._ 90, 015002 (2018).