Diffusion and formation energies of adatoms and vacancies on magnesium surfaces