QEngine C++

Till Heinzel

Scientific Backend Developer

The QEngine C++(short for quantum engine) is (will be) a numerical quantum simulation and optimization library written in the C++ programming language. The library is currently being developed by SAH as part of the process of developing the Quantum Composer.

The library collects previous efforts of simulation and optimization made within the group and will be publicly available, allowing other scientists to benefit from our numerical efforts.
In addition to being used for research, the engine will be available to our game developers, allowing a wide range of possibilities for new and exciting games to come.


At SAH, a lot of code has been written over the years by researchers, students, and game developers, to achieve a variety of goals. Given the diverse backgrounds of people involved in the project, a unified platform did not make much sense: physicists tend to be experts in Matlab or low-level languages such as C or Fortran and write short-lived code for specific purposes. While our game developers are experts at using the Unity game engine and accustomed to writing market-ready code. This leads to a certain amount of duplicate code and turns maintenance into a mess because of the different versions in different languages of the same basic concepts. The QEngine is meant to unravel that mess. It will be a central infrastructure for numerical simulations of quantum mechanics for both state-of-the-art research and new games based on that research. To allow other researchers to benefit from our efforts, the QEngine will be publicly available.


In its first iteration, the QEngine will be able to simulate the 1D-TDSE for single particles, two interacting particles and two- and three-level systems, as well as the 1D Gross-Pitaevskii Equation (GPE) for Bose-Einstein Condensates. This is a considerable increase over previous efforts at SAH, which were focused on single particles. In the future, we wish to expand this to also simulate more general second quantized systems and quantum optics. Efforts are underway to simulate Bose-Hubbard type physics for Bose-Einstein Condensates in optical lattices, relating neatly to our experimental work.

In addition to the efficient simulation of quantum mechanics, the QEngine will contain a suite of optimization-algorithms, allowing for state-of-the-art research in quantum optimal control. This includes the traditional krotov, CRAB and GRAPE-algorithms, as well as newer ones, such as the GROUP-algorithm developed by SAH (and others, independently) and even global optimizations, such as differential evolution and CMA-ES.


We chose to write the QEngine in C++ instead of other languages due to its inherent efficiency which is very much required. Wide applicability is enabling us to use it in many of our projects–from frontline theoretical physics research to new games.

Numerical simulations

Simulating quantum mechanics comes down to solving two equations: the time-independent schrödinger equation

to find eigenstates and -energies, and the time-dependent schrödinger equation (TDSE)

to let states evolve in time. Different methods exist to solve both equations depending on the specific form of the Hamiltonian. Eigenstates and -energies can often be found by simple matrix-diagonalization, but time-evolution is more complicated. One of the methods we use for some of our simulations is the split-step method explained in e.g. quantum optics-notes by Daniel Steck.

For simple Hamiltonians (e.g. in the case of a two-level system, where the Hamiltonian is a 2-by-2 matrix) the TDSE can be solved by direct exponentiation. Another commonly used method for solving partial differential equations is the Crank-Nicolson method.

About the QEngine