Simulate Dipole-Dipole Coupled Spin Systems

CollectiveSpins.jl is a numerical framework written in Julia used to simulate quantum systems consisting of spatially distributed spins coupled via dipole-dipole interaction.

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 CollectiveSpins package to Julia, as shown below. We suggest to install the QuantumOptics package as well, as it provides many additional functionalities. Plotting with matplotlib is then enabled by adding the PyPlot package. To install packages, you simply need to start Julia and press the ] key to enter the package manager (see also the Julia docs). Then you can add packages as follows.

|pkg> add CollectiveSpins   # Install CollectiveSpins.jl package
|pkg> add QuantumOptics		# additional QuantumOptics functions
|pkg> add PyPlot	  # Support for matplotlib from within Julia
using CollectiveSpins

# Define geometry of system
N = 20     # Number of spins
a = 0.3   # spin-spin distance
geometry = CollectiveSpins.geometry.chain(a, N)

# Create system consisting of N spins in the defined geometry
e = [0,0,1]   # Quantization axis
system = CollectiveSpins.SpinCollection(geometry, e)

# Initial quantum state
phi = 0.
theta = pi/2
Ψ0 = CollectiveSpins.mpc.blochstate(phi, theta, N)

# Perform time evolution according to master equation
T = [0:0.05:5.;]
tout, ρt = CollectiveSpins.mpc.timeevolution(T, system, Ψ0, dt=0.01)

# Plot  and  expectations values ofr all N spins
using PyPlot
SZ = [CollectiveSpins.mpc.sz(ρ) for ρ in ρt]
SX = [CollectiveSpins.mpc.sx(ρ) for ρ in ρt]

subplot(211)
plot(tout, SZ)
xlabel("Time")
ylabel("SZ")

subplot(212)
plot(tout, SX)
xlabel("Time")
ylabel("SX")

tight_layout()
savefig("example.svg")

CollectiveSpins.jl is developed in Helmut Ritsch's CQED group at the Institute for Theoretical Physics of the University of Innsbruck. The framework was conceived by Sebastian Krämer in 2017/2018. Currently, it is largely maintained and extended by Laurin Ostermann. CollectiveSpins.jl is open source and hosted on GitHub. All community contributions are very welcome. If you want to join our effort, fork the repository and send us your pull requests!