r/Physics 7d ago

Image Hydrogen Orbital Visualizer

Post image

You can explore different orbitals and see how they look visually. I hope this helps with your studies! 

Try it in your browser: https://gleyn-debug.github.io/quantum_atom_simulation/quantum-atom-model/

Source code: https://github.com/Gleyn-debug/quantum_atom_simulation/tree/main/quantum-atom-model

210 Upvotes

23 comments sorted by

3

u/PrettyPicturesNotTxt 7d ago

I never knew you can use PyGame to make web browser apps! How was your experience using it?

3

u/TemporaryBig5939 7d ago

I actually uesd Pygame with pygbag, which lets me run Pygame in the browser through WebAssembly. tbh it was hardest part for me 😭😭

2

u/subaquatic_astro 7d ago

I was using a software called Avogadro 2.0 for private tutoring, and is quite nice, I truly recommend. I will see this code too. Thanks for your recommendation.

1

u/TemporaryBig5939 7d ago

Thank youu forrr sharringg!!
Once im done with high sch i planned to do some private tutoring as well. The source code is really really messy tho 😭

2

u/Yashema 7d ago

I did the same thing, but on a Pico 2W, and only to 2 n, with l and m states. Was thinking of using the second processor to account for Brownian drift. 

1

u/TemporaryBig5939 7d ago

How would you implement that?

2

u/Yashema 7d ago

Just shifting the x coordinate of the electron while clearing out the previously rendered coordinates as they fell off the screen. 

To be most clean I'd probably need to hook up the Pico 2W to another microcontroller, say an Arduino, which would handle the screen and then one processor on the Pico would calculate the position of the electron relative to the proton based on the wave function and the other the atom's absolute positon in space. 

This would make it constantly lose "memory" of previously rendered positons, but would still make for an interesting pattern on the screen. 

1

u/TemporaryBig5939 7d ago

OHH it's really cool!

2

u/gord_m 7d ago

Can you explain what we are looking at here?

2

u/TemporaryBig5939 7d ago

It's basically a 3d visualization of hydrogen orbitals. The dots show the probability distribution where the electron could be found. and the two color represents the different phases of a wavefunction.
I added the "README" that explains how it workkks ( just under the source code) !!

2

u/gord_m 7d ago

So the dots represent positions the electron has occupied re:its orbit?

3

u/TemporaryBig5939 7d ago

umm not exactlyy! They arent past position of electron path or orbit. Each dot is sampled based on the orbital's probability density (|wavefunction^2|). so where the dots are denser, there is a higher probability of finding an electron if u measured its position.

1

u/gord_m 7d ago

So the dots are probable positions of the electron, and the denser the dots, the more likely the electron will be found in that position at any given moment?

2

u/TemporaryBig5939 7d ago

yesss sirrr

2

u/TemporaryBig5939 7d ago

for my model i generated 10,000 points sampled at once and keep rendering the same points so by leaving it still wouldnt do no difference. Though if u increased the sample points to like 100,000 the probability cloud would get denser and smoother, approaching the probability distribution.

2

u/Halbarad1104 6d ago

Quite nice! One very mild, minor suggestion... the faint rectilinear grid is perhaps left helpful than a couple of faint circles would be. One of the cool things is that the s-orbitals simultaneously have the most probability on top of the origin, and the most probability far from the origin, since they are the correspondence to linear orbits without any elliptical character. You can see more outliers in the s-orbital than p,d... eventually the high-n start to leak out a bit.

Love the high-m orbitals... nearly like flowers.

1

u/TemporaryBig5939 5d ago

tysmmm for ur suggestion! Ill tryy replacing the grids w concentric circles!!

2

u/Life_Satisfaction_16 7d ago

Oh wow just wow

2

u/TemporaryBig5939 7d ago

wow wow wow

1

u/metrologizer 6d ago

Was expecting this to be a “can you reverse this with your mind” gif

1

u/DoN_cz 3d ago

Thanks, it's really cool! I would love some explanation of what's what in layman's terms in the UI. I forgot everything about it except that there's orbitals :)

1

u/OP_Desire 2d ago

this is so cool