Electronic and optical properties of Er doped in AlN