Structural effect on phonon attenuation in metallic liquids and glasses