Direct computation of general chemical energy differences: Application to ionization potentials, excitation, and bond energies.