A real-time 3D visualization of hydrogen atom electron orbitals, built in C++ with raylib.
Solves the Schrödinger equation for hydrogen and renders the probability density as a point cloud of up to 500k particles. Each point represents a possible position of the electron — together they form the shape of the orbital.
- Exact radial (associated Laguerre) and angular (associated Legendre) wave functions
- CDF sampling for accurate probability density point clouds
- Custom GPU shader with impostor-sphere lighting and inferno colormap
- Probability current animation for m≠0 orbitals
- Energy level diagram with animated absorption/emission transitions
- Fine structure energy corrections
- Bohr orbit ring overlays
- Orbitals up to n=6, with 6 quick presets
Requires a C++17 compiler and X11 dev headers on Linux. raylib is pulled in as a submodule and gets built automatically on the first run.
sudo apt install build-essential libx11-dev # if you don't have these already
git clone --recursive https://github.com/Albab-Hasan/Physics-Simulation.git
cd Physics-Simulation
make run-atom
Controls are shown on screen (press H to toggle).
- W/S — energy level (n)
- A/D — orbital shape (l)
- Q/E — magnetic number (m)
- 1–6 — orbital presets
- Mouse drag — rotate, Scroll — zoom
- [/] — point size, +/- — animation speed
- P — toggle phase flow, Space — pause
- B — Bohr rings, N — nucleus, X — axes
- F11 — fullscreen, F12 — screenshot
Code follows Google C++ Style Guide.
Inspired by kavan's video on simulating atoms in C++ — his orbital visualizations are what got me interested in building my own version. The physics follows standard quantum mechanics (Griffiths, Introduction to Quantum Mechanics).



