Computer coupling of thermodynamics and phase diagrams: the Gadolinium-Magnesium system as an example