3D quantum tunneling simulator with split-operator FFT
A real-time 3D quantum tunneling simulator that solves the time-dependent Schrodinger equation and renders the wavefunction as it passes through potential barriers. Built to understand computational quantum mechanics from the math to the GPU.
The solver uses Strang splitting (split-operator method): half-potential phase, FFT forward, full kinetic phase, FFT inverse, half-potential phase. This second-order symmetric decomposition preserves unitarity exactly -- verified by tests tolerating only 1e-6 norm drift over 1000 steps.
FFTW3 handles 3D fast Fourier transforms with FFTW_MEASURE for runtime-optimized plans. Kinetic and potential phase operators are precomputed once as complex exponentials, so each timestep is three element-wise multiplies plus two FFTs.
Two rendering modes toggled at runtime: marching cubes isosurface extraction (CPU-side triangulation with Phong shading, two-pass glow) and volume raycasting (3D texture upload, GPU raymarching with 1D transfer function). Barrier potentials render as wireframe boxes.
OpenMP parallelism on all N^3 element-wise loops with collapse(3) for k-space precomputation. FFTW itself uses fftw_plan_with_nthreads for threaded transforms.
Four potential types: single barrier, double barrier (resonant tunneling), screened Coulomb with soft-core regularization, and free particle. Complex absorbing potential at boundaries uses quadratic ramp to prevent reflections.
Adaptive quality control: physics steps per frame decrease when FPS drops below 25, increase above 50. Frame export captures PNG sequences for video.