rht/jlab12s — comment on commit 56d68770ae4a6b4d51e398c146bae281e60e0e5c
File:  line 0
By rht:

The work function W of a metal is closely related to its Fermi energy (defined relative to the lowest energy free particle: zero in the above diagram) yet the two quantities are not exactly the same. This is due to the surface effect of a real-world solid: a real-world solid is not infinitely extended with electrons and ions repeatedly filling every primitive cell over all Bravais lattice sites. Neither can one simply take a set of Bravais lattice sites inside the geometrical region V which the solid occupies and then fill undistorted charge distribution basis into all primitive cells of . Indeed, the charge distribution in those cells near the surface will be distorted significantly from that in a cell of an ideal infinite solid, resulting in an effective surface dipole distribution, or, sometimes both a surface dipole distribution and a surface charge distribution.
It can be proven that if we define work function as the minimum energy needed to remove an electron to a point immediately out of the solid, the effect of the surface charge distribution can be neglected, leaving only the surface dipole distribution. Let the potential energy difference across the surface due to effective surface dipole be . And let be the Fermi energy calculated for the finite solid without considering surface distortion effect, when taking the convention that the potential at is zero. Then, the correct formula for work function is:

Where is negative, which means that electrons are bound in the solid.