*2.2. Materials Characterizaton*

The crystalline phases of the nanoparticles were characterized by XRD using a Rigaku Ultima III diffractometer (The Woodlands, TX, USA) with Cu Kα (λ = 1.5418 Å) radiation. Powder diffraction files (PDFs) were used to identify characteristic peaks in the XRD patterns. Polytype compositions, crystal size and lattice parameters of XRD patterns were performed using Profex (an open source XRD and Rietveld refinement software, Solothurn, Switzerland) and structure files for phase identification were downloaded from the Crystallography Open Database (COD). The film morphologies were examined using SEM. The experimental Mg doping concentration was quantified using EDX. Nanoparticle size was measured from TEM images from the Delong LVEM5 Benchtop Electron Microscope (Delong TEM, Montreal, QC, Canada) equipped with the Q-Capture Pro 7 software. Hydrodynamic sizes were measured by DLS using a Malvern Zetasizer Nano ZS instrument (Malvern, United Kingdom). The lattice fringe distances were determined from high resolution TEM (HR TEM) images of nanoparticles obtained using a JEOL JEM2100 TEM (Peabody, MA, USA). The elemental compositions and chemical states of the films were analyzed by XPS, using a PHI 5000 Versa Probe II equipped with an Al Kα source and a hemispherical analyzer. XPS data were taken at a 45◦ takeoff angle with a pass energy of 23.5 eV. Optical transmission of the films was characterized by UV-vis over the wavelength range from 178 to 890 nm. The band gap energy was determined from Tauc plots of the UV-vis absorbance data. Film thickness was obtained by ellipsometry at 55◦, 65◦, and 75◦ incident angles over the wavelength range from 280 to 1690 nm. Ionization energy was measured from 4.7 to 5.8 eV with a 0.05 eV energy step using PESA with deuterium lamp intensity at 100 nW. The work function was measured using a KP apparatus (SKP5050, KP Technology) referenced to Au at 5.15 eV.
