A new class of density functionals, based on the energy-dependence of the electronic self-energy