Ab-initio calculation of thermal expansion in solids: principles, methods and some examples of application in the Mg-Si-O system