Thermodynamic and kinetic studies of hydrogenenation reaction in magnesium/palladium nanostructures