  Core-level spectra of 1s electrons of elements heavier than Ne show
significant relativistic effects. We combine advances in orbital optimized DFT
(OO-DFT) with the spin-free exact two-component (X2C) model for scalar
relativistic effects, to study K-edge spectra of third period elements.
OO-DFT/X2C is found to be quite accurate at predicting energies, yielding $\sim
0.5$ eV RMS error vs experiment with the modern SCAN (and related) functionals.
This marks a significant improvement over the $>50$ eV deviations that are
typical for the popular time-dependent DFT (TDDFT) approach. Consequently,
experimental spectra are quite well reproduced by OO-DFT/X2C, sans empirical
shifts for alignment. OO-DFT/X2C combines high accuracy with ground state DFT
cost and is thus a promising route for computing core-level spectra of third
period elements. We also explored K and L edges of 3d transition metals to
identify limitations of the OO-DFT/X2C approach in modeling the spectra of
heavier atoms.
