An ab initio study of the electronic properties of magnesium oxide