  Linear-response time-dependent density functional theory (LR-TDDFT) for core
level spectroscopy using standard local functionals suffers from
self-interaction error and a lack of orbital relaxation upon creation of the
core hole. As a result, LR-TDDFT calculated X-ray absorption near edge
structure (XANES) spectra need to be shifted along the energy axis to match
experimental data. We propose a correction scheme based on many body
perturbation theory to calculate the shift from first principles. The
ionization potential of the core donor state is first computed and then
substituted for the corresponding Kohn--Sham orbital energy, thus emulating
Koopmans' condition. Both self-interaction error and orbital relaxation are
taken into account. The method exploits the localized nature of core states for
efficiency and integrates seamlessly in our previous implementation of core
level LR-TDDFT, yielding corrected spectra in a single calculation. We
benchmark the correction scheme on molecules at the K- and L-edges as well as
for core binding energies and report accuracies comparable to higher order
methods. We also demonstrate applicability in large and extended systems and
discuss efficient approximations.
