There we go, J. Chem. Educ., 2010, 87 (4), pp 444–448
To summarize, the energy of the 3d orbital is lower than 4s, but only starting with Sc: that's known as
d-orbital collapse (usually explained by imperfect shielding by the core orbitals)
K : 3p << 4s < 4p << 3d
Ca : 3p << 4s < 3d < 4p
Sc+: 3p << 3d < 4s < 4p |
(this continues: the more the nuclear charge, the deeper is 3d under 4s, just not as dramatically). f orbitals similarly collapse after group 3
From this alone, transition elements should be 3d
n4s
0, and that's what they are in real chemistry (in compounds), but ground states of most unbound, neutral transition metal atoms in vacuum have the 4s occupied by one or two electrons because 3d is compact while 4s is diffuse (in a free atom): it becomes energetically favorable to shift one or even two electrons from the 3d shell into the slightly higher energy 4s, where the electronic repulsion is much smaller.
Awesome example from the article: V
+[3d
4] + e
- -> V
0[3d
3][4s
2]
that is known as
d-s electron repulsion. Naturally, as you go to bigger shells, this grows weaker, so out of 9 elements in Y-Ag, 6 don't manage to push the electrons out of 4d to a full 5s
2.
Other factors such as
d-d electron repulsion,
spin-orbit and
spin-spin splitting come into play: Ni is d
9s
1 and the next lowest configuration, d
8s
2 is a whole 100kJ/mol higher, but its lowest term is only 2kJ/mol higher, and spin-orbit splitting makes them overlap by 2 kJ/mol. On heavier atoms, you get relativistic effects in, too.
in compounds, of course, the massively diffuse outer s gets destroyed by the nearby atoms, and all electrons pull back into d, where they belong (even on neutral atoms)