Cavity QED: the Jaynes-Cummings Model
Simulate a two-level atom coupled to a single photonic cavity mode — the canonical test case for qalgora-Q dynamics with mixed qubit-boson systems.
Degree-of-freedom convention
By convention degree of freedom 0 is the two-level atom and degree of freedom 1 is the cavity
mode, hence dimensions={0: 2, 1: 10} (a 2-level atom and a 10-level Fock truncation
of the cavity).
Building the Hamiltonian
import qalgora
from qalgora import operators
import numpy as np
wc, wa, g = 1.0, 1.0, 0.05 # cavity, atom, coupling
a = operators.boson.annihilate(1) # cavity mode (dim 10)
sm = operators.spin.minus(0) # atom lowering
H = (wc * operators.boson.create(1) * a
+ 0.5 * wa * operators.spin.z(0)
+ g * (operators.boson.create(1) * sm + a * operators.spin.plus(0)))
Evolving and watching Rabi oscillations
The initial state excited_atom_empty_cavity is the product of an excited atom and a
cavity in its vacuum (Fock) state — supply your own state object here (illustrative fragment).
# excited_atom_empty_cavity: atom in |1>, cavity in |0> (construct from your state API)
result = qalgora.evolve(
H, dimensions={0: 2, 1: 10},
schedule=qalgora.Schedule(steps=np.linspace(0, 100, 400), parameters=["t"]),
initial_state=excited_atom_empty_cavity,
observables=[operators.spin.z(0)],
)
# the atomic inversion oscillates as energy swaps with the cavity
腔量子电动力学:Jaynes-Cummings 模型
模拟二能级原子与单光子腔模式的耦合——这是 qalgora-Q 动力学在量子比特-玻色子混合系统中的典型测试场景。
自由度约定
约定自由度 0 是二能级原子,自由度 1 是腔模,故 dimensions={0: 2, 1: 10}(二能级原子,腔模取 10 维 Fock 截断)。
构建哈密顿量
import qalgora
from qalgora import operators
import numpy as np
wc, wa, g = 1.0, 1.0, 0.05 # cavity, atom, coupling
a = operators.boson.annihilate(1) # cavity mode (dim 10)
sm = operators.spin.minus(0) # atom lowering
H = (wc * operators.boson.create(1) * a
+ 0.5 * wa * operators.spin.z(0)
+ g * (operators.boson.create(1) * sm + a * operators.spin.plus(0)))
演化与拉比振荡观测
初态 excited_atom_empty_cavity 即激发态原子与真空(Fock 基态)腔模的直积——此处为示例片段,需自行构造对应的态对象。
# excited_atom_empty_cavity 原子处于 |1> 腔处于 |0>(用你的态 API 构造)
result = qalgora.evolve(
H, dimensions={0: 2, 1: 10},
schedule=qalgora.Schedule(steps=np.linspace(0, 100, 400), parameters=["t"]),
initial_state=excited_atom_empty_cavity,
observables=[operators.spin.z(0)],
)
# 原子布居随能量在腔与原子间交换而振荡