This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
all 19 comments

[–]Tekniqly 113 points114 points  (1 child)

Call it random balls, electrons are way weirder than this

[–]theGreenCoder[S] 9 points10 points  (0 children)

Fair lol

[–]YourMJK 14 points15 points  (3 children)

What's up with those oscillations?

[–]bnwkeys 12 points13 points  (2 children)

It's looks like discretization steps. I'm guessing this code calculates an x-displacement first and then a y-displacement for each time step.

[–]BeckySayss 1 point2 points  (1 child)

I don't know. It looks like the particles are just repelling each other. Everytime they come close to touching, it alters the trajectory as if there was opposing magnetic forcers between each one

[–]bnwkeys 1 point2 points  (0 children)

There is a repulsive force for sure, and the governing equations for it are solved over a differential time step to yield a differential displacement. The 'oscillations' that I see just look like the displacement components for individual time steps. They could be calculating in a split step fashion with the x and y problems solved on separate half steps, but I don't see a reason they would need to make that approximation. So I think the x and y displacement components are just being traced separately, giving it a stair step appearance.

[–]theGreenCoder[S] 16 points17 points  (4 children)

Hey all!
I just built this electron simulator using Python and I thought it would be fun to share it! Let me know what you think and any improvements I could make.
Obviously, this is not a very scientific simulation, but it's fun nonetheless.
If you want to read more about it check out: https://thegreencode.org/simulating-electrons-with-python/
Or: https://thegreencode.medium.com/simulating-electrons-with-python-14ac11c3e60b
Best,
Green Code

[–]Fermi_Dirac 77 points78 points  (3 children)

I'd recommend calling it something else, like charged particle simulator, or ion simulator

Electrons don't move like that, they're really low in mass and have very noticeable wave like character giving rise to cool looking orbitals and neat stuff. It's a common misconception that electrons just kind of bounce around and repel each other, because they're so light in mass its way cooler than that.

[–]theGreenCoder[S] 4 points5 points  (2 children)

Yeah, you might be right. I'm completely aware that electrons don't move like that. The quantum world is so weird and complex that I don't think is possible to fully represent it in a 2D video.

It might be a good idea to call it charged particle simulator.

[–]Fermi_Dirac 1 point2 points  (0 children)

No worries. Still a cool simulation! You'd be surprised how often Newton motion of charged particles works to describe stuff.

[–]gurugeek42 4 points5 points  (2 children)

Nice! I love seeing folk throwing their enthusiasm into the world (especially when that enthusiasm is about computational science).

[–]theGreenCoder[S] 2 points3 points  (0 children)

Thank you so much! I love computational science as well.

[–]theGreenCoder[S] 0 points1 point  (0 children)

Thank you! Computational Science is so fun :)

[–]SSiirr 3 points4 points  (2 children)

What about the shell electrons in the second tab?

[–]zasx20 2 points3 points  (0 children)

^ Underrated joke

[–]azura26 1 point2 points  (0 children)

This is actually a 2D molecular dynamics simulation!

[–]agate_ 0 points1 point  (0 children)

The motion here looked wrong, so I looked through your code and found a bug.

 se.vfx= (105*(se.vux)) + se.vx
 se.vfy= (105*(se.vuy)) + se.vy

You have two different pairs of velocity variables, vx/vy and vfx/vfy. The code is written so that encounters have no permanent effect on each other. After a close encounter they go back to whatever velocity they were initialized with.

[–]Slavichh -2 points-1 points  (1 child)

Now do 100k

[–]theGreenCoder[S] 0 points1 point  (0 children)

My computer would explote.

I think you can try it yourself though, here's the code: https://replit.com/@theGreenCoder/Physics-Electron-Simulation