Evolution of the electronic and ionic structure of Mg clusters with increase in cluster size