Formation of magnesium nitride layers on the Mg(0001) surface by ion implantation