Interactive GPU-accelerated numerical solutions of the Gross-Pitaevskii equation. Written in C++/CUDA, wrapped in python using SWIG.
The easiest way to get started is to use colab. Here are a few demo notebooks to get started:
For real time rendering, you need a Linux machine with an NVIDIA GPU. Docker makes everything easy. Install nvidia-docker (make sure you have the official NVIDIA drivers). Then, run in your terminal
chmod +x start-condensate.sh
./start-condensate.sh dockerNote: the Leap Motion controller is currently incompatible with Docker. If you want to use the leap motion, replace docker with leap in the above commands. Leave out the command if you want to build locally without docker or leap. For these options, you need to install CUDA 10.0 or greater, the V2 Leap motion SDK for Linux, and a few other requirements that can be gleaned from the Dockerfile.
An overview of the python notebooks inside this repository:
- The Vortex Lattices notebook is a good starting point with rotating gases.
- The Leap motion control notebook lets you interact with a condensate.
In order to run a simple script with an interactive condensate (instead of the notebooks), run python3 scripts/mousetest.py from either your docker container or if you have CUDA, directly in your terminal.
I use a time splitting pseudospectral (TSSP) method to solve the time-dependent GP equation in 2D. See here for more mathematical details. Note that there have been many other implementations of a GP solver.
The spirit of this project is to combine rapid experimentation with raw GPU compute performance. To this end, the heavy lifting is done by the CUDA kernels and C++ objects defined in condensate/core. In order to see the density in realtime, the wavefunction is rendered with an OpenGL pixelbuffer object. Since the rendering is done at the buffer refresh rate (tens of Hz) on the GPU, the performance overhead from the rendering is negligible. Rendering on the GPU is much faster than copying the wavefunction from the GPU to the host (CPU), and then to the disk for visualization. In order to access the C++ methods in a flexible manner, I use SWIG to generate python bindings. These are then called from jupyter notebook, and allows me to use a very simple API to run experiments.
For testing a branch, open the testing notebook under notebooks. You can run the notebook locally or on colab. On colab, go to File/Open notebook. Under 'GitHub' type in the URL of this repository. The testing notebook should be visible in the list. Feel free to add more rigorous tests - this will prevent things from breaking.


