Theoretical study on the reaction of magnesium with water in the gas-phase