Open Systems & the Lindblad Equation
Real devices leak energy and lose coherence. Add collapse_operators to an
evolve call and the solver integrates the Lindblad master equation instead of the
closed-system Schrödinger equation.
From Schrödinger to Lindblad
Each collapse (jump) operator L contributes a dissipator L ρ L† − ½{L†L, ρ} to dρ/dt. The state is now a density matrix, so pass one as the initial state.
import qalgora
from qalgora import operators, Schedule
import numpy as np
H = 2.0 * np.pi * 0.1 * operators.spin.z(0)
gamma = 0.05 # decay rate
psi0 = np.array([1.0, 0.0], dtype=complex)
rho0 = np.outer(psi0, psi0.conj()) # density matrix initial state
result = qalgora.evolve(
H, dimensions={0: 2},
schedule=Schedule(steps=np.linspace(0, 20, 200), parameters=["t"]),
initial_state=qalgora.State.from_data(rho0),
collapse_operators=[np.sqrt(gamma) * operators.spin.minus(0)], # spontaneous emission
observables=[operators.spin.z(0)],
)
Common decoherence channels
| Process | Collapse operator |
|---|---|
| Spontaneous emission (T1) | sqrt(gamma) * spin.minus(q) |
| Pure dephasing (T2) | sqrt(gamma_phi/2) * spin.z(q) |
| Cavity photon loss (κ) | sqrt(kappa) * boson.annihilate(m) |
| Thermal excitation | sqrt(gamma * n_th) * boson.create(m) |
Operator convention
operators.spin.x/y/z are the Pauli matrices σ, not S = σ/2. Under this
σz convention the pure-dephasing collapse operator
sqrt(gamma_phi/2) * spin.z(q) is correct — the factor of ½ inside the square root
reproduces the standard T2 dephasing rate, so the coefficient is left as written.
Cavity photon loss
Boson operators on a multi-level mode let you model a leaking resonator. Declare the mode's
truncation in dimensions.
kappa = 0.1
a = operators.boson.annihilate(0)
H = operators.boson.create(0) * a # cavity number Hamiltonian
psi1 = np.zeros(10, dtype=complex); psi1[1] = 1.0 # Fock state |1>
rho_fock = np.outer(psi1, psi1.conj()) # density matrix initial state
result = qalgora.evolve(
H, dimensions={0: 10}, # truncate the cavity at 10 photons
schedule=Schedule(steps=np.linspace(0, 30, 300), parameters=["t"]),
initial_state=qalgora.State.from_data(rho_fock),
collapse_operators=[np.sqrt(kappa) * a],
observables=[operators.boson.create(0) * a], # mean photon number vs time
)
Need a non-Lindblad equation?
Collapse operators cover the standard Markovian master equation. For correlated noise or any
custom equation of motion, assemble it term by term with
generic super-operators.
开放系统与 Lindblad 方程
真实器件既会漏失能量,也会失去相干性。只要在 evolve 调用里加上 collapse_operators,求解器就会改为积分 Lindblad 主方程,而不再是封闭系统的薛定谔方程。
从薛定谔到 Lindblad
每个坍缩(跳跃)算符 L 都向 dρ/dt 贡献一项耗散项 L ρ L† − ½{L†L, ρ}。这时系统态是密度矩阵,所以初始态也要传一个密度矩阵。
import qalgora
from qalgora import operators, Schedule
import numpy as np
H = 2.0 * np.pi * 0.1 * operators.spin.z(0)
gamma = 0.05 # 衰减率
psi0 = np.array([1.0, 0.0], dtype=complex)
rho0 = np.outer(psi0, psi0.conj()) # 密度矩阵初态
result = qalgora.evolve(
H, dimensions={0: 2},
schedule=Schedule(steps=np.linspace(0, 20, 200), parameters=["t"]),
initial_state=qalgora.State.from_data(rho0),
collapse_operators=[np.sqrt(gamma) * operators.spin.minus(0)], # 自发辐射
observables=[operators.spin.z(0)],
)
常见退相干通道
| 过程 | 坍缩算符 |
|---|---|
| 自发辐射 T1 | sqrt(gamma) * spin.minus(q) |
| 纯退相 T2 | sqrt(gamma_phi/2) * spin.z(q) |
| 腔光子损耗 κ | sqrt(kappa) * boson.annihilate(m) |
| 热激发 | sqrt(gamma * n_th) * boson.create(m) |
算符约定
operators.spin.x/y/z 表示 Pauli 矩阵 σ,而非 S = σ/2。在该 σz 约定下,纯退相坍缩算符 sqrt(gamma_phi/2) * spin.z(q) 是正确的——平方根内的 ½ 因子复现标准的 T2 退相速率,因此系数保持原样不变。
腔光子损耗
用多能级模上的玻色算符就能刻画一个有损耗的腔,在 dimensions 里声明该模的截断维数即可。
kappa = 0.1
a = operators.boson.annihilate(0)
H = operators.boson.create(0) * a # 腔光子数哈密顿量
psi1 = np.zeros(10, dtype=complex); psi1[1] = 1.0 # 福克态 |1>
rho_fock = np.outer(psi1, psi1.conj()) # 密度矩阵初态
result = qalgora.evolve(
H, dimensions={0: 10}, # 把腔截断在 10 个光子
schedule=Schedule(steps=np.linspace(0, 30, 300), parameters=["t"]),
initial_state=qalgora.State.from_data(rho_fock),
collapse_operators=[np.sqrt(kappa) * a],
observables=[operators.boson.create(0) * a], # 平均光子数随时间
)
需要非 Lindblad 方程
坍缩算符只能覆盖标准的马尔可夫主方程。若要刻画关联噪声,或写出任意形式的运动方程,请改用通用超算符逐项搭建。