Ab initio calculations of MgH 2 , MgH 2 :Ti and MgH 2 :Co compounds