This is an atom.
As you observe, it has a central core formed of neutrons and protons. But they are also surrounded by tiny particles called electrons. These particles are arranged in different electron layers called shells.
Most textbox images of atoms are static, so there’s a common subconscious misconception that atoms are static.
That’s far from reality. Both in the nucleus and especially in the electrons shells. The atoms that form us are in constant movement 24/7. They don’t stop.
So, in an attempt to help visualize this constant movement of electrons I decided to simulate them in Python.
As you might know, while protons have a positive charge, electrons have a negative charge.
Therefore, they attract each other.
The opposite happens if you bring two electrons together; they repel each other.
There is also something to take into account here. In both cases, electrons and protons affect each other in proportion to the distance between each other. In other words, the force they exert on each other is proportional to their distance.
So, if two electrons are far away from each other, they will barely notice the presence of the other.
But, if there’s another electron close enough, things change. Remember electrons disgust each other, so when one sees that an electron is close by, he’ll go “Yuck this disgusting electron is really close to me, let’s get the hell out of here”. And so they go in completely opposite directions.
All of these rules were gracefully summarized in 1785 by Charles-Augustin de Coulomb. So this became known as Coulomb’s law:
So simple, right?
(sorry if that was a bit boring, but now comes the fun part)
Using Python to simulate electrons
You can do a ton of things using python, but one of my favourite ones is drawing. Using some libraries (Turtle, for example) you can do a lot of cool stuff. Like this for example:
Pretty cool, eh?
Well, why don’t we use that to simulate electrons?
I started off trying to simulate two electrons. This is how it went.
You might be thinking “that’s pretty boring” and that’s because it is.
I decided to spice things up a bit and give initial velocity to each electron. This way the two electrons might bump more into each other and produce more exciting patterns.
I also coded it so that electrons would bump into imaginary walls since that would contain them in a confined space.
But there’s a problem with this; it’s not realistic at all. Although electrons change their paths when they encounter a fellow electron, they pretty much continue as if nothing.
This is really because we need more electrons! Only when more electrons are present do more complex patterns start to form.
The problem with adding more electrons is the number of calculations you need to perform.
When we had only two electrons, there was only one interaction between electrons. When you have 7 electrons, there are 21 interactions. And when you have 50 electrons, there are 1225 interactions. You get the gist, right?
So, at every point of the script, I calculate the interactions between a particular electron and all of the others. And then calculate how that electron should move next.
And volià! This is what I got!
I lied to you
Although the results are very cool (in my opinion, let me know what you think), there are obviously not realistic. In fact, basic textbook images of atoms don’t really make justice to their real chaotic nature.
This is what an atom truly looks like.
This is because nothing is certain in the quantum world. For example, it is physically impossible to know the position and the velocity of an electron at the same time. Think about how crazy that is.
That’s why in the photo above, electrons are represented by areas where they could be.
Electrons can be at two places at the same time. So, there’s also that.
Last updated: March 12, 2022
What do zebras and cholesterol have in common?
It’s not straightforward
Why papercuts won’t kill you
Clue: Without it, you’d be dead right now