- C 97.6%
- C++ 2.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| include | ||
| src | ||
| third_party/imgui | ||
| .gitignore | ||
| CMakeLists.txt | ||
| imgui.ini | ||
| LICENSE | ||
| README.md | ||
Quantum Atom Renderer
Status: not actively maintained. Left up as a reference.
Real-time visualization of hydrogen electron probability clouds using CDF inverse-transform sampling of exact wavefunctions, rendered as glowing point clouds in OpenGL.
What it does
Generates 100,000+ 3D points distributed according to |ψ(r,θ,φ)|² for hydrogen-like orbitals using CDF inverse-transform sampling, then renders them as additive-blended GL_POINTS with a glow fragment shader.
Supports arbitrary quantum numbers (n, l, m) up to n=5, with presets for common orbitals (1s, 2p, 3d, 4f, etc.).
Controls
- Left-drag: Orbit camera
- Scroll: Zoom
- ImGui panel: Change orbital, point count, colors, glow
Build
# Dependencies (Ubuntu/Debian)
sudo apt install libglfw3-dev libglm-dev cmake
# Build
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
# Run
./build/atomsim
Tech Stack
- C++17, OpenGL 3.3 Core Profile
- GLFW — windowing
- GLAD2 — OpenGL loader
- GLM — math (no custom vector types)
- Dear ImGui — parameter UI
- CMake — build system
Physics
Exact hydrogen wavefunctions:
ψ_nlm(r,θ,φ) = R_nl(r) · Y_lm(θ,φ)
where R_nl uses generalized Laguerre polynomials and Y_lm uses associated Legendre polynomials. Points are sampled by inverse-transform sampling of per-axis CDFs: a radial CDF from r²·|R_nl(r)|² and a polar CDF from sin(θ)·|P_l^m(cosθ)|² (so the r² sin(θ) volume element is baked into the PDFs), with the azimuth φ drawn uniformly.
Architecture
| File | Purpose |
|---|---|
src/main.cpp |
Window, render loop, ImGui controls |
src/orbital.cpp |
Wavefunction math + CDF sampling |
src/shader.cpp |
Shader compilation/linking |
src/camera.cpp |
Arcball camera |
src/glad.c |
GLAD2 OpenGL loader |