Simulating Electrons with Python

I used Python to simulate electrons interacting with each other

Green Code


This is an atom.

Image by the author of 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.

Coulomb’s law

As you might know, while protons have a positive charge, electrons have a negative charge.

Therefore, they attract each other.

Image by the author of Coulomb's Law.

The opposite happens if you bring two electrons together; they repel each other.