ParaToric is a C++ package that implements a continuous-time quantum Monte Carlo algorithm for the toric code in a parallel field (aka the extended/perturbed toric code)
where
If you use ParaToric for a publication, please cite Linsel et al., SciPost Phys. Codebases 75 (2026), Linsel et al., SciPost Phys. Codebases 75-r1.0 (2026), and the original algorithm paper Wu et al., Phys. Rev. B 85, 195104 (2012).
We require a C++ compiler (tested with GCC 15 and Clang 20) with C++23 support. Our implementation further requires the Boost (1.87 and above) and HDF5 (1.14.3 and above) libraries. Refer to their website for installation instructions.
If you intend to use our Python scripts, you will need NumPy, matplotlib and h5py.
To compile this project, run the following command:
$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DPARATORIC_ENABLE_NATIVE_OPT=ON -DPARATORIC_LINK_MPI=ON -DPARATORIC_BUILD_CLI=ON
$ cmake --build build -jN
$ ctest --test-dir build -jN --output-on-failure
$ cmake --install build Replace N with the number of cores you want to use, e.g. -j4 for 4 cores.
By default, the executables will be installed in ${CMAKE_SOURCE_DIR}/${CMAKE_INSTALL_BINDIR}/, the header files in ${CMAKE_INSTALL_INCLUDEDIR}/paratoric and the static libraries in ${CMAKE_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}/. By default, CMAKE_INSTALL_PREFIX = CMAKE_SOURCE_DIR, since on a computing cluster users may not have privileges to install software into the usual Linux/Unix folders. The Python scripts that come with this package expect ${CMAKE_SOURCE_DIR}/bin/, this directory always contains the executable paratoric in any case. If you want to install paratoric into a custom directory, pass this directory to CMake using the -DCMAKE_INSTALL_PREFIX flag. E.g., if you wanted to install into /usr/local/, you would use cmake -DCMAKE_INSTALL_PREFIX=/usr/local/ .. instead of cmake ...
There are five ways to use ParaToric. We provide bindings to C/C++/Python and command line interfaces for C++/Python, see documentation. Here we only briefly present the Python command line interface.
A Jupyter notebook for creating SLURM jobscripts is provided.
General Python command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type |
--N_thermalization |
-Nth |
Number of thermalization steps (i.e. proposed updates) |
--N_samples |
-Ns |
Number of samples |
--N_between_steps |
-Nbs |
Number of steps between samples |
--N_resamples |
-Nr |
Number of bootstrap resamples |
--custom_therm |
-cth |
Whether thermalization values of 0 or 1) |
--observables |
-obs |
List of observables, e.g. fredenhagen_marcu percolation_probability energy
|
--seed |
-seed |
Seed for the pseudorandom number generator. 0 means random seed |
--mu_constant |
-muc |
Value of |
--J_constant |
-Jc |
Value of |
--h_constant |
-hc |
Value of |
--h_constant_therm |
-hct |
Thermalization value of |
--lmbda_constant |
-lmbdac |
Value of |
--lmbda_constant_therm |
-lmbdact |
Thermalization value of |
--output_directory |
-outdir |
Output directory |
--snapshots |
-snap |
Whether snapshots should be saved to output directory (0 or 1) |
--full_time_series |
-fts |
Whether full time series should be saved to output directory (0 or 1) |
--processes |
-proc |
Number of (logical) CPU cores for Python multiprocessing |
Lattice specific Python command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--basis |
-bas |
Spin basis (x, z) |
--lattice_type |
-lat |
Lattice type (e.g. square, cubic, triangular, honeycomb, ...) |
--system_size |
-L |
System size (20 will result in |
--temperature |
-T |
Temperature |
--boundaries |
-bound |
Boundary conditions (periodic or open) |
--default_spin |
-dsp |
Default initialization value of spin on edges (1 or -1) |
It is relatively easy to define your own lattices/boundary conditions by adapting the code. Observables may have to be adapted, too! This is especially relevant for all percolation observables and Wilson/'t Hooft loops. Make sure to write appropriate test cases.
This simulation type runs T_steps individual Markov chains for evenly spaced temperatures in the interval T_lower T_upper. It calculates and plots observables for all temperatures. As this task is trivial to parallelize, we advise matching processes = T_steps as closely as possible for optimal runtime.
An exemplary simulation could look like this:
$ python3 ./python/cli/paratoric.py -sim etc_T_sweep -Nbs 8000 -Ns 1000 -muc 1 -Nth 50000 -Tl 0.1 -Tu 10 -Ts 15 -hc 0.5 -Jc 1 -lmbdac 0.2 -Nr 1000 -obs percolation_strength percolation_probability largest_cluster largest_plaquette_cluster string_number energy energy_h energy_mu energy_J energy_lmbda sigma_x sigma_z star_x plaquette_z staggered_imaginary_times delta anyon_count anyon_density fredenhagen_marcu sigma_x_static_susceptibility sigma_x_dynamical_susceptibility sigma_z_static_susceptibility sigma_z_dynamical_susceptibility -bas x -lat square -L 6 -bound periodic -dsp 1 -outdir /your/output/directory Specific Python Command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type (here etc_T_sweep) |
--T_lower |
-Tl |
Lower bound of temperature |
--T_upper |
-Tu |
Upper bound of temperature |
--T_steps |
-Ts |
Number of temperature steps between lower and upper bound |
This simulation type runs h_steps individual Markov chains for evenly spaced fields in the interval h_lower h_upper. It calculates and plots observables for all fields. As this task is trivial to parallelize, we advise matching processes = h_steps as closely as possible for optimal runtime.
An exemplary simulation could look like this:
$ python3 ./python/cli/paratoric.py -sim etc_h_sweep -Nbs 8000 -Ns 1000 -muc 1 -Nth 50000 -hl 0.0 -hu 0.5 -hs 15 -T 0.1 -Jc 1 -lmbdac 0.2 -Nr 1000 -obs percolation_strength percolation_probability plaquette_percolation_probability plaquette_percolation_strength largest_cluster largest_plaquette_cluster string_number energy energy_h energy_mu energy_J energy_lmbda sigma_x sigma_z star_x plaquette_z staggered_imaginary_times delta anyon_count anyon_density fredenhagen_marcu sigma_x_static_susceptibility sigma_x_dynamical_susceptibility sigma_z_static_susceptibility sigma_z_dynamical_susceptibility -bas x -lat square -L 6 -bound periodic -dsp 1 -outdir /your/output/directorySpecific Python Command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type (here etc_h_sweep) |
--h_lower |
-hl |
Lower bound of field |
--h_upper |
-hu |
Upper bound of field |
--h_steps |
-hs |
Number of field steps between lower and upper bound |
This simulation type runs lmbda_steps individual Markov chains for evenly spaced fields in the interval lmbda_lower lmbda_upper. It calculates and plots observables for all fields. As this task is trivial to parallelize, we advise matching processes = lmbda_steps as closely as possible for optimal runtime.
An exemplary simulation could look like this:
$ python3 ./python/cli/paratoric.py -sim etc_lmbda_sweep -Nbs 12000 -Ns 1000 -muc 1 -Nth 100000 -lmbdal 0.1 -lmbdau 0.7 -lmbdas 15 -T 0.1 -hc 0.1 -Jc 1 -Nr 1000 -obs percolation_strength percolation_probability plaquette_percolation_probability plaquette_percolation_strength largest_cluster largest_plaquette_cluster string_number energy energy_h energy_mu energy_J energy_lmbda sigma_x sigma_z star_x plaquette_z staggered_imaginary_times delta anyon_count anyon_density fredenhagen_marcu sigma_x_static_susceptibility sigma_x_dynamical_susceptibility sigma_z_static_susceptibility sigma_z_dynamical_susceptibility -bas z -lat honeycomb -L 6 -bound periodic -dsp 1 -outdir /your/output/directory Specific Python Command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type (here etc_lmbda_sweep) |
--lmbda_lower |
-lmbdal |
Lower bound of field |
--lmbda_upper |
-lmbdau |
Upper bound of field |
--lmbda_steps |
-lmbdas |
Number of field steps between lower and upper bound |
This simulation type runs Theta_steps individual Markov chains on a circle in (lmbda_constant, h_constant)and radius radius for evenly spaced angles in the interval Theta_lower Theta_upper. Angles are measured anti-clockwise relative to the observables for all angles. As this task is trivial to parallelize, we advise matching processes = Theta_steps as closely as possible for optimal runtime.
An exemplary simulation could look like this:
$ python3 ./python/cli/paratoric.py -sim etc_circle_sweep -Nbs 8000 -Ns 1000 -muc 1 -Nth 50000 -lmbdac 0.0 -rad 1.0 -Thl 0 -Thu 1.57 -Ths 30 -T 0.1 -hc 0.0 -Jc 1 -Nr 1000 -obs percolation_strength percolation_probability largest_cluster largest_plaquette_cluster string_number energy energy_h energy_mu energy_J energy_lmbda sigma_x sigma_z star_x plaquette_z staggered_imaginary_times delta anyon_count anyon_density fredenhagen_marcu sigma_x_static_susceptibility sigma_x_dynamical_susceptibility sigma_z_static_susceptibility sigma_z_dynamical_susceptibility -bas x -lat square -L 6 -bound periodic -dsp 1 -outdir /your/output/directory Specific Python Command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type (here etc_circle_sweep) |
--lmbda_constant |
-lmbdac |
Center of the circle ( |
--h_constant |
-hc |
Center of the circle ( |
--radius |
-rad |
Radius of the circle |
--Theta_lower |
-Thl |
Lower bound of angle |
--Theta_upper |
-Thu |
Upper bound of angle |
--Theta_steps |
-Ths |
Number of angle steps between lower and upper bound |
Uses the hysteresis schedule specified in h_hysteresis and lmbda_hysteresis; this is particularly useful in the context of hysteresis near first-order phase transitions. The Markov chains for different parameters are not run in parallel, instead the last state of the previous parameter point will be used as the starting point for the thermalization of the next parameter. This mode will run two Markov chains, one in the original parameter order specified in h_hysteresis and lmbda_hysteresis, and one with a reversed parameter order, i.e., it calculates both branches of the hysteresis loop. It calculates and plots observables for both the original and the reversed parameter order. We advise setting processes = 2.
An exemplary simulation could look like this:
$ python3 ./python/cli/paratoric.py -sim etc_hysteresis -Nbs 5000 -Ns 1000 -muc 1 -Nth 50000 -hhys 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 -T 0.1 -Jc 1 -lmbdahys 0 0 0 0 0 0 0 0 0 0 0 -Nr 1000 -obs percolation_strength percolation_probability largest_cluster largest_plaquette_cluster string_number energy energy_h energy_mu energy_J energy_lmbda sigma_x sigma_z star_x plaquette_z staggered_imaginary_times delta anyon_count anyon_density fredenhagen_marcu sigma_x_static_susceptibility sigma_x_dynamical_susceptibility sigma_z_static_susceptibility sigma_z_dynamical_susceptibility -bas x -lat cubic -L 4 -bound periodic -dsp 1 -outdir /your/output/directory Specific Python Command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type (here etc_hysteresis) |
--lmbda_hysteresis |
-lmbdahys |
Hysteresis schedule for |
--h_hysteresis |
-hhys |
Hysteresis schedule for |
This simulation type performs the thermalization for repetitions individual Markov chains. It calculates and plots observables as well as the Monte Carlo acceptance ratio after every Monte Carlo step, averaged over repetitions. As this task is trivial to parallelize, we advise matching processes = repetitions as closely as possible for optimal runtime.
An exemplary simulation could look like this:
$ python3 ./python/cli/paratoric.py -sim etc_thermalization -muc 1 -Nth 50000 -reps 10 -lmbdac 2 -T 0.1 -hc 0.3 -Jc 1 -Nr 1000 -obs percolation_strength percolation_probability plaquette_percolation_strength plaquette_percolation_probability largest_cluster largest_plaquette_cluster string_number energy energy_h energy_mu energy_J energy_lmbda sigma_x sigma_z star_x plaquette_z staggered_imaginary_times delta anyon_count anyon_density fredenhagen_marcu sigma_x_static_susceptibility sigma_x_dynamical_susceptibility sigma_z_static_susceptibility sigma_z_dynamical_susceptibility -bas x -lat square -L 4 -bound periodic -dsp 1 -outdir /your/output/directory Specific Python Command line options
| Long flag | Short | Description |
|---|---|---|
--help |
-h |
Display help message (lists command line arguments) |
--simulation |
-sim |
Simulation type (here etc_thermalization) |
--repetitions |
-reps |
Number of Markov chains to average over |
This research was funded by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program -- ERC Starting Grant SimUcQuam (Grant Agreement No. 948141), and by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy -- EXC-2111 -- project number 390814868. The project/research is part of the Munich Quantum Valley, which is supported by the Bavarian state government with funds from the Hightech Agenda Bayern Plus. L.P. acknowledges financial support from ANR-23-CE30-0018.
