Earthquake Thermodynamics and Phase Transformations in the Earth's Interior