First principles thermodynamics of minerals at HP-HT conditions: MgO as a prototypical material