QuantumOptics.jl optimizes processor usage and memory consumption by relying on different ways to store and work with operators. Check out the benchmarks.
The framework comes with a plethora of pre-defined systems and interactions making it very easy to focus on the physics, not on the numerics. Read the documentation.
Every function in the framework has been severely tested with all tests and their code coverage presented on the framework's GitHub page.
To get started with Julia, check out Julia's setup instructions. For plotting we recommend matplotlib in Python, which plays nicely with Julia. Before you can execute any of the framework's functions, you will need to add the
QuantumOptics package to Julia, as shown below. Plotting with matplotlib is then enabled by adding the
Pkg.add("QuantumOptics") # Install QuantumOptics.jl package Pkg.add("PyPlot") # Support for matplotlib from within Julia
using QuantumOptics basis = PositionBasis(-2, 2, 200) x = position(basis) p = momentum(basis) H = p^2/4 + 2*full(x^2) energies, states = eigenstates((H+dagger(H))/2, 5) using PyPlot xpoints = samplepoints(basis) plot(xpoints, 2*xpoints.^2) fill_between(xpoints, 0., 2*xpoints.^2, alpha=0.5) for i=1:length(states) plot(xpoints, abs2.(states[i].data)*40 + energies[i]) end xlabel("Position") ylabel("Energy") tight_layout() savefig("particle.svg")
using QuantumOptics b = FockBasis(50) a = destroy(b) at = create(b) H = 0.5*(a^2 + at^2) psi0 = fockstate(b, 3) tout, psit = timeevolution.schroedinger([0:0.25:1;], psi0, H) using PyPlot x = [-5:0.1:5;] for i in 1:4 subplot(2, 2, i) Q = qfunc(psit[i], x, x) pcolor(x, x, Q) end tight_layout() savefig("fock.png")
using QuantumOptics b = SpinBasis(3//2) sm = sigmam(b) H = 2*sigmaz(b) J = [sm] τ = [0:0.025:5;] ω = [-5:0.05:25;] ρ0 = dm(spinup(b)) corr = timecorrelations.correlation(τ, ρ0, H, J, sigmap(b), sm) ω, S = timecorrelations.spectrum(ω, H, J, sm) using PyPlot subplot(2, 1, 1) plot(τ, corr) xlabel(L"\tau") ylabel(L"\langle \sigma_+(\tau) \sigma_-(0)\rangle") subplot(2, 1, 2) plot(ω, S) xlabel(L"\omega") ylabel(L"S(\omega)") tight_layout() savefig("spin.svg")
using QuantumOptics b = NLevelBasis(3) t12 = transition(b, 1, 2) t23 = transition(b, 2, 3) t31 = transition(b, 1, 3) H = 10*(t31 + dagger(t31)) J = [1.2*t23, 0.6*t12] psi0 = basisstate(b, 1) T = [0:0.01:10;] tout, psit = timeevolution.mcwf(T, psi0, H, J; seed=2) using PyPlot plot(tout, expect(dm(basisstate(b, 3)), psit), label=L"$|3\rangle$") plot(tout, expect(dm(basisstate(b, 2)), psit), label=L"$|2\rangle$") plot(tout, expect(dm(basisstate(b, 1)), psit), label=L"$|1\rangle$") xlabel("Time") ylabel("Probability") legend() tight_layout() savefig("nlevel.svg")
using QuantumOptics b_spin = SpinBasis(1//2) b_fock = FockBasis(200) sp = sigmap(b_spin) sm = sigmam(b_spin) a = destroy(b_fock) at = create(b_fock) H = sp⊗a + sm⊗at T = [0:0.01:50;] ψ0 = spindown(b_spin) ⊗ coherentstate(b_fock, 6) tout, ψt = timeevolution.schroedinger(T, ψ0, H) using PyPlot plot(tout, expect(1, sp*sm, ψt)) xlabel("Time") ylabel("Spin excitation") tight_layout() savefig("composite.svg")
Besides the above quick start code snippets QuantumOptics.jl comes with an extensive documentation and many detailed examples.
QuantumOptics.jl is open source and hosted on GitHub. All community contributions are very welcome and coordinated by the head developer. If you want to join our effort, fork the repository and send us your pull requests!