Lowering oxygen vacancies of ZnO nanorods via Mg-doping and their effect on polymeric diode behavior