Quantum magnetometry using two-stroke thermal machines

The precise estimation of small parameters is a challenging problem in quantum metrology. Here, we introduce a protocol for accurately measuring weak magnetic fields using a two-level magnetometer, which is coupled to two (hot and cold) thermal baths and operated as a two-stroke quantum thermal machine. Its working substance consists of a two-level system (TLS), generated by an unknown weak magnetic field acting on a qubit, and a second TLS arising due to the application of a known strong and tunable field on another qubit. Depending on this field, the machine may either act as an engine or a refrigerator. Under feasible conditions, determining this transition point allows to reduce the relative error of the measurement of the weak unknown magnetic field by the ratio of the temperatures of the colder bath to the hotter bath.

In parallel, it became crucial to understand and find the ultimate bounds of accuracy of parameter estimation [31,32]. The accuracy of estimating a parameter x is quantified by the corresponding relative error d = e x x x , where δx denotes the absolute error of estimation. Previous studies have shownê x to be lowerbounded by the Cramer-Rao bound, which in turn depends on the quantum Fisher information (QFI) [5,7,[33][34][35][36]. In general,ê x increases as x → 0. Consequently, developing ways of reducing the relative error of estimation of various parameters has been one of the major aims of the field of quantum metrology [7]. Recent studies have shown the possibility of using periodic control to enhance the precision of quantum probes [37], while other studies have suggested two-level systems (TLSs) with maximally degenerate excited states to be optimal for high-precision thermometry [6].
In this work, we propose using a quantum thermal machine as a quantum probe. Quantum thermal machines are of great importance in the fields of quantum technologies and quantum thermodynamics [38][39][40][41][42][43][44][45]; at the same time, they were also shown to be beneficial for high-precision thermometry [46]. We present the possibility of using a quantum heat machine [47] as a magnetometer to estimate weak magnetic fields with high accuracy. To this end, we consider a pair ( and  ) of qubits (spin-1/2 particles), one () subject to a known strong field, leading to a level splitting of w 2 k , and the second ( ) subject to a unknown weak magnetic field, where H I (t) denotes the time-dependent interaction between the two TLSs when they are brought in contact. Additionally, we also have access to two (hot and cold) thermal baths maintained at temperatures T h and < T T c h , respectively. Using the two TLSs and the baths T h and T c allows us to construct a TTM [48,49] as follows: initially, the two TLSs  and  are isolated from each other, i.e. H I (t)=0, and in thermal equilibrium with the baths T c and T h , respectively. Their joint density operator is then the product state   On this initial configuration of the system we employ the following strokes (see figure 1): 1. Unitary Stroke ( U ): in this stroke, the TLSs are decoupled from the baths and the interaction H I (t) is switched on at time t=0. Consequently, the two TLSs undergo a unitary evolution generated by the Hamiltonian (1) for a duration τ U . Thus, the final state of the combined system at time t=τ U depends on both H I (t) and τ U .
2. Thermalization Stroke ( T ): At time t=τ U the interaction H I (t) is switched off and each TLS is again coupled to its respective thermal bath, i.e. the bath with which it was initially in equilibrium before the stroke  U . The TLSs are kept in contact with the baths for a time τ T which is chosen to be large enough to allow the TLSs to thermalize back to their respective Gibbs states (3), i.e. the combined system returns to its initial configuration(2) and the next iteration of the cycle can start. We emphasize that heat exchanges between the TLSs and the baths only occur during this second stroke  T .
Let Q h and Q c denote the heat extracted from the baths T h and T c , respectively, during the stroke  T . As the system returns to its initial configuration after the full cycle, energy is conserved and the net work performed is therefore Depending on the sign of Q h , Q c and W, TTMs may depict four distinct regimes of operation [53,54], As we will see later, the TTMs considered here, however, can only operate in the first three of the above regimes. These regimes can be changed by appropriately tuning the known strong magnetic field, i.e. tuning the Hamiltonian H k of the TLS . Importantly, at the transition point between the engine and refrigerator operation modes, the work done as well as the heat exchanged between the system and the baths vanish, i.e.
. This is achieved when the excited state populations of the two TLSs (equation (3)) coincide at the start of the cycle, i.e. n un =n k . It is easy to see that this is satisfied if where w k * denotes the energy eigenvalue of  at the transition point. In our protocol we repeat the cycle for different values of w k (i.e. different strong magnetic fields), measure the energies Q h , Q c and W, and identify the w k * at which the latter vanish; w un is then subsequently determined by equation (5).
To motivate the use of our protocol we consider the relative error w w D un un . Since each of the quantities on the rhs of equation (5) can be measured independently, the root mean square (rms) error w D un in measuring w un can be obtained from the rms error propagation law such that the relative error is where Δx denotes the rms error in measuring the quantity x. This treatment requires w un to be unimodal (see appendix A). We now assume that we model the setup using thermal baths whose temperatures are known to a high degree of accuracy. This should be possible in light of the recent developments in high-precision lowtemperature thermometry which have enabled experimentalists to measure temperatures as low as 6 mK, with an accuracy of 0.1 mK [55]. Furthermore, the relative error bound of thermometry decreases as  1 T for  T being the number of temperature measurements [5]. Consequently, one can always expect to know the bath temperatures with negligibly small relative error (i.e. ) by considering large enough , such that equations (5) and (7) yield On a related note, recent experiments on microscopic heat machines have modeled baths using electric-field noise [3,56]. Note that determining w k * involves two kinds of measurements. A first measurement is required to identify the transition point via the (vanishing) quantities Q h , Q c and W followed by a direct measurement of w k * once the transition point is reached. Each of these measurements can be carried out independently such that the rms error w D k * evaluates to Here, the first term w D ¢ k is the error in directly measuring w k . While this error stems from the experimental apparatus used for measuring w k , the remaining terms in equation (9) arise from the respective errors in measuring the energy currents Q i . Therefore, we can equate w D ¢ k with the error that one would have obtained if the TLS  was also measured directly, i.e. without using our protocol. Substituting w w D ¢ » D ¢ k u n and plugging equation (9) in equation (8) and dividing by w un , we obtain We now further assume that The first requirement for this assumption to hold true is that the coefficients α i should not diverge to a large value. As we will show later, for our TTM ( ) a~ 1 i such that this requirement is met. Secondly, the measurement of Q i must be precise enough such that the error ΔQ i is sufficiently small. The advantage of our proposed protocol is that one only needs to look for a signreversal in the quantity Q i , which in general can be more precise than measuring the absolute value of the quantity Q i . Therefore, we emphasize here that even though any of the quantities Q h , Q c or W can be measured to identify w k *, the most favorable choice is to measure the quantity that undergoes a sign reversal. In our case, as we will demonstrate later, the sign reversal is guaranteed in Q h and Q c but not in W. However, we note that the accurate and precise measurement of heat exchanges remains a highly challenging task under currently available experimental resources. Nevertheless, one can resort to obtaining Q h using indirect ways that are in general much more precise than direct heat measurements; for example, by measuring the magnetization or, equivalently, the state of the TLS  (see section 5). Hence, we focus on the regime where the second term on the rhs of equation (10) is not only small but can also be neglected under appropriate experimental conditions. Consequently, the error reduces to This equation reveals the important result that any error arising in the direct measurement of w un (or equivalently the error in measuring w k ) is scaled down by a factor of T T c h and therefore can be reduced if T h is chosen sufficiently large. Our technique is therefore reminiscent of the Wheatstone bridge setup where the error in measuring small electrical resistances can be significantly reduced through an indirect measurement of a higher resistance. A similar technique of using a quantum thermal machine as a thermometer is also presented in [46]. Further, such enhancements in precision using the Wheatstone bridge principle have also been demonstrated in a number of other measurement devices, e.g. for enhancing sensitivity of thermal conductivity measurements of nanostructures [57]. In what follows, we illustrate this point in more detail by considering two particular examples of H I (t), i.e. two protocols realizing the TTM in figure 1.
3. Two-stroke thermal machines as quantum probes 3.1. Swap TTM We first consider an interaction H I (t) that swaps the states of  and  at the end of the unitary stroke  U , such that the total density operator remains a product state [47,[58][59][60]. This protocol realizes the swap TTM and at the end of stroke  U the states of the two TLSs read After the thermalization stroke  T the system returns to its initial configuration(2) We recall here that the TLS  is isolated from  and kept in contact with bath T c during the stroke  T . The heat Q c extracted from the bath T c therefore equals the change in the internal energy of  such that, using equation (4), the performed work is From equations (14), it follows that Two possible modes of operation are now possible: for and < W 0-the TTM hence works as a quantum heat engine. On the other hand, if and > W 0, which corresponds to an accelerator where work is performed to amplify the transfer of heat from the hot to the cold bath. Thus, if one starts from a high w k ( w > k *) and progressively lowers its value, a transition from QR to QHE occurs at w k *, followed by a transition to the accelerator regime. On a related note, the above QHE-QR transition has also been shown in four-stroke [61] and continuous thermal machines [50,54,62]. Note that, while Q h and Q c reverse their sign only at the first transition (QR-QHE), W undergoes sign reversal at the QHE-accelerator transition as well. Therefore, Q h and Q c are the proper quantities of measurement for detecting the QHE-QR transition in our protocol.
Having established the existence of a transition point for the swap TTM, we now proceed to make an estimate of the error in estimating w un . The coefficients a h and a c defined in equation (9)  As explained above, measuring any one of the quantities Q h or Q c is sufficient to identify the transition point. Further, equation (17b) reveals that a a > c h , and therefore we conclude that Q h is the preferred quantity of measurement for detecting the transition point since w k is less sensitive to experimental errors in measuring Q h as compared to Q c . We will show later that the quantity a h is closely related to the QFI for a TLS initialized in thermal equilibrium with a bath.

Mix TTM
We now study another TTM, henceforth referred to as mix TTM , with a more generic interaction H I (t) than the swapping operation considered in section 3.1 and in which the existence of a transition point is not a priori apparent. Contrary to the swap TTM, in the mix TTM the unitary stroke  U may generate an entangled state of  and  .
We choose the interaction to be of the form where f (t) encodes the time dependence and w I is the characteristic interaction energy scale. Contrary to the swap TTM from section 3.1, only a partial swap of the TLSs population occurs at the end of the stroke  U and the combined system remains in an entangled state. As shown in appendix B, the heat exchanges can be evaluated as One can in principle derive an exact analytical expression for equation (19) to investigate the presence of a transition point. However, we argue that the heat exchanged and the work done are guaranteed to vanish at n k =n un due to the particular form of H I (t) that we choose for this TTM. To elaborate, we rewrite H I (t) from equation (18) as k un } is the eigenbasis of ( ) s z k un . The unitary evolution of ( ) r 0 tot under the action of the above H I (t) during the unitary stroke  U therefore only rotates the projection of ( ) r 0 tot on the subspace spanned by the states | |  ñ  ñ k u n and | |  ñ  ñ k u n . For an arbitrary (non-zero) rotation of θ on this subspace, the heat exchanged and the work done can be expressed (see appendix C) as Similarly to section 3.1, one can accordingly categorize the three regimes of operation (engine, refrigerator and accelerator). In particular, a QHE-QR transition occurring at n k =n un is found as the point where all energy currents vanish (see figure 2(b)). Further, since W reverses sign at both the QR-QHE and QHE-accelerator transitions, we look for a sign reversal in either Q h or Q c to detect the former transition which is the relevant one for our protocol. Note that for q p = 2 the energy currents (14) of the swap TTM are recovered.
Note that while any interaction of the form(18) guarantees the vanishing of the energy currents at n k =n un , only a judicious choice of the time dependence f (t) eliminates any dependence of Q h(c) on the duration τ U of the unitary stroke  U . In figure 2(a), we show that for an exponentially-decaying interaction, i.e. ( ) =f t e at with a>0, the heats exchanged with the baths ( ) . This suggests that one does not need to maintain the same τ U while performing repeated measurements as long as While the duration τ U of the stroke  U has to be much greater than the timescale of the interaction between the two TLSs, the duration τ T of the stroke  T , on the other hand, needs to be sufficiently larger than the thermalization timescale τ th on which the TLS thermalize to their respective Gibbs states. The latter is determined by , where λ i are the eigenvalues of the propagator for the stroke  T and the decay rate γ is proportional to the square of the coupling strength between . The right panel also shows the equivalence of the heat exchanges calculated using equation (19)  the TLSs and the bath [63]. For the purpose of simplicity, we have here assumed equal γ for both TLSs (see appendix D). As we will show later in section 4, for our protocol to work efficiently the ratio w T un c should be close to unity (≈1.2). Consequently, we have t g µth 1 . However, note that while one may be tempted to choose a high value of γ to have a small τ th , in case of the thermalising strokes being described by Markovian dynamics, the secular approximation [63] requires τ th to be much larger than the intrinsic timescale of the TLSs, which in our case is of the order of ( ) w 1 2 un . The necessary condition, under secular approximation, is therefore ( )  t w 1 2 T u n , which means that estimating very low magnetic fields requires longer cycle times. However, the magnetometry protocol proposed here can be expected to be beneficial as long as the engine-to-refrigerator transition (or vice-versa), i.e. vanishing Q h , Q c and W, occurs under the condition (5). Furthermore, the values of Q h , Q c , and hence W, depend on only the initial and final states of the two strokes, rather than on the details of the strokes. Consequently, the constraints on the timescales may be relaxed for non-unitary strokes which do not rely on secular approximation.
Using equation (19), the coefficients a c and a h in equation (9) for the error w D k * evaluate to  J z (s) being the Bessel function of first kind. Note that F 1 (x) already appeared in equation (17a) for the swap TTM and, as we will show later, is related to the QFI. Figure 3 shows that in the limit  w w a un k * , 1/F 2 attains a minimum value of unity at ( ) w p = + a n 2 1 4 I , where n is a positive integer. Therefore, the minimum value of α h for the mix TTM matches its counterpart(17a) for the swap TTM. Note that the additional factor F 2 (x) is an artefact stemming from the fact that in contrast to the swap TTM the excited state population of the TLSs are not completely interchanged in the mix TTM.
It is interesting to note that the transition point discussed in the manuscript is actually the Carnot point at which the TTMs achieve reversibility. It can be shown that at the transition point the unitary stroke effectively becomes an identity transformation of the system density matrix, which may be considered an adiabatic transformation. Similarly, the system remains in thermal equilibrium with the baths during the thermalization stroke and hence the latter may be seen as an isothermal process. Therefore, the two stroke cycle becomes reversible at the transition point. When working as an engine, the efficiency | | h = W Q h of the discussed TTMs evaluates to Using equation (5), one can check that the efficiency converges towards the Carnot efficiency as the transition point is approached This behavior has also been previously reported for the Otto cycle [61] and continuous thermal machines [42,50].

Minimal achievable relative error
We now address the relative error in measuring w un using the two TTMs discussed above. We reiterate that we only measure Q h for determining the transition point. Equation (10) then yields * for the mix TTM; note that the latter can be minimized to unity (see figure 3). Even though the proposed protocol would allow us to measure w un as long as equation (5) holds, however, the magnetic field estimation would be most accurate in the limit Our protocol therefore requires a precise detection (zero measurement) of Q h at the transition point, which can, for example, be done through a measurement of the state of the qubit , as discussed in section 5 below.
It is interesting to note that the quantityā h is intricately connected to the QFI corresponding to a TLS initialized in thermal equilibrium with a bath. To elucidate this connection, we recall that the quantum version of the Cramer-Rao bound dictates that the minimal achievable relative error is bounded by the inequality [5, 33]  1 is the fidelity between the states ρ 1 and ρ 2 [5]. The QFI for the TLS  prepared in thermal equilibrium with the bath T c assumes the simple form (see The above inequality leads us to conclude the following: the relative error in the measurement of w un has the theoretical lower bound(31) for any protocol that requires the TLS  to be initialized in thermal equilibrium with a bath at temperature T c . Since the quantum Cramer-Rao bound has a geometric origin in the density matrix space, its value can only be lowered by choosing optimum values of parameters that characterize the density matrix of the system. Given a TLS with a certain unknown w un , the only free parameter that characterizes the state ρ un (0) is the bath temperature T c . The optimization condition therefore, as can be seen from equation (34), corresponds to choosing the bath temperature T c such that the quantityā h is minimized. It is intriguing to recall here that we encountered the same minimization requirement in our protocol through equation (29), provided the temperature of the baths are accurately known.

Indirect measurement of the heat Q h exchanged with the hot bath
The experimental challenge in implementing our proposed protocol lies in the accurate and precise measurement of the heat exchange Q h , which is a difficult task under presently available experimental resources. As such, an alternative way to implement our proposed method would be to measure Q h indirectly through a state measurement of the known TLS  on either end of the thermalization stroke  ; T which can be done through various standard techniques, including motional sideband spectroscopy [64] and photoluminescence [65,66]. In other words, we measure the excited state population of  before the stroke, which we denote as ¢ n k . The excited state population after thermalization (n k ) is directly inferred from the temperature T h and w k using equation (3). Q h is then easily calculated from the measured values of n k and ¢ n k (see appendix C). The error in Q h therefore solely arises from the measurement of the excited state population of the known TLS . To estimate the minimum error bound, we calculate the QFI of the state of  prior to thermalization with the excited state population ¢ n k as the parameter to be estimated (see appendix E)

Discussion
We propose a protocol for measuring a weak magnetic field by using a two-stroke thermal machine (TTM) magnetometer, modelled by a TLS whose energy spectrum depends on the unknown field coupled to a second TLS with known and tunable energy eigenvalues, and driving the combined system in a closed cycle between two thermal baths. We specifically studied two different types of interactions between the TLSs, one that leads to a swapping of the TLSs populations without any entanglement generation (swap TTM, section 3.1) and a second that generates an entangled state after the unitary stroke (mix TTM, section 3.2). However, as shown in appendix B, the entanglement produced in the mix TTM does not affect the effectiveness of our protocol.
Our method uses the presence of a transition point at which the thermal machine switches operation mode from a quantum heat engine to a quantum refrigerator. The transition is detected through a sign reversal in the heat Q h extracted from the hot bath which makes it possible to detect the transition point more precisely than absolute value measurements. Our main result is that, under reasonable conditions, our protocol is capable of reducing the relative error in measuring the unknown energy gap w 2 un by a factor of T T c h . Through explicit calculation of the possible sources of error, we further showed that the protocol is most effective when for a rough estimate of w un the the temperature T c of the cold bath is chosen such that w » T 1.2 un c . This optimum ratio is a requirement in both considered TTMs and stems from the minimization of the theoretical lower bound of the relative error set by the quantum Cramer-Rao inequality. Furthermore, we emphasize that a major advantage of the proposed protocol is the possibility of accurately estimating a weak magnetic field acting on the qubit  by probing the auxiliary qubit . This scheme of indirectly measuring a weak magnetic field can be highly beneficial in scenarios where existing constraints may prevent us from measuring the magnetic field directly, without affecting the value of the field.
A possible application of our protocol is nanometer-scale high-resolution magnetometry where the two TLSs could be implemented by two non-interacting ions or atoms, possibly of two different species, trapped in a single well of an optical lattice. Alternatively, the TLSs can be modelled by superconducting qubits [67][68][69]. These systems can be extremely well controlled experimentally [70,71] and have been used in recent experimental implementations of quantum heat engines [3,72]. An alternative route may be spin systems based on nuclear-magnetic resonances or nitrogen-vacancy setups as in the QHE experiments from [73,74]. For future work we envisage to adapt our protocol to autonomous quantum heat engines that do not require external control. A prime example may be the three-level maser coupled to a single cavity-field mode [75]. The engine transition then corresponds to the lasing threshold and instead of measuring energy currents one could base the magnetometry scheme on the measurement of the photon bunching parameter [76,77]. The change in work capacity or ergotropy [78-80] of a quantum system (quantum battery) [81,82], for example a quantum harmonic oscillator, coupled to the thermal machine, is then an indication for work output of the machine [77,83,84]. One could then consider estimating the weak magnetic field through measurement of the zero of the work output, by measuring the change in ergotropy of the quantum battery. Such autonomous magnetometers based on microscopic thermal machines might enable us to perform high-precision magnetometry in biological systems at the sub-cellular level [85]. As an estimate, a cold bath withT c mK, for example realized using laser cooling [86], a hot bath at room temperature withT 10 h 2 K and a strong known magnetic field ∼100 Gs, which for example can be realized using a small bar magnet, would allow us to estimate weak magnetic fields of the order of -10 3 Gs (see equation (5)).

Acknowledgments
SB, UB and AD acknowledge Souvik Bandyopadhyay and Somnath Maity for comments. SB acknowledges CSIR, India for financial support. WN acknowledges support from an ESQ fellowship of the Austrian Academy of Sciences (ÖAW). AD acknowledges SPARC program, MHRD, India for financial support.

Appendix A. Unimodality of the unknown energy gap
The error analysis in equation (6) requires w un to be unimodal. From equation ( where ( ) w P k k * denotes the distribution of w k *, ( ) P T h h the distribution of T h and ( ) P T c c the distribution of T c , respectively. The rationale behind equation (A2) is that these three quantities can be measured independently and are therefore stochastically independent. Further, the probability distributions themselves can be considered to be Gaussian in the limit of large number of repeated and uncorrelated measurements performed for each of the quantity.
We have checked numerically for a variety of Gaussian distributions of w k *, T c and T h that the resulting distribution(A2) is indeed unimodal, i.e. exhibits a single peak in y. Using equations (4), (19) and (20), one can therefore obtain