Collapse Operators (Open Systems)#
Physics: Compile a Hamiltonian with Lindblad collapse operators for open-system dissipation.
The Model
In realistic quantum systems, dissipation and decoherence occur due to coupling with the environment. The Lindblad master equation describes the evolution:
where:
\(H(t)\) is the system Hamiltonian
\(c_i(t)\) are the collapse operators (Lindblad operators) describing dissipation channels
Common examples: \(c = \sqrt{\kappa} a\) (photon loss), \(c = \sqrt{\gamma} \sigma_-\) (qubit decay)
Example: Damped Rabi oscillations
where \(\gamma\) is the decay rate and \(\gamma_\phi\) is the dephasing rate.
What you’ll learn
How to write collapse operators in LaTeX using \(\sqrt{\text{rate}} \times \text{operator}\) notation
How the parser compiles them into the backend’s format
How to use them with QuTiP’s
mesolvefor open-system simulations
Code
1# flake8: noqa
2"""
3Open-system example: static Hamiltonian with collapse operators.
4
5What this shows:
6- Adding collapse operators via LaTeX strings (`c_ops_latex`).
7- Reusing the same parameter dict for Hamiltonian and collapse channels.
8- Inspecting compiled `H`, `c_ops`, and `args` from the QuTiP backend.
9"""
10
11from __future__ import annotations
12
13import sys
14from pathlib import Path
15
16ROOT = Path(__file__).resolve().parents[1]
17if str(ROOT) not in sys.path:
18 sys.path.insert(0, str(ROOT))
19
20from latex_parser.latex_api import compile_model as compile_latex_model
21
22
23def main() -> None:
24 H_latex = r"\frac{\omega_0}{2} \sigma_{z,1}"
25 c_ops = [r"\sqrt{\gamma} \sigma_{-,1}"]
26 params = {"omega_0": 1.0, "gamma": 0.2}
27 model = compile_latex_model(
28 H_latex=H_latex,
29 params=params,
30 c_ops_latex=c_ops,
31 qubits=1,
32 t_name="t",
33 )
34 print("H (static):", model.H)
35 print("c_ops:", model.c_ops)
36 print("args:", model.args)
37
38
39if __name__ == "__main__":
40 main()
Run it
python examples/example_collapse_ops.py
What happens
Each collapse operator string is parsed independently
Static operators become
QobjinstancesTime-dependent operators (e.g., \(\sqrt{\gamma(t)} \sigma_-\)) become tuples
[operator, envelope_function]The model returns
model.c_opsas a list ready formesolve
Example Output
Hamiltonian (static + time-dependent):
[H0, [H1, f_envelope]]
Collapse operators:
[Qobj(decay), Qobj(dephasing)]
# Use with mesolve:
result = mesolve(model.H, psi0, times, c_ops=model.c_ops, args=model.args)
Full Simulation Example
from qutip import mesolve, basis, expect, sigmaz
import numpy as np
# Compile the model
# ... model = compile_model(...)
# Initial state
psi0 = basis(2, 0) # Ground state
# Time evolution
times = np.linspace(0, 10, 100)
# Open-system evolution with dissipation
result = mesolve(
model.H,
psi0,
times,
c_ops=model.c_ops,
e_ops=[sigmaz()],
args=model.args
)
# Plot the decay of excited state population
import matplotlib.pyplot as plt
plt.plot(times, result.expect[0])
plt.xlabel('Time')
plt.ylabel('⟨σ_z⟩')
plt.title('Rabi oscillations with decay')
plt.show()
Try this
Remove the dephasing operator and re-run to see faster oscillations
Increase the decay rate \(\gamma\) to see damping accelerate
Add time-dependent decay: \(c = \sqrt{\gamma(t)} \sigma_-\) with \(\gamma(t) = \gamma_0 \exp(-t/\tau)\) (turn-on dissipation)
Important Notes
Static collapse operators work with all backends (QuTiP, NumPy, JAX)
Time-dependent collapse operators are QuTiP-only (due to
mesolveconstraints)Each static collapse operator reduces by one order on the total state (density matrix formalism)
For efficient simulation, keep the number of collapse operators small
Next steps
See Bosonic Number Example for bosonic systems with photon loss
Check JAX Autodiff Workflow for optimizing dissipation rates via autodiff