Optical investigation of the hydrogenation and dehydrogenation mechanisms of evaporated MgNi films