BenjaminDecker / QuantumGameOfLife.jl

A Classical Simulation of the Quantum Game of Life

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QuantumGameOfLife.jl

A classical simulation of the Quantum Game of Life.

Simulate and create beautiful plots of quantum cellular automata, inspired by their classical counterpart. The translation of classical rules into a quantum framework follows the method presented in [1].

Setup

Before running the code for the first time, install all dependencies by running the instantiation script from the project directory

$ cd QuantumGameOfLife.jl/
$ julia instantiate.jl

The script only takes significant time when running for the first time, so it is also called from the cli script to make sure everything is set up correctly.

Usage

List all available parameters with

$ julia cli.jl --help

Create and show a plot

$ julia cli.jl --show

Use different initial state vectors

$ julia cli.jl --show --initial-state triple_blinker

Use a superposition of initial state vectors

$ julia cli.jl --show --initial-state blinker triple_blinker

Plot additional measurement information

$ julia cli.jl --show --plot expect sse rounded cbe

Use different QCA rules

$ julia cli.jl --show --distance 2 --activation-interval 2 3

Write to different file formats

$ julia cli.jl --show --file-formats svg png pdf

Plot the classical evolution and mps bond dimension

$ julia cli.jl --show --plot classical expect bond_dims

Try the TDVP algorithm (This command was used to create the plot at the top)

$ julia cli.jl --show --initial-state single --algorithm tdvp1 --num-cells 33 --max-bond-dim 5 --num-steps 250 --sweeps-per-time-step 10 --plot classical expect sse rounded --step-size 0.4 --file-formats svg

Plots are saved in the plots directory by default, which can be changed with the --plotting-file-path argument. (Make sure to create the specified directory first if it does not already exist.)

$ julia cli.jl --show --plotting-file-path plots2

Work with the REPL

Julia uses a just-in-time compiler which takes extra time when code is executed the first time to compile functions before executing them. Subsequent executions will reuse the compiled functions and run a lot faster, even with different input parameters. However, when using the CLI script, the compiled functions are lost between executions and have to be recompiled every time.

To prevent that, you might want to work from inside the julia REPL, especially if you plan to run many quick simulations.

To do that, make sure that your working directory is the project root directory and open the julia REPL

$ cd QuantumGameOfLife.jl/
$ julia

then include the instantiation file and use the project.

julia> include("instantiate.jl")
julia> using QuantumGameOfLife

Afterwards, you can use the same command line options as with the CLI by passing them to the start function. To see the effect, compare the runtimes of two executions of the same function.

julia> @time QuantumGameOfLife.start("--show --distance 2 --activation-interval 2 3")

julia> @time QuantumGameOfLife.start("--show --distance 2 --activation-interval 2 3")

julia> @time QuantumGameOfLife.start("--show --initial-state blinker --file-formats pdf jpg --plot expect sse rounded")

References

[1] Ney, P. M., Notarnicola, S., Montangero, S., & Morigi, G. (2022). Entanglement in the quantum Game of Life. Physical Review A, 105(1), 012416, DOI: 10.1103/physreva.105.012416

About

A Classical Simulation of the Quantum Game of Life

License:MIT License


Languages

Language:Julia 100.0%