Structural transformation in Mg2NiH4