Electronic and structural properties of oxide spinels: MgAl2O4