Skip to content

BenjaminDecker/QuantumGameOfLife.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuantumGameOfLife.jl

A classical simulation of the Quantum Game of Life.

Simulate and create beautiful plots of quantum cellular automata, inspired by classical elementary cellular automata. Given some rule from the Wolfram Code, the translation 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 instantiation script is also called from the cli script to make sure everything is set up correctly every time.

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 blinker triple_blinker

Use a superposition of initial state vectors

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

Plot additional measurement information

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

Write to different file formats

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

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 350 --sweeps-per-time-step 10 --plot classical expect sse rounded autocorrelation cbe --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

Use different QCA rules

Provide a Wolfram code via the rule parameter to create quantum analogues to classical elementary cellular automata and compare the results to the classical case. Use a distance of 1 to get equivalents to elementary cellular automata where the rule labels the corresponding Wolfram code.

$ julia cli.jl --show --plot classical expect --distance 1 --rule 108
$ julia cli.jl --show --plot classical expect --distance 1 --rule 30
$ julia cli.jl --show --plot classical expect --distance 1 --rule 150

Use higher distances and extend the Wolfram code to larger numbers

$ julia cli.jl --show --plot classical expect --distance 2 --rule 2266898040

Use periodic boundary conditions

$ julia cli.jl --show --periodic-boundaries

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 so, 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 consecutive executions of the same function.

julia> @time QuantumGameOfLife.start()

julia> @time QuantumGameOfLife.start()

julia> @time QuantumGameOfLife.start("--show --plot classical expect --distance 1 --rule 150")

References

[1] Benjamin Decker. “Creating a Quantum Analogue to an Arbitrary Classical Elementary Cellular Automaton”. en. MA thesis. Technical University of Munich, 2024-10. URL: https://mediatum.ub.tum.de/1756463

About

A Classical Simulation of the Quantum Game of Life

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages