Hydrogen dissociation and diffusion on Ni- and Ti-doped Mg(0001) surfaces