# QEngine

The QEngine is a numerical quantum simulation and optimization library written in the C++ programming language. The library is currently being developed as part of the process of creating the Composer.

The library collects previous efforts of simulation and optimization and will be publicly available, allowing other scientists to benefit from our numerical efforts.

In addition to being used for research, QEngine will be available to students and developers, allowing a wide range of possibilities for new and exciting projects to come.

### Background

A lot of code has been written over the years by researchers and students, to achieve a variety of goals. Given the 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 our data scientists are experts in Python and R. This leads to a certain amount of duplicate code and makes maintenance harder. The QEngine is meant to solve this issue by providing a common library with a simple API. It will be a central infrastructure for numerical simulations of quantum mechanics for state-of-the-art research. To allow other researchers to benefit from our efforts, the QEngine will be publicly available.

### Features

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 versions, 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 quantum optimal control. This includes the traditional Krotov, CRAB and GRAPE-algorithms, as well as newer ones, such as the GROUP-algorithm and even global optimizations, such as differential evolution and CMA-ES.

### Code

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 areas of our frontline theoretical physics research.

### Numerical simulations

Simulating quantum mechanics comes down to solving two equations. First, the time-independent Schrödinger equation to find eigenstates and -energies:

$$\hat{H} \Psi = E \Psi$$

Second, the time-dependent Schrödinger equation (TDSE) to let states evolve in time:

$$\hat{H} \Psi (r, t) =i \hbar \frac{\partial }{\partial t} \Psi (r, t)$$

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.