Work Function Calculation with Local Electrostatic Potential On the Wikipedia site, it describes the work function equation as W = -e\phi - Ef, where phi is the electrostatic potential of a vacuum nearby the surface of the material. So my question is, how can I calculate the work function when there is another material in contact with the surface of the material?
 A: Within a solid the electrons reside in energy bands. If we imagine adding electrons to the solid the electrons fill up these bands until the last electron added will have the highest energy. This energy, the energy of the most energetic electron, is called the Fermi energy, though at temperatures greater than absolute zero there is some energy from thermal excitations to be added as well, and the energy of the highest energy electron is called the Fermi level.
Anyhow, the work function is the difference between the Fermi level and the vacuum i.e. it is the energy required to take an electron at the Fermi level and pull it out of the metal into the vacuum.
If you join two solids together then they generally will have different Fermi levels. In that case the energy required to pull an electron out of solid $A$ and into solid $B$ is the difference between the Fermi levels. This is the equivalent of the work function.

In the diagram $W_A$ is the work function of material $A$ and $W_B$ is the work function for material $B$. $W_{AB}$ is the work function for transferring an electron from $A$ to $B$.
Because of the difference in Fermi levels we expect that joining any two conducting solids will cause some movement of the electrons. This happens because electrons in the material with the higher Fermi level can lower their energy by flowing into the material with the lower Fermi level. So electrons flow between the two solids until the resulting charge imbalance balances out the difference in the Fermi levels. This is basically what causes the depletion layer in semiconductor junctions like diodes.
