Adsorption of hydrogen on clean and modified magnesium films