  Inelastic losses in core level x-ray spectra arise from many-body
excitations, leading to broadening and damping as well as satellite peaks in
x-ray photoemission (XPS) and x-ray absorption (XAS) spectra. Here we present a
practical approach for calculating these losses based on a cumulant
representation of the particle-hole Green's function, a quasi-boson
approximation, and a partition of the cumulant into extrinsic, intrinsic and
interference terms. The intrinsic losses are calculated using real-time,
time-dependent density functional theory while the extrinsic losses are
obtained from the GW approximation of the photo-electron self-energy and the
interference terms are approximated. These effects are included in the spectra
using a convolution with an energy dependent particle-hole spectral function.
The approach elucidates the nature of the spectral functions in XPS and XAS and
explains the significant cancellation between extrinsic and intrinsic losses.
Edge-singularity effects in metals are also accounted for. Illustrative results
are presented for the XPS and XAS for both weakly and more correlated systems.
