Atomic World
- 4 Devlogs
- 6 Total hours
Simulating atoms in my own way.
Simulating atoms in my own way.
So I looked into it a bit, and now I know that the Cornell Potential didn’t work correctly for the nuclei, because well, the Cornell potential is meant for quarks, which is also why I have no decided to already switch over to working with quarks, because I get more enoyment out of that now, and it is something I planned on doing anyway.
I have also added 3D simulation, so I can see how stuff acts there.
And also, I’ve added a minimal distance, because stuff always got too close, and the force got close to infinity because of 1/x, so now everything that is too close, just doesn’t interact.
I have now implemented a strong force, I did that by using the Cornell potential and it’s derivative:
V(r) = -(a/r) + ro
F(r) = -(a/r^2) - o (Derivative!)
It took me a bit to both find that formula, and to try understand it, but now I think I understand it good enough.
But I do think I have to change some stuff, because the neutrons and protons like do not stop at all, and I think the electrons shouldn’t be affected the way they are, but I think the reason for both might be that the derivative is bad? I don’t really know, I don’t know how derivatives work.
It took me a little, but now I’ve added interaction between the different particles, to reflect their charges, based on Coulomb’s Law:
F = k * q_1 * q_2 / d^2
Where k is the coulomb constant, q the charges of the particles in coulombs (a unit) and d the distance between the particles.
Whether a particle is a proton, neutron or electron, is based on their index in the positions array, modulo 3:
colors[index % 3];
charge[index % 3];
But the reason it took me a bit is, because I tried to change the coulomb constant in a way so that when q is of the unit e (elemental charge) instead of in coulombs and the distance d in fm instead of in m (1fm = 10^-15), it still is correct. But I struggled a bit, until eventually I found the problem, I forgot to account for the fact that d is squared, meaning the 10^15 I was working with, where supposed to be 10^30, so as soon as I fixed that, it finally worked like it should.
Next thing to do, is to imitate the strong force, so the protons can stay together.
So in this project I’m going to simulate atoms, while probably trying to stay somewhat physically accurate.
I’m going to start of by simply simulating particles that are either Protons, Neutrons or Electrons, that have a certain charge. Later I’m planning on making it so each of them is made out of three quarks, with their corresponding charges, which hopefully adds more realism.
Right now, I already have made it so I can see the different particles, and only have to add the logic behind it.