Structural and electronic properties of iodine-doped anatase and rutile TiO2