Nonlocality and the energy of alloy formation