From a41e0c06c4db99be90161c9163383b9f0233da41 Mon Sep 17 00:00:00 2001 From: Vanshaj0429 Date: Fri, 12 Sep 2025 16:15:10 +0100 Subject: [PATCH 1/3] Add JCM tutorial --- tutorials-v5/quantum-system/JCM_Tutorial.md | 532 ++++++++++++++++++++ 1 file changed, 532 insertions(+) create mode 100644 tutorials-v5/quantum-system/JCM_Tutorial.md diff --git a/tutorials-v5/quantum-system/JCM_Tutorial.md b/tutorials-v5/quantum-system/JCM_Tutorial.md new file mode 100644 index 00000000..ad3178df --- /dev/null +++ b/tutorials-v5/quantum-system/JCM_Tutorial.md @@ -0,0 +1,532 @@ +--- +jupyter: + jupytext: + text_representation: + extension: .md + format_name: markdown + format_version: '1.3' + jupytext_version: 1.17.0 + kernelspec: + display_name: Python 3 (ipykernel) + language: python + name: python3 +--- + +# Introduction to the Jaynes-Cummings Model: Fundamentals of Cavity QED + +Author: Vanshaj Bindal + +[NOTE: This tutorial would only work with `dev.qsystem` branch of QuTiP, until that branch is merged with the `master` branch] + +## Introduction + +The Jaynes-Cummings Model (JCM) is one of the most fundamental and important models in quantum optics and cavity quantum electrodynamics (QED). It describes the interaction between a single two-level atom and a single mode of the quantized electromagnetic field within an optical cavity. This seemingly simple system exhibits remarkably rich physics and serves as a cornerstone for understanding light-matter interactions at the quantum level. + +### Historical Context + +The model was introduced by Edwin Jaynes and Fred Cummings in 1963 as a simplified but exactly solvable model for studying the quantum mechanical interaction between atoms and electromagnetic radiation. It has since become a paradigmatic model in quantum optics, providing insights into phenomena such as Rabi oscillations, vacuum Rabi splitting, and the quantum nature of light. + +### Theoretical Background + +The Jaynes-Cummings model describes a system consisting of: + +1. **A quantized cavity mode**: Represented by creation ($a^\dagger$) and annihilation ($a$) operators +2. **A two-level atom**: Described by Pauli operators ($\sigma_x$, $\sigma_y$, $\sigma_z$) and ladder operators ($\sigma_+$, $\sigma_-$) +3. **Atom-field interaction**: Coupling between the atom and cavity field + +### Mathematical Description + +The full Hamiltonian of the Jaynes-Cummings model can be written as: + +$$H = \omega_c a^\dagger a + \frac{\omega_a}{2}\sigma_z + g(a^\dagger + a)(\sigma_+ + \sigma_-)$$ + +However, in most practical situations, we apply the **rotating wave approximation (RWA)**, which neglects rapidly oscillating terms. Under the RWA, the Hamiltonian becomes: + +$$H_{JC} = \omega_c a^\dagger a + \frac{\omega_a}{2}\sigma_z + g(a^\dagger\sigma_- + a\sigma_+)$$ + +where: +- $\omega_c$ is the cavity frequency +- $\omega_a$ is the atomic transition frequency +- $g$ is the atom-cavity coupling strength +- $a^\dagger$ and $a$ are the photon creation and annihilation operators +- $\sigma_z$ is the Pauli-Z operator for the atom +- $\sigma_+$ and $\sigma_-$ are the atomic raising and lowering operators + +### Physical Interpretation + +The Hamiltonian consists of three terms: + +1. **Cavity energy**: $\omega_c a^\dagger a$ - Energy of photons in the cavity +2. **Atomic energy**: $\frac{\omega_a}{2}\sigma_z$ - Energy of the two-level atom +3. **Interaction**: $g(a^\dagger\sigma_- + a\sigma_+)$ - Energy exchange between atom and field + +The interaction term has two components: +- $a^\dagger\sigma_-$: Atom emits a photon (atomic de-excitation + photon creation) +- $a\sigma_+$: Atom absorbs a photon (atomic excitation + photon annihilation) + +### Dissipation and Decoherence + +In realistic systems, both the cavity and atom experience losses: + +1. **Cavity decay**: Photons leak out of the cavity at rate $\kappa$ +2. **Atomic spontaneous emission**: Atom decays at rate $\gamma$ +3. **Atomic dephasing**: Pure dephasing at rate $\gamma_\phi$ +4. **Thermal effects**: Finite temperature introduces thermal photons $n_{th}$ + +These effects are modeled using Lindblad collapse operators in the master equation formalism. + +### Package Imports + +Let's start by importing the necessary libraries: + +```python +import matplotlib.pyplot as plt +import numpy as np +from qutip import ( + about, + basis, + mesolve, + tensor, + quantum_systems, + spectrum, + spectrum_correlation_fft, + correlation_2op_1t, +) + +%matplotlib inline +``` + +## Quantum System Library: Motivation and Design + +### Why Build a Quantum System Library? + +When working with quantum systems in QuTiP, researchers often find themselves writing repetitive code to construct Hamiltonians and operators. Consider the conventional approach to building a Jaynes-Cummings model, +refer to the conventional construction [here](https://nbviewer.org/urls/qutip.org/qutip-tutorials/tutorials-v5/lectures/Lecture-1-Jaynes-Cumming-model.ipynb). + + +### Solution: Factory Functions + +The quantum system library addresses these issues by providing: + +1. **Standardized factory functions** for common quantum systems +2. **Unified QuantumSystem class** that encapsulates all system components +3. **Automatic operator generation** with consistent naming +4. **Built-in dissipation modeling** with thermal effects +5. **LaTeX representations** for documentation +6. **Parameter validation** and sensible defaults + +## Using Jaynes-Cummings Factory Function + +Let's explore how quantum system library simplifies working with the Jaynes-Cummings model by discussing some few very simple but different examples: + +### Example 1: Basic Resonant System + + +The first example demonstrates the simplest case of the Jaynes-Cummings model: a resonant system where the cavity frequency and atomic transition frequency are identical ($\omega_c = \omega_a = 1.0$). This resonance condition maximizes the coupling efficiency between the atom and cavity field. We choose a moderate coupling strength ($g = 0.1$) relative to the frequencies, placing us in the weak-to-intermediate coupling regime. The cavity Fock space is truncated at 5 photon states, which is sufficient for most dynamics when starting from low-energy initial states. Notice how the `jaynes_cummings` function creates the entire system with a single line, no need to manually construct tensor products or worry about operator ordering. + +```python +# Example 1: Basic resonant system +print("\n1. Basic Resonant Jaynes-Cummings System:") +jc_basic = quantum_systems.jaynes_cummings(omega_c=1.0, omega_a=1.0, g=0.1, n_cavity=5) +jc_basic.pretty_print() +``` + +### Example 2: Detuned System with Dissipation + + +Here we explore a more realistic scenario where the atomic transition frequency is slightly higher than the cavity frequency ($\omega_a = 1.1$, $\omega_c = 1.0$), creating a detuning of $\Delta = 0.1$. Detuning reduces the effective coupling between atom and cavity, leading to modified dynamics. We also include dissipative effects that occur in real systems: cavity photons leak out at rate $\kappa = 0.01$, atoms undergo spontaneous emission at rate $\gamma = 0.005$, and experience pure dephasing at rate $\gamma_\phi = 0.002$. The thermal photon parameter ($n_{th} = 0.1$) accounts for finite temperature effects. `jaynes_cummings` function seamlessly handles all these physical complexities through the collapse operators framework. + +```python +# Example 2: Detuned system with dissipation +print("\n2. Detuned System with Dissipation:") +jc_dissipative = quantum_systems.jaynes_cummings( + omega_c=1.0, + omega_a=1.1, # 10% detuning + g=0.05, + n_cavity=8, + cavity_decay=0.01, # kappa = 0.01 + atomic_decay=0.005, # gamma = 0.005 + atomic_dephasing=0.002, # gamma_phi = 0.002 + thermal_photons=0.1, # n_th = 0.1 +) +jc_dissipative.pretty_print() +``` + +### Example 3: Rabi Model (No Rotating Wave Approximation) + + +This example showcases the flexibility of quantum system library by demonstrating the Rabi model, which includes counter-rotating terms typically neglected in the rotating wave approximation. By setting `rotating_wave=False`, we include terms like $a^\dagger\sigma_+$ and $a\sigma_-$ that don't conserve the total number of excitations. These terms become important in the ultrastrong coupling regime where $g$ approaches the cavity frequency. The resulting Hamiltonian is more complex but captures additional physics like virtual photon processes. Notice how switching between the Jaynes-Cummings and Rabi models requires changing only a single parameter. + +```python +# Example 3: Rabi model (no rotating wave approximation) +print("\n3. Rabi Model (No RWA):") +rabi = quantum_systems.jaynes_cummings( + omega_c=1.0, + omega_a=1.0, + g=0.2, + rotating_wave=False, # Include counter-rotating terms +) +rabi.pretty_print() +``` + +### Example 4: Accessing System Components + + +This example demonstrates how to access the various components of the quantum system after creation. The `QuantumSystem` class provides a unified interface to all system properties. The operators dictionary contains all relevant operators (photon creation/annihilation, atomic Pauli operators, etc.) with standardized names. The Hamiltonian dimensions tell us about the size of the Hilbert space, while the collapse operators list shows what dissipative processes are included. This systematic organization makes it easy to extract exactly what you need for calculations, whether it's for time evolution, steady-state analysis, or computing expectation values. + +```python +# Example 4: Accessing operators and Hamiltonian +print("\n4. Accessing System Components:") +jc = quantum_systems.jaynes_cummings(omega_c=1.0, omega_a=1.0, g=0.1, n_cavity=3) +print(f"Available operators: {list(jc.operators.keys())}") +print(f"Hamiltonian dimension: {jc.hamiltonian.dims}") +print(f"Number of collapse operators: {len(jc.c_ops)}") + +# Show both access methods +print(f"Direct access - operators: {type(jc.operators)}") +``` + +### Example 5: Energy Spectrum Analysis + + +Understanding the energy spectrum is crucial for predicting system behavior. This example shows how to analyze the eigenvalue structure of the Jaynes-Cummings Hamiltonian using a small system for clarity. The energy levels reveal the characteristic level structure of cavity QED: degenerate manifolds that split due to atom-cavity coupling (vacuum Rabi splitting). The ground state energy and energy gaps tell us about the fundamental excitation scales in the system. The library's built-in eigenvalue computation makes spectral analysis straightforward - the energy spectrum is immediately available as a property of the quantum system object. + +```python +# Example 5: Energy eigenvalues +print("\n5. Energy Spectrum Analysis:") +jc_small = quantum_systems.jaynes_cummings(omega_c=1.0, omega_a=1.0, g=0.1, n_cavity=3) +eigenvals = jc_small.eigenvalues + +print(f"First few eigenvalues: {eigenvals[:5]}") +print(f"Ground state energy: {eigenvals[0]:.3f}") +print(f"First excited energy: {eigenvals[1]:.3f}") +print(f"Energy gap: {eigenvals[1] - eigenvals[0]:.3f}") +``` + +## Quantum Dynamics: Rabi Oscillations + +One of the most fundamental phenomena in the Jaynes-Cummings model is Rabi oscillations, the coherent exchange of energy between the atom and cavity field. Let's explore this using the `jaynes_cummings` function. + +When an atom interacts with a cavity field, they exchange energy at the Rabi frequency. For a system initially prepared with the atom excited and no photons in the cavity, the atom will emit a photon into the cavity and then reabsorb it, leading to oscillations. + +The Rabi frequency depends on: +- The coupling strength $g$ +- The number of photons in the cavity +- The detuning between atom and cavity + +For an initially excited atom and empty cavity, the Rabi frequency is simply $g$. + +### Integration with QuTiP Solvers + +Quantum system library seamlessly integrates with QuTiP's time evolution solvers. The `mesolve` function requires four key components: the system Hamiltonian, initial state, collapse operators (for dissipative dynamics) and measurement operators. The `jaynes_cummings` function provides these in a ready to use format. We simply extract `jc.hamiltonian` for the system dynamics, use `jc.c_ops` for dissipation (which can be an empty list for closed systems), and define measurement operators using `jc.operators` for computing expectation values. This streamlined approach eliminates the typical setup overhead and potential errors in manually constructing these components. + +```python +# Create a simple JC system for studying Rabi oscillations +jc = quantum_systems.jaynes_cummings( + omega_c=1.0, # Cavity frequency + omega_a=1.0, # Atomic frequency (resonant) + g=0.1, # Coupling strength + n_cavity=5, # Small Hilbert space for clarity +) + +# Create initial state: atom excited, cavity empty +n_cavity = 5 +psi0 = tensor(basis(n_cavity, 0), basis(2, 1)) # |0,e⟩ + +# Time evolution +tlist = np.linspace(0, 50, 1000) + +# Define measurement operators +measure_ops = [ + jc.operators["n_c"], # Cavity photon number + jc.operators["sigma_plus"] * jc.operators["sigma_minus"], # Atomic excitation +] + +# Solve time evolution +result = mesolve(jc.hamiltonian, psi0, tlist, [], e_ops=measure_ops) + +n_c = result.expect[0] +n_a = result.expect[1] + +fig, axes = plt.subplots(1, 1, figsize=(10, 6)) + +axes.plot(tlist, n_c, label="Cavity") +axes.plot(tlist, n_a, label="Atom excited state") +axes.legend(loc=1) +axes.set_xlabel("Time") +axes.set_ylabel("Occupation probability") +axes.set_title("Vacuum Rabi oscillations"); +``` + +## Effect of Detuning on Rabi Oscillations + +Detuning between the atomic transition and cavity mode frequency significantly affects the dynamics. In this analysis, we create a detuned system with $\omega_a = 1.1$ and $\omega_c = 1.0$, resulting in a detuning of $\Delta = 0.1$. This modest detuning allows us to observe how the energy mismatch between atom and cavity modifies the oscillation pattern while still maintaining reasonable coupling efficiency. We use the same coupling strength ($g = 0.1$) and cavity truncation ($n_{cavity} = 5$) as before to isolate the effect of detuning. + +When the atom and cavity are detuned ($\Delta = \omega_a - \omega_c \neq 0$), the effective Rabi frequency becomes: + +$$\Omega_{eff} = \sqrt{g^2 + (\Delta/2)^2}$$ + +Large detuning reduces the effective coupling and can lead to more complex oscillation patterns. + +```python +# Create a detuned JC system +jc = quantum_systems.jaynes_cummings( + omega_c=1.0, # Cavity frequency + omega_a=1.1, # Atomic frequency (detuned) + g=0.1, # Coupling strength + n_cavity=5, # Small Hilbert space for clarity +) + +# Create initial state: atom excited, cavity empty +n_cavity = 5 +psi0 = tensor(basis(n_cavity, 0), basis(2, 1)) # |0,e⟩ + +# Time evolution +tlist = np.linspace(0, 50, 1000) + +# Define measurement operators +measure_ops = [ + jc.operators["n_c"], # Cavity photon number + jc.operators["sigma_plus"] * jc.operators["sigma_minus"], # Atomic excitation +] + +# Solve time evolution +result = mesolve(jc.hamiltonian, psi0, tlist, [], e_ops=measure_ops) + +n_c = result.expect[0] +n_a = result.expect[1] + +fig, axes = plt.subplots(1, 1, figsize=(10, 6)) + +axes.plot(tlist, n_c, label="Cavity") +axes.plot(tlist, n_a, label="Atom excited state") +axes.legend(loc=1) +axes.set_xlabel("Time") +axes.set_ylabel("Occupation probability") +axes.set_title("Detuned Rabi oscillations"); +``` + +The detuned oscillations show beating patterns and incomplete energy transfer between atom and cavity, with the atomic excitation never fully depleting due to the energy mismatch. The effective Rabi frequency is now $\Omega_{eff} = \sqrt{(0.1)^2 + (0.1/2)^2} \approx 0.112$, slightly higher than the resonant case. + + +## Dissipative Dynamics + +Real quantum systems experience dissipation due to coupling with their environment. In this section, we systematically study how different dissipation mechanisms affect the Jaynes-Cummings dynamics by comparing four scenarios: no dissipation (ideal closed system), cavity decay only ($\kappa = 0.02$), atomic decay only ($\gamma = 0.01$), and both types of decay present. We choose these moderate decay rates to clearly observe the effects while maintaining some coherent oscillations. The cavity decay rate is set higher than atomic decay to reflect typical experimental conditions where photons leak from cavities faster than atoms undergo spontaneous emission. + +Dissipation destroys the perfect oscillations we saw in the closed system. The master equation approach in QuTiP allows us to model these effects: + +- **Cavity decay**: $\mathcal{L}[a]\rho = a\rho a^\dagger - \frac{1}{2}\{a^\dagger a, \rho\}$ +- **Atomic decay**: $\mathcal{L}[\sigma_-]\rho = \sigma_-\rho \sigma_+ - \frac{1}{2}\{\sigma_+ \sigma_-, \rho\}$ +- **Dephasing**: $\mathcal{L}[\sigma_z]\rho = \sigma_z\rho \sigma_z - \rho$ + +```python +# Compare dynamics with and without dissipation +plt.figure(figsize=(12, 10)) + +# Parameters for comparison +systems = [ + { + "name": "No Dissipation", + "cavity_decay": 0.0, + "atomic_decay": 0.0, + "color": "blue", + }, + { + "name": "Cavity Decay only", + "cavity_decay": 0.02, + "atomic_decay": 0.0, + "color": "green", + }, + { + "name": "Atomic Decay only", + "cavity_decay": 0.0, + "atomic_decay": 0.01, + "color": "orange", + }, + {"name": "Both Decays", "cavity_decay": 0.02, "atomic_decay": 0.01, "color": "red"}, +] + +# Time evolution +tlist = np.linspace(0, 100, 300) + +for i, sys_params in enumerate(systems): + # Create JC system with dissipation + jc_diss = quantum_systems.jaynes_cummings( + omega_c=1.0, + omega_a=1.0, + g=0.1, + n_cavity=5, + cavity_decay=sys_params["cavity_decay"], + atomic_decay=sys_params["atomic_decay"], + ) + + # Initial state: atom excited, cavity empty + psi0 = tensor(basis(5, 0), basis(2, 1)) + + # Measurement operators + measure_ops = [ + jc_diss.operators["n_c"], # Cavity photons + jc_diss.operators["sigma_plus"] + * jc_diss.operators["sigma_minus"], # Atomic excitation + ] + + # Solve master equation + result = mesolve(jc_diss.hamiltonian, psi0, tlist, jc_diss.c_ops, e_ops=measure_ops) + + # Plot results + plt.subplot(2, 2, i + 1) + plt.plot( + tlist, + result.expect[0], + label="Cavity photons", + color=sys_params["color"], + linewidth=2, + ) + plt.plot( + tlist, + result.expect[1], + label="Atomic excitation", + color=sys_params["color"], + linestyle="--", + linewidth=2, + ) + plt.title(sys_params["name"]) + plt.xlabel("Time") + plt.ylabel("Population") + plt.legend(loc=1) + plt.grid(True, alpha=0.3) + plt.ylim(0, 1) + +plt.tight_layout() +plt.show() +``` + +The dissipation analysis reveals that cavity decay preferentially removes photons from the system, while atomic decay directly reduces atomic excitation. When both processes are present, the system reaches a steady state close to the ground state much faster, demonstrating how environmental coupling fundamentally alters quantum dynamics. + +## Thermal Effects and Steady States + +At finite temperature, the cavity can be populated by thermal photons, which affects both the dynamics and steady states of the system. We investigate this by varying the thermal photon number from 0 to 1.0, representing increasingly warm environments. We include both cavity decay ($\kappa = 0.02$) and atomic decay ($\gamma = 0.01$) to model realistic conditions, and extend the simulation time to 200 time units to clearly observe steady-state behavior. The thermal photon parameter $n_{th}$ represents the average occupation of the cavity mode due to temperature. + +Thermal effects introduce: +1. **Thermal excitation**: Random population of cavity modes +2. **Modified decay rates**: Both emission and absorption processes +3. **Finite steady-state populations**: System doesn't decay to pure ground state + +The thermal occupation follows the Bose-Einstein distribution: $n_{th} = 1/(e^{\hbar\omega/k_BT} - 1)$ + +```python +# Study thermal effects +thermal_photon_values = [0.0, 0.1, 0.5, 1.0] + +plt.figure(figsize=(12, 10)) + +# Time evolution parameters +tlist = np.linspace(0, 200, 400) + +for i, n_th in enumerate(thermal_photon_values): + # Create JC system with thermal bath + jc_thermal = quantum_systems.jaynes_cummings( + omega_c=1.0, + omega_a=1.0, + g=0.1, + n_cavity=6, + cavity_decay=0.02, + atomic_decay=0.01, + thermal_photons=n_th, + ) + + # Initial state: atom excited, cavity empty + psi0 = tensor(basis(6, 0), basis(2, 1)) + + # Measurement operators + measure_ops = [ + jc_thermal.operators["n_c"], # Cavity photons + jc_thermal.operators["sigma_plus"] + * jc_thermal.operators["sigma_minus"], # Atomic excitation + ] + + # Solve master equation + result = mesolve( + jc_thermal.hamiltonian, psi0, tlist, jc_thermal.c_ops, e_ops=measure_ops + ) + + # Plot steady-state approach + plt.subplot(2, 2, i + 1) + plt.plot(tlist, result.expect[0], "b-", label="Cavity photons", linewidth=2) + plt.plot(tlist, result.expect[1], "r--", label="Atomic excitation", linewidth=2) + plt.title(f"Thermal photons n_th = {n_th:.1f}") + plt.xlabel("Time") + plt.ylabel("Population") + plt.legend() + plt.grid(True, alpha=0.3) + + # Show steady-state values + ss_cavity = result.expect[0][-1] + ss_atom = result.expect[1][-1] + plt.text( + 0.8 * tlist[-1], + 0.8, + f"SS cavity: {ss_cavity:.3f}\nSS atom: {ss_atom:.3f}", + bbox=dict(boxstyle="round,pad=0.3", facecolor="lightblue", alpha=0.7), + ) + +plt.tight_layout() +plt.show() +``` + +The thermal analysis demonstrates that increasing temperature leads to higher steady-state cavity occupation, with the system reaching thermal equilibrium with its environment. At high thermal photon numbers ($n_{th} = 1.0$), the steady-state cavity population approaches the thermal value, while atomic excitation remains finite due to thermal activation. + + +## Vacuum Rabi Splitting + +One of the most important phenomena in cavity QED is vacuum Rabi splitting, the splitting of energy levels due to strong coupling between atom and cavity, even when no photons are present. To observe this phenomenon clearly, we use spectroscopic techniques to examine the power spectrum of cavity emission. We set the system parameters in appropriate units with $\omega_c = \omega_a = 2\pi$ (natural frequency units), moderate coupling $g = 0.05 \times 2\pi$, and include realistic dissipation rates to model experimental conditions. We also add thermal photons ($n_{th} = 0.25$) to simulate finite temperature effects that are always present in real experiments. + +In the strong coupling regime ($g > \kappa, \gamma$), the energy eigenstates of the Jaynes-Cummings model are no longer simply atomic or photonic states, but rather dressed states (polaritons) that are superpositions of both. + +For the resonant case, the energy levels split by $2g$ due to the atom-cavity interaction, even in vacuum. This is a purely quantum mechanical effect with no classical analog. + +```python +jc = quantum_systems.jaynes_cummings( + omega_c=1.0 * 2 * np.pi, # Cavity frequency + omega_a=1.0 * 2 * np.pi, # Atomic frequency + g=0.05 * 2 * np.pi, # Coupling strength + n_cavity=5, # Small Hilbert space for clarity + cavity_decay=0.005, + atomic_decay=0.05, + thermal_photons=0.25, +) + +# Compute Correlation Function and Spectrum +tlist = np.linspace(0, 100, 5000) +corr = correlation_2op_1t( + jc.hamiltonian, None, tlist, jc.c_ops, jc.operators["a_dag"], jc.operators["a"] +) +wlist1, spec1 = spectrum_correlation_fft(tlist, corr) + +wlist2 = np.linspace(0.25, 1.75, 200) * 2 * np.pi +spec2 = spectrum( + jc.hamiltonian, wlist2, jc.c_ops, jc.operators["a_dag"], jc.operators["a"] +) + +# Plot Power Spectrum +plt.figure(figsize=(8, 4)) +plt.plot(wlist1 / (2 * np.pi), spec1, "b", lw=2, label="eseries method") +plt.plot(wlist2 / (2 * np.pi), spec2, "r--", lw=2, label="me+fft method") +plt.xlabel("Frequency (meV)") +plt.ylabel("Power Spectrum (arb. units)") +plt.title("Vacuum Rabi Splitting") +plt.legend() +plt.xlim(0, 2) +plt.show() +``` + +The power spectrum clearly reveals the characteristic double-peak structure of vacuum Rabi splitting, with the two peaks separated by approximately $2g = 0.1 \times 2\pi \approx 0.628$ frequency units. This splitting occurs even at the quantum vacuum level, demonstrating the fundamental quantum nature of light-matter interactions in cavity QED systems. + + +## Conclusion + +This tutorial has demonstrated the power and versatility of the Jaynes-Cummings model as a foundation for understanding cavity quantum electrodynamics. The quantum system library provides a streamlined approach to exploring this rich physics, from basic Rabi oscillations to advanced phenomena like vacuum Rabi splitting. We've seen how detuning modifies energy exchange efficiency, how dissipation fundamentally alters system dynamics, and how thermal effects establish realistic steady states. The library's integration with QuTiP solvers enables rapid exploration of parameter spaces while maintaining theoretical rigor. These tools and insights form the basis for understanding more complex quantum optical systems and advancing quantum technologies in areas ranging from quantum computing to precision sensing. + +```python +about() +``` From be7a774aabc2e998565773ae488888791bda72c1 Mon Sep 17 00:00:00 2001 From: Vanshaj0429 Date: Mon, 22 Sep 2025 17:49:05 +0100 Subject: [PATCH 2/3] Minor corrections and branch change in notebook_ci.yaml --- .github/workflows/notebook_ci.yaml | 2 +- tutorials-v5/quantum-system/JCM_Tutorial.md | 38 ++++++++++++++------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/notebook_ci.yaml b/.github/workflows/notebook_ci.yaml index c51f3951..0d28dffd 100644 --- a/.github/workflows/notebook_ci.yaml +++ b/.github/workflows/notebook_ci.yaml @@ -19,7 +19,7 @@ jobs: - qutip-version: '4' qutip-branch: 'qutip-4.7.X' - qutip-version: '5' - qutip-branch: 'master' + qutip-branch: 'dev.qsystem' steps: - uses: actions/checkout@v4 diff --git a/tutorials-v5/quantum-system/JCM_Tutorial.md b/tutorials-v5/quantum-system/JCM_Tutorial.md index ad3178df..8464774f 100644 --- a/tutorials-v5/quantum-system/JCM_Tutorial.md +++ b/tutorials-v5/quantum-system/JCM_Tutorial.md @@ -75,6 +75,8 @@ In realistic systems, both the cavity and atom experience losses: These effects are modeled using Lindblad collapse operators in the master equation formalism. +**Note:** The use of local Lindblad collapse operators is usually valid only in the weak and strong coupling regime (when the interaction strength is similar to or large than the dissipation rates). However, in the ultra-strong coupling regimes, when the interaction approaches the (bare) cavity and/or atomic frequencies, unphysical effects like loss of energy conservation can occur, it is more appropriate to consider using the Bloch-Redfield solver. This will not be described here, however. + ### Package Imports Let's start by importing the necessary libraries: @@ -82,6 +84,7 @@ Let's start by importing the necessary libraries: ```python import matplotlib.pyplot as plt import numpy as np +from qutip.visualization import plot_energy_levels from qutip import ( about, basis, @@ -100,8 +103,11 @@ from qutip import ( ### Why Build a Quantum System Library? -When working with quantum systems in QuTiP, researchers often find themselves writing repetitive code to construct Hamiltonians and operators. Consider the conventional approach to building a Jaynes-Cummings model, -refer to the conventional construction [here](https://nbviewer.org/urls/qutip.org/qutip-tutorials/tutorials-v5/lectures/Lecture-1-Jaynes-Cumming-model.ipynb). +When working with quantum systems in QuTiP, researchers frequently encounter the same challenge: writing repetitive boilerplate code to construct Hamiltonians and operators for well-known models. The conventional approach to building a Jaynes-Cummings system involves manually creating tensor products, carefully ordering operators, and handling dissipation - a process that's both time-consuming and error-prone. + +To illustrate this complexity, you can examine the traditional QuTiP construction approach in this [detailed tutorial](https://nbviewer.org/urls/qutip.org/qutip-tutorials/tutorials-v5/lectures/Lecture-1-Jaynes-Cumming-model.ipynb), which demonstrates the many steps required for a complete implementation. + +This repetitive workflow motivated us to develop a more efficient solution through standardized factory functions. ### Solution: Factory Functions @@ -122,7 +128,7 @@ Let's explore how quantum system library simplifies working with the Jaynes-Cumm ### Example 1: Basic Resonant System -The first example demonstrates the simplest case of the Jaynes-Cummings model: a resonant system where the cavity frequency and atomic transition frequency are identical ($\omega_c = \omega_a = 1.0$). This resonance condition maximizes the coupling efficiency between the atom and cavity field. We choose a moderate coupling strength ($g = 0.1$) relative to the frequencies, placing us in the weak-to-intermediate coupling regime. The cavity Fock space is truncated at 5 photon states, which is sufficient for most dynamics when starting from low-energy initial states. Notice how the `jaynes_cummings` function creates the entire system with a single line, no need to manually construct tensor products or worry about operator ordering. +The first example demonstrates the simplest case of the Jaynes-Cummings model: a resonant system where the cavity frequency and atomic transition frequency are identical ($\omega_c = \omega_a = 1.0$). This resonance condition maximizes the coupling efficiency between the atom and cavity field. We choose a moderate coupling strength ($g = 0.1$) relative to the frequencies, placing us in the intermediate coupling regime. The cavity Fock space is truncated at 5 photon states, which is sufficient for most dynamics when starting from low-energy initial states. Notice how the `jaynes_cummings` function creates the entire system with a single line, no need to manually construct tensor products or worry about operator ordering. ```python # Example 1: Basic resonant system @@ -201,6 +207,14 @@ print(f"First few eigenvalues: {eigenvals[:5]}") print(f"Ground state energy: {eigenvals[0]:.3f}") print(f"First excited energy: {eigenvals[1]:.3f}") print(f"Energy gap: {eigenvals[1] - eigenvals[0]:.3f}") + +# Visualize energy levels +fig, ax = plt.subplots(figsize=(8, 6)) +plot_energy_levels([jc_small.hamiltonian], ax=ax) +plt.title('Jaynes-Cummings Energy Spectrum') +plt.xlabel('Energy Level Index') +plt.ylabel('Energy') +plt.show() ``` ## Quantum Dynamics: Rabi Oscillations @@ -214,7 +228,7 @@ The Rabi frequency depends on: - The number of photons in the cavity - The detuning between atom and cavity -For an initially excited atom and empty cavity, the Rabi frequency is simply $g$. +For an initially excited atom and empty cavity on resonance, the Rabi frequency is simply $g$. ### Integration with QuTiP Solvers @@ -477,7 +491,7 @@ plt.show() The thermal analysis demonstrates that increasing temperature leads to higher steady-state cavity occupation, with the system reaching thermal equilibrium with its environment. At high thermal photon numbers ($n_{th} = 1.0$), the steady-state cavity population approaches the thermal value, while atomic excitation remains finite due to thermal activation. -## Vacuum Rabi Splitting +## Rabi Splitting One of the most important phenomena in cavity QED is vacuum Rabi splitting, the splitting of energy levels due to strong coupling between atom and cavity, even when no photons are present. To observe this phenomenon clearly, we use spectroscopic techniques to examine the power spectrum of cavity emission. We set the system parameters in appropriate units with $\omega_c = \omega_a = 2\pi$ (natural frequency units), moderate coupling $g = 0.05 \times 2\pi$, and include realistic dissipation rates to model experimental conditions. We also add thermal photons ($n_{th} = 0.25$) to simulate finite temperature effects that are always present in real experiments. @@ -497,7 +511,7 @@ jc = quantum_systems.jaynes_cummings( ) # Compute Correlation Function and Spectrum -tlist = np.linspace(0, 100, 5000) +tlist = np.linspace(0, 1000, 5000) corr = correlation_2op_1t( jc.hamiltonian, None, tlist, jc.c_ops, jc.operators["a_dag"], jc.operators["a"] ) @@ -510,22 +524,22 @@ spec2 = spectrum( # Plot Power Spectrum plt.figure(figsize=(8, 4)) -plt.plot(wlist1 / (2 * np.pi), spec1, "b", lw=2, label="eseries method") -plt.plot(wlist2 / (2 * np.pi), spec2, "r--", lw=2, label="me+fft method") +plt.plot(wlist1 / (2 * np.pi), spec1, "b", lw=2, label="me+fft method") +plt.plot(wlist2 / (2 * np.pi), spec2, "r--", lw=2, label="eseries method") plt.xlabel("Frequency (meV)") plt.ylabel("Power Spectrum (arb. units)") -plt.title("Vacuum Rabi Splitting") +plt.title("Rabi Splitting") plt.legend() -plt.xlim(0, 2) +plt.xlim(0.75, 1.25) plt.show() ``` -The power spectrum clearly reveals the characteristic double-peak structure of vacuum Rabi splitting, with the two peaks separated by approximately $2g = 0.1 \times 2\pi \approx 0.628$ frequency units. This splitting occurs even at the quantum vacuum level, demonstrating the fundamental quantum nature of light-matter interactions in cavity QED systems. +The power spectrum clearly reveals the characteristic double-peak structure of Rabi splitting, with the two peaks separated by approximately $2g = 0.1 \times 2\pi \approx 0.628$ frequency units. This splitting occurs even at the quantum vacuum level, demonstrating the fundamental quantum nature of light-matter interactions in cavity QED systems. ## Conclusion -This tutorial has demonstrated the power and versatility of the Jaynes-Cummings model as a foundation for understanding cavity quantum electrodynamics. The quantum system library provides a streamlined approach to exploring this rich physics, from basic Rabi oscillations to advanced phenomena like vacuum Rabi splitting. We've seen how detuning modifies energy exchange efficiency, how dissipation fundamentally alters system dynamics, and how thermal effects establish realistic steady states. The library's integration with QuTiP solvers enables rapid exploration of parameter spaces while maintaining theoretical rigor. These tools and insights form the basis for understanding more complex quantum optical systems and advancing quantum technologies in areas ranging from quantum computing to precision sensing. +This tutorial has demonstrated the power and versatility of the Jaynes-Cummings model as a foundation for understanding cavity quantum electrodynamics. The quantum system library provides a streamlined approach to exploring this rich physics, from basic Rabi oscillations to advanced phenomena like Rabi splitting. We've seen how detuning modifies energy exchange efficiency, how dissipation fundamentally alters system dynamics, and how thermal effects establish realistic steady states. The library's integration with QuTiP solvers enables rapid exploration of parameter spaces while maintaining theoretical rigor. These tools and insights form the basis for understanding more complex quantum optical systems and advancing quantum technologies in areas ranging from quantum computing to precision sensing. ```python about() From 90c7a65a802157e3febc75872b220d45ee5d7324 Mon Sep 17 00:00:00 2001 From: Vanshaj0429 Date: Tue, 23 Sep 2025 11:01:06 +0100 Subject: [PATCH 3/3] minor typo fixed --- tutorials-v5/quantum-system/JCM_Tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials-v5/quantum-system/JCM_Tutorial.md b/tutorials-v5/quantum-system/JCM_Tutorial.md index 8464774f..646905d5 100644 --- a/tutorials-v5/quantum-system/JCM_Tutorial.md +++ b/tutorials-v5/quantum-system/JCM_Tutorial.md @@ -75,7 +75,7 @@ In realistic systems, both the cavity and atom experience losses: These effects are modeled using Lindblad collapse operators in the master equation formalism. -**Note:** The use of local Lindblad collapse operators is usually valid only in the weak and strong coupling regime (when the interaction strength is similar to or large than the dissipation rates). However, in the ultra-strong coupling regimes, when the interaction approaches the (bare) cavity and/or atomic frequencies, unphysical effects like loss of energy conservation can occur, it is more appropriate to consider using the Bloch-Redfield solver. This will not be described here, however. +**Note:** The use of local Lindblad collapse operators is usually valid only in the weak and strong coupling regime (when the interaction strength is similar to or larger than the dissipation rates). However, in the ultra-strong coupling regimes, when the interaction approaches the (bare) cavity and/or atomic frequencies, unphysical effects like loss of energy conservation can occur, it is more appropriate to consider using the Bloch-Redfield solver. This will not be described here, however. ### Package Imports