  For electronic excitations in the ultraviolet and visible range of the
electromagnetic spectrum, the intensities are usually calculated within the
dipole approximation, which assumes that the oscillating electric field is
constant over the whole molecule. For the short wavelengths used in X-ray
spectroscopy, this dipole approximation breaks down and it becomes necessary to
include higher-order contributions. In quantum-chemical approaches to X-ray
spectroscopy, these so-called quadrupole intensities have so far been
calculated by including contributions depending on the square of the
electric-quadrupole and magnetic-dipole transition moments. However, the
resulting quadrupole intensities depend on the choice of the origin of the
coordinate system. Here, we show that for obtaining an origin-independent
theory, one has to include all contributions that are of the same order in the
wave vector consistently. This leads to two additional contributions depending
on products of the electric-dipole and electric-octupole and of the
electric-dipole and magnetic-quadrupole transition moments, respectively. We
have implemented such an origin-independent calculation of quadrupole
intensities in X-ray absorption spectroscopy (XAS) within time-dependent
density-functional theory, and demonstrate its usefulness for the calculation
of metal and ligand K-edge XAS spectra of transition metal complexes.
