examples/Hydrogen/README.md
This project simulates the electron probability distribution of a hydrogen atom's 1s orbital using Monte Carlo sampling. The data streams over UDP for real-time visualization in Serial Studio.
It's not a classical orbit model. Instead, it shows probabilistic electron positions derived from quantum mechanics, as a dynamic 3D cloud.
This project uses features that need a paid license. See serial-studio.com for details.
The electron's radial distance from the nucleus, r, is sampled from the 1s orbital probability distribution:
$$ P(r) \propto r^2 \cdot e^{-2r / a_0} $$
Where:
Electron positions are computed in spherical coordinates, then converted to Cartesian $$(x, y, z)$$.
Each UDP frame contains five comma-separated values:
x, y, z, psi2, r
Where:
x, y, z: electron position in Cartesian coordinates (in units of $$a_0$$).psi2: probability density $$\psi^2(r) = |\psi(r)|^2$$.r: radial distance from the nucleus (in units of $$a_0$$). The project maps only the first four columns; r provides spatial context.Example:
-0.283291,0.453772,0.125448,0.038142,0.621987
The script needs Python 3.6 or later and uses only the standard library.
Hydrogen.ssproj project file in Serial Studio.The project includes a control loop that launches hydrogen.py automatically when you connect, so there is nothing to start by hand. The input source is preconfigured as UDP on local port 9000. To run the generator yourself instead, start python3 hydrogen.py before connecting.
3D Visualization). The live electron cloud in space, driven by the X, Y, and Z datasets.Probability Density). The ψ² dataset plotted against X, showing spatial density.hydrogen.py: Python script for simulation and UDP streaming.Hydrogen.ssproj: Serial Studio project file.README.md: project documentation.doc/screenshot.png: screenshot of the visualization.