|
| 1 | +# [Two-time Correlation Functions](@id doc:Two-time-Correlation-Functions) |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +With the `QuantumToolbox.jl` time-evolution function [`mesolve`](@ref), a state vector ([`Ket`](@ref)) or density matrix ([`Operator`](@ref)) can be evolved from an initial state at ``t_0`` to an arbitrary time ``t``, namely |
| 6 | + |
| 7 | +```math |
| 8 | +\hat{\rho}(t) = \mathcal{G}(t, t_0)\{\hat{\rho}(t_0)\}, |
| 9 | +``` |
| 10 | +where ``\mathcal{G}(t, t_0)\{\cdot\}`` is the propagator defined by the equation of motion. The resulting density matrix can then be used to evaluate the expectation values of arbitrary combinations of same-time operators. |
| 11 | + |
| 12 | +To calculate two-time correlation functions on the form ``\left\langle \hat{A}(t+\tau) \hat{B}(t) \right\rangle``, we can use the quantum regression theorem (see, e.g., [Gardiner-Zoller2004](@cite)) to write |
| 13 | + |
| 14 | +```math |
| 15 | +\left\langle \hat{A}(t+\tau) \hat{B}(t) \right\rangle = \textrm{Tr} \left[\hat{A} \mathcal{G}(t+\tau, t)\{\hat{B}\hat{\rho}(t)\} \right] = \textrm{Tr} \left[\hat{A} \mathcal{G}(t+\tau, t)\{\hat{B} \mathcal{G}(t, 0)\{\hat{\rho}(0)\}\} \right], |
| 16 | +``` |
| 17 | + |
| 18 | +We therefore first calculate ``\hat{\rho}(t) = \mathcal{G}(t, 0)\{\hat{\rho}(0)\}`` using [`mesolve`](@ref) with ``\hat{\rho}(0)`` as initial state, and then again use [`mesolve`](@ref) to calculate ``\mathcal{G}(t+\tau, t)\{\hat{B}\hat{\rho}(t)\}`` using ``\hat{B}\hat{\rho}(t)`` as initial state. |
| 19 | + |
| 20 | +Note that if the initial state is the steady state, then ``\hat{\rho}(t) = \mathcal{G}(t, 0)\{\hat{\rho}_{\textrm{ss}}\} = \hat{\rho}_{\textrm{ss}}`` and |
| 21 | + |
| 22 | +```math |
| 23 | +\left\langle \hat{A}(t+\tau) \hat{B}(t) \right\rangle = \textrm{Tr} \left[\hat{A} \mathcal{G}(t+\tau, t)\{\hat{B}\hat{\rho}_{\textrm{ss}}\} \right] = \textrm{Tr} \left[\hat{A} \mathcal{G}(\tau, 0)\{\hat{B} \hat{\rho}_{\textrm{ss}}\} \right] = \left\langle \hat{A}(\tau) \hat{B}(0) \right\rangle, |
| 24 | +``` |
| 25 | +which is independent of ``t``, so that we only have one time coordinate ``\tau``. |
| 26 | + |
| 27 | +`QuantumToolbox.jl` provides a family of functions that assists in the process of calculating two-time correlation functions. The available functions and their usage is shown in the table below. |
| 28 | + |
| 29 | +| **Function call** | **Correlation function** | |
| 30 | +|:------------------|:-------------------------| |
| 31 | +| [`correlation_2op_2t`](@ref) | ``\left\langle \hat{A}(t + \tau) \hat{B}(t) \right\rangle`` or ``\left\langle \hat{A}(t) \hat{B}(t + \tau) \right\rangle`` | |
| 32 | +| [`correlation_2op_1t`](@ref) | ``\left\langle \hat{A}(\tau) \hat{B}(0) \right\rangle`` or ``\left\langle \hat{A}(0) \hat{B}(\tau) \right\rangle`` | |
| 33 | +| [`correlation_3op_1t`](@ref) | ``\left\langle \hat{A}(0) \hat{B}(\tau) \hat{C}(0) \right\rangle`` | |
| 34 | +| [`correlation_3op_2t`](@ref) | ``\left\langle \hat{A}(t) \hat{B}(t + \tau) \hat{C}(t) \right\rangle`` | |
| 35 | + |
| 36 | +The most common used case is to calculate the two time correlation function ``\left\langle \hat{A}(\tau) \hat{B}(0) \right\rangle``, which can be done by [`correlation_2op_1t`](@ref). |
| 37 | + |
| 38 | +```@setup correlation_and_spectrum |
| 39 | +using QuantumToolbox |
| 40 | +
|
| 41 | +using CairoMakie |
| 42 | +CairoMakie.enable_only_mime!(MIME"image/svg+xml"()) |
| 43 | +``` |
| 44 | + |
| 45 | +## Steadystate correlation function |
| 46 | + |
| 47 | +The following code demonstrates how to calculate the ``\langle \hat{x}(t) \hat{x}(0)\rangle`` correlation for a leaky cavity with three different relaxation rates ``\gamma``. |
| 48 | + |
| 49 | +```@example correlation_and_spectrum |
| 50 | +tlist = LinRange(0, 10, 200) |
| 51 | +a = destroy(10) |
| 52 | +x = a' + a |
| 53 | +H = a' * a |
| 54 | +
|
| 55 | +# if the initial state is specified as `nothing`, the steady state will be calculated and used as the initial state. |
| 56 | +corr1 = correlation_2op_1t(H, nothing, tlist, [sqrt(0.5) * a], x, x) |
| 57 | +corr2 = correlation_2op_1t(H, nothing, tlist, [sqrt(1.0) * a], x, x) |
| 58 | +corr3 = correlation_2op_1t(H, nothing, tlist, [sqrt(2.0) * a], x, x) |
| 59 | +
|
| 60 | +# plot by CairoMakie.jl |
| 61 | +fig = Figure(size = (500, 350)) |
| 62 | +ax = Axis(fig[1, 1], xlabel = L"Time $t$", ylabel = L"\langle \hat{x}(t) \hat{x}(0) \rangle") |
| 63 | +lines!(ax, tlist, real(corr1), label = L"\gamma = 0.5", linestyle = :solid) |
| 64 | +lines!(ax, tlist, real(corr2), label = L"\gamma = 1.0", linestyle = :dash) |
| 65 | +lines!(ax, tlist, real(corr3), label = L"\gamma = 2.0", linestyle = :dashdot) |
| 66 | +
|
| 67 | +axislegend(ax, position = :rt) |
| 68 | +
|
| 69 | +fig |
| 70 | +``` |
| 71 | + |
| 72 | +## Emission spectrum |
| 73 | + |
| 74 | +Given a correlation function ``\langle \hat{A}(\tau) \hat{B}(0) \rangle``, we can define the corresponding power spectrum as |
| 75 | + |
| 76 | +```math |
| 77 | +S(\omega) = \int_{-\infty}^\infty \left\langle \hat{A}(\tau) \hat{B}(0) \right\rangle e^{-i \omega \tau} d \tau |
| 78 | +``` |
| 79 | + |
| 80 | +In `QuantumToolbox.jl`, we can calculate ``S(\omega)`` using either [`spectrum`](@ref), which provides several solvers to perform the Fourier transform semi-analytically, or we can use the function [`spectrum_correlation_fft`](@ref) to numerically calculate the fast Fourier transform (FFT) of a given correlation data. |
| 81 | + |
| 82 | +The following example demonstrates how these methods can be used to obtain the emission (``\hat{A} = \hat{a}^\dagger`` and ``\hat{B} = \hat{a}``) power spectrum. |
| 83 | + |
| 84 | +```@example correlation_and_spectrum |
| 85 | +N = 4 # number of cavity fock states |
| 86 | +ωc = 1.0 * 2 * π # cavity frequency |
| 87 | +ωa = 1.0 * 2 * π # atom frequency |
| 88 | +g = 0.1 * 2 * π # coupling strength |
| 89 | +κ = 0.75 # cavity dissipation rate |
| 90 | +γ = 0.25 # atom dissipation rate |
| 91 | +
|
| 92 | +# Jaynes-Cummings Hamiltonian |
| 93 | +a = tensor(destroy(N), qeye(2)) |
| 94 | +sm = tensor(qeye(N), destroy(2)) |
| 95 | +H = ωc * a' * a + ωa * sm' * sm + g * (a' * sm + a * sm') |
| 96 | +
|
| 97 | +# collapse operators |
| 98 | +n_th = 0.25 |
| 99 | +c_ops = [ |
| 100 | + sqrt(κ * (1 + n_th)) * a, |
| 101 | + sqrt(κ * n_th) * a', |
| 102 | + sqrt(γ) * sm, |
| 103 | +]; |
| 104 | +
|
| 105 | +# calculate the correlation function using mesolve, and then FFT to obtain the spectrum. |
| 106 | +# Here we need to make sure to evaluate the correlation function for a sufficient long time and |
| 107 | +# sufficiently high sampling rate so that FFT captures all the features in the resulting spectrum. |
| 108 | +tlist = LinRange(0, 100, 5000) |
| 109 | +corr = correlation_2op_1t(H, nothing, tlist, c_ops, a', a; progress_bar = Val(false)) |
| 110 | +ωlist1, spec1 = spectrum_correlation_fft(tlist, corr) |
| 111 | +
|
| 112 | +# calculate the power spectrum using spectrum |
| 113 | +# using Exponential Series (default) method |
| 114 | +ωlist2 = LinRange(0.25, 1.75, 200) * 2 * π |
| 115 | +spec2 = spectrum(H, ωlist2, c_ops, a', a; solver = ExponentialSeries()) |
| 116 | +
|
| 117 | +# calculate the power spectrum using spectrum |
| 118 | +# using Pseudo-Inverse method |
| 119 | +spec3 = spectrum(H, ωlist2, c_ops, a', a; solver = PseudoInverse()) |
| 120 | +
|
| 121 | +# plot by CairoMakie.jl |
| 122 | +fig = Figure(size = (500, 350)) |
| 123 | +ax = Axis(fig[1, 1], title = "Vacuum Rabi splitting", xlabel = "Frequency", ylabel = "Emission power spectrum") |
| 124 | +lines!(ax, ωlist1 / (2 * π), spec1, label = "mesolve + FFT", linestyle = :solid) |
| 125 | +lines!(ax, ωlist2 / (2 * π), spec2, label = "Exponential Series", linestyle = :dash) |
| 126 | +lines!(ax, ωlist2 / (2 * π), spec3, label = "Pseudo-Inverse", linestyle = :dashdot) |
| 127 | +
|
| 128 | +xlims!(ax, ωlist2[1] / (2 * π), ωlist2[end] / (2 * π)) |
| 129 | +axislegend(ax, position = :rt) |
| 130 | +
|
| 131 | +fig |
| 132 | +``` |
| 133 | + |
| 134 | +## Non-steadystate correlation function |
| 135 | + |
| 136 | +The following part of this page is still under construction, please visit [API](@ref doc-API) first. |
| 137 | + |
| 138 | +### Example: first-order optical coherence function |
| 139 | + |
| 140 | +### Example: second-order optical coherence function |
0 commit comments