A systematic first-principles study of surface energies, surface relaxation and Friedel oscillation of magnesium surfaces