  We analyze theoretically a common experimental process used to obtain the
magnetic contribution to the specific heat of a given magnetic material. In the
procedure, the specific heat of a non-magnetic analog is measured and used to
subtract the non-magnetic contributions, which are generally dominated by the
lattice degrees of freedom in a wide range of temperatures. We calculate the
lattice contribution to the specific heat for the magnetic compounds GdMIn$_5$
(M = Co, Rh) and for the non-magnetic YMIn$_5$ and LaMIn$_5$ (M = Co, Rh),
using density functional theory based methods. We find that the best
non-magnetic analog for the subtraction depends on the magnetic material and on
the range of temperatures. While the phonon specific heat contribution of
YRhIn$_5$ is an excellent approximation to the one of GdCoIn$_5$ in the full
temperature range, for GdRhIn$_5$ we find a better agreement with LaCoIn$_5$,
in both cases, as a result of an optimum compensation effect between masses and
volumes. We present measurements of the specific heat of the compounds
GdMIn$_5$ (M = Co, Rh) up to room temperature where it surpasses the value
expected from the Dulong-Petit law. We obtain a good agreement between theory
and experiment when we include anharmonic effects in the calculations.
