Direct calculation of energy differences by a common unitary transformation of two model states, with application to ionization potentials