Quantum mechanics–molecular dynamics approach to the interpretation of x-ray absorption spectra