---
title: "Two-Level Quantum Otto Engine Interactive Lab | Sandbox Physics"
description: "Can one spin turn heat into work? It can, in a quantum Otto cycle."
canonical_url: "https://sandboxphysics.com/labs/quantum-otto-engine/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/quantum-otto-engine/"
last_modified: "2026-10-27"
---

Q050 · A heat engine made of one spin

# Two-Level Quantum Otto Engine

**Can one spin turn heat into work?** It can, in a quantum Otto cycle. Work is done while the energy gap of the spin changes; heat flows while the gap is fixed and the spin touches a bath. Between a hot and a cold bath, the net work over a full cycle can be positive. Energy still balances: the work out equals the heat taken from the hot bath minus the heat given to the cold one.

Widen the spin's energy gap, heat it, narrow the gap again and cool it. Follow each stroke and track how work and heat change the spin's energy.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

The working medium is a two-level system whose energy is measured at the end of every stroke. Contact with a bath relaxes it ideally toward the Gibbs state, and the gap and field axis change by unitary ramps. Energies, temperatures and times are in reference units. The energy measurements between strokes erase any coherence carried from one stroke to the next. The apparatus is a sketch, not a calibrated NMR setup, and the costs of control and readout are left out.

02 / Follow the four strokes

## Change the gap, then change the occupation.

Excited population versus gap · model $\epsilon/\epsilon_0$

Drag near a stroke to inspect it. This is not a pressure-volume plot. When the drive also rotates the field, the loop area alone does not give the work. The energy table below is built from the energy changes at each stroke boundary.

$\text{—}$

Circles show probability weight, not multiple particles. The gap is drawn on a fixed scale across the cycle.

03 / Add up the work and heat

Model reference

Per cycle Records · mean ± one SE Model

Work delivered $\text{—}$ $\text{—}$

Heat from hot bath $\text{—}$ $\text{—}$

Heat from cold bath $\text{—}$ $\text{—}$

Internal energy change $\text{—}$ $\text{—}$

All energies use the reference gap. Heat into the spin and work out are positive. Each trial starts independently in the stationary boundary mixture; five measured energy-state bits determine its entire ledger.

$\text{—}$

04 / Measure the fluctuations

## A single cycle can run against the average.

Recorded work distribution $W_{\rm out}/\epsilon_0$

Stationary model · not a fit

$\text{—}$ $\text{—}$ $\text{—}$

Efficiency is shown only in engine mode; cooling performance only in refrigerator mode. Sampled heat close to zero makes an efficiency ratio unstable, so sampled heat and work remain separate.

05 / Save the evidence

## Save a sample, change one thing, then compare

Eight saved samples maximum. Saving freezes a run; new acquisition starts another. Export includes all raw records and preparation settings. Reusing a seed reproduces draws, so repeated copies are not independent evidence.

Model, units & sources

$$
\Delta U=Q_h+Q_c-W_{\rm out},\qquad \epsilon_c=\epsilon_0
$$

Energies use the low gap, temperatures use that energy divided by Boltzmann’s constant, and times use reduced Planck’s constant divided by that energy. The population relaxation rate in both baths is one inverse reference time. Gaps vary linearly; the field axis rotates linearly in one plane. Midpoint unitary steps preserve state length; numerical convergence is checked separately.

Projective energy readings at stroke boundaries remove inter-stroke coherence without changing mean energy. Baths are ideal Markov contacts with Gibbs detailed balance. Every sampled cycle starts independently in the stationary measured mixture. Bath generation, electronics, measurement memory and preparation costs are omitted; displayed power counts stroke durations only.

With both contacts closed and no drive-induced transitions, the stationary mixture is not unique; the cold Gibbs mixture is the declared convention. This model is inspired by spin heat engines, not a numerical reproduction of the cited NMR experiment.

[Peterson et al. · Experimental characterization of a spin quantum heat engine](https://arxiv.org/abs/1803.06021)

Physics tutorial

## Two-Level Quantum Otto Engine

**Background** Widen the spin's energy gap, heat it, narrow the gap again and cool it. Follow each stroke and track how work and heat change the spin's energy.

**Why it matters** Compare individual measured cycles with what the ensemble model predicts.

Start with the essentials

- **Focus question**: Can one spin turn heat into work?
- **One-sentence intuition**: Change one setting at a time, keep a saved run for comparison, and recompute the results from the raw data.

### Core mathematical model

#### Controlled Hamiltonian

$$
H(t)=\tfrac{\epsilon(t)}2[ I+\mathbf n(t)\cdot\boldsymbol\sigma]
$$

The two energy levels sit at zero and at the gap set by the controls. During the two strokes isolated from the baths, the field axis also turns within one plane.

#### Relaxation in contact with a bath

$$
p_e(t)=p_\beta+[p_e(0)-p_\beta]e^{-\gamma t},\quad p_\beta=\frac1{1+e^{\epsilon/(k_BT)}}
$$

The population relaxes as a Markov process that obeys Gibbs detailed balance. In the Lab's time units the relaxation rate is one.

#### First law

$$
\Delta U=Q_h+Q_c-W_{\rm out}
$$

Heat flowing into the spin and work done by the spin count as positive. A single cycle need not end in the same measured state it started in.

#### Otto efficiency without transitions

$$
\eta_{\rm Otto}=1-\frac{\epsilon_c}{\epsilon_h},\quad 1<\frac{\epsilon_h}{\epsilon_c}<\frac{T_h}{T_c}
$$

When the drive causes no transitions, the engine produces work only while the gap ratio satisfies this inequality. Fast ramps that do not commute with themselves at different times can reduce the output.

#### Entropy production

$$
\Sigma=-\frac{Q_h}{T_h}-\frac{Q_c}{T_c}\geq0
$$

This holds for the average heat over a stationary measured cycle. Single cycles fluctuate, and the inequality does not fix the sign for each one.

### Common difficulties

#### Can one cycle beat the efficiency limit?

**Typical misconception** A lucky cycle can beat the thermodynamic limit.

**Better mental model** Efficiency is defined with the average heat and work of the stationary ensemble. When the sampled heat is close to zero, their ratio swings wildly, so the page reports sampled work and heat separately.

#### Does the output include every cost?

**Typical misconception** The work output already accounts for every engineering cost.

**Better mental model** The model covers only the working medium. It leaves out the cost of preparing the baths, running the control electronics, measuring and resetting.

### Run the experiment

1. 01

   #### Follow the cycle

   Scrub through the four strokes and find where the energy changes by work and where it changes by heat.

   **What to observe:** The horizontal axis of the diagram is the energy gap, not volume.

2. 02

   #### Count energy changes

   Record 500 independent cycles, export the five energy readings from each cycle, and recompute the work and heat yourself.

   **What to observe:** In a finite sample the average energy change is generally not exactly zero, so keep that term in the first law.

3. 03

   #### Make the engine fail

   Speed up the drive. Then fix its axis, or choose a gap ratio larger than the temperature ratio.

   **What to observe:** A fast ramp along a fixed axis commutes with itself, so it causes no transitions and loses no output to them. A large enough gap ratio turns the device into a refrigerator.

Physical conclusion

The working medium is a two-level system whose energy is measured at the end of every stroke. Contact with a bath relaxes it ideally toward the Gibbs state, and the gap and field axis change by unitary ramps. Energies, temperatures and times are in reference units. The energy measurements between strokes erase any coherence carried from one stroke to the next. The apparatus is a sketch, not a calibrated NMR setup, and the costs of control and readout are left out.

Quantum & fields · Starter path

## Start from a single measurement

Predict an outcome, then count what the measurements actually give. The path starts with one qubit and moves on to wave packets, bound states and two-photon interference.

[Start here → **Quantum State & Born Measurement** Predict a probability, turn the analyzer, then compare your prediction with the measured frequency over many shots. Observe · 15 min](https://sandboxphysics.com/labs/qubit-state/)

1. [1 Quantum State & Born Measurement](https://sandboxphysics.com/labs/qubit-state/)
2. [2 Stern–Gerlach Sequence](https://sandboxphysics.com/labs/stern-gerlach-sequence/)
3. [3 Wave Packet & Uncertainty](https://sandboxphysics.com/labs/wave-packet-uncertainty/)
4. [4 Quantum Harmonic Oscillator](https://sandboxphysics.com/labs/quantum-harmonic-oscillator/)
5. [5 Which Path & Quantum Eraser](https://sandboxphysics.com/labs/quantum-eraser/)
6. [6 Hong–Ou–Mandel Two-Photon Interference](https://sandboxphysics.com/labs/hong-ou-mandel/)

[View the full path →](https://sandboxphysics.com/topics/quantum/#starter-path)
