Ab initio study of thermodynamic, structural, and elastic properties of Mg-substituted crystalline calcite.