Allotropic transitions of magnesium nickel hydride (Mg2NiH4)