Electronic configurations

Question P2.5.12

The electron configuration of an atom is the specification of the distribution of its electrons in atomic orbitals. An atomic orbital is identified by a principal quantum number, $n = 1,2,3,\cdots$ defining a shell comprised of one or more subshells defined by the azimuthal quantum number, $l=0,1,2,\cdots{n-1}$. The values $l=0,1,2,3$ are refered to be the letters $s$, $p$, $d$, and $f$ respectively. Thus, the first few orbitals are: 1s ($n=1, l=0$), 2s ($n=2, l=0$), 2p ($n=2, l=1$), 3s ($n=3, l=0$), and each shell has $n$ subshells. A maximum of $2(2l+1)$ electrons may occupy a given subshell.

According to the Madelung rule, the $N$ electrons of an atom fill the orbitals in order of increasing $n+l$ such that whenever two orbitals have the same value of $n+l$, they are filled in order of increasing $n$. For example, the ground state of Titanium ($N=22$) is predicted (and found) to be $1s^22s^22p^63s^23p^64s^23d^2$.

Write a program to predict the electronic configurations of the elements up to Rutherfordium ($N=104$). The output for Titanium should be

Ti: 1s2.2s2.2p6.3s2.3p6.4s2.3d2

A Python list containing the element symbols is here: element_symbols.py

As a bonus exercise, modify your program to output the configurations using the convention that the part of the configuration corresponding to the outermost closed shell, a noble gas configuration, is replaced by the noble gas symbol in square brackets, thus:

Ti: [Ar].4s2.3d2

the configuration of Argon being 1s2.2s2.2p6.3s2.3p6.


To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.