[I wasn’t sure which forum to post this (Code or Science and Engineering) , so if it is found inadequate due to not being specifically about programming then I will understand completely]
As a personal side project, I have decided to create a python script that displays the electrons in each shell in an atom (when the number of electrons is inputted).
I know this isn’t the scientific category, and that’s not where I’m having an issue. I can do this on pen and paper - my issue is actually implementing this into code.
I briefly explain what I need to do:
As a general rule, the order of filling atomic orbitals is given as n + l, where n refers to the shell number and l represents the orbitals respectively (i.e 1 = s, 2 = p etc).
The lowest sum of n + l value is indicative of which orbital to fill (in ascending order).
(and yes I’m aware there is exceptions to this, such as group 11)
I hope this isn’t seen as spam, but this is what I’m on about:
1(n) + 1(l) = 2(the “1 s” orbital is filled first, as it has the lowest sum value)
2(n) + 1(l) = 3(the “2 s” orbital is filled second, as it has the next lowest sum value)
2(n) + 2(l) = 4(the “2 p” orbital is filled third)
3(n) + 1(l) = 4(the “3 s” orbital is filled next)
3(n) + 2(l) = 5(the “3 p” orbital is filled next)
[THIS IS WHERE THE PATTERN BREAKS]
4(n) + 1(l) = 5, where:
3(n) + 3(l) = 6
Here is a diagram of the above:
https://upload.wikimedia.org/wikipedia/commons/1/15/Aufbau_Principle.png
I was thinking along the lines of a bubble sort function, that essentially does the above, storing the resulting “1 s”, “2 s” etc in a list, which would be representative of the filling pattern.
Thank you so much to anyone who even takes the time to respond at all to this, as conveying this through speech is hard enough, let alone through a keyboard!