Density functional theory study of the structural and electronic properties of Mg3Bi2 in hexagonal and cubic phases