Phonon scattering mechanism in thermoelectric materials revised via resonant x-ray dynamical diffraction