This program is only used to display the generic system of equations. To solve the system numerically, we scale the atom number. However, with QuantumCumulants this is currently only possible by explicitly defining the (eight) different atom clusters and then scaling them individually. This is shown in the code example cavity_sub-to-superradiance_equations.
#Julia-1.9.1
using QuantumCumulants #v0.2.23
# Hilbert space
hf = FockSpace(:cavity)
ha = NLevelSpace(:atom,2)
h = hf ⊗ ha
# Fundamental operators
a = Destroy(h,:a,1)
σ(i,j,k) = IndexedOperator(Transition(h,:σ,i,j,2), k)
# Parameters
@cnumbers γ κ δc δa Ω N
g(k) = IndexedVariable(:g, k)
# Summation indices
i = Index(h,:i,N,ha)
k = Index(h,:k,N,ha);
# Hamiltonian
H_0 = -δc*a'a - δa*( ∑(σ(2,2,k),k))
H_int = (a'∑(g(k)*σ(1,2,k),k) + a*∑(g(k)*σ(2,1,k),k))
H_laser = Ω/2*( ∑(σ(1,2,k),k) + ∑(σ(2,1,k),k))
H = H_0 + H_int + H_laser
# Jump operators & rates
J = [a, σ(1,2,k)]
R = [κ, γ];
ops = [a'a, σ(2,2,i), a'σ(1,2,i)]
eqs = meanfield(ops, H, J; rates=R, order=2)
eqs_c = complete(eqs) # closed set of equations (in 2nd-order)