Direct calculation of energy differences, such as ionization potentials