  Complex oxide functionality, such as ferroelectricity, magnetism or
superconductivity is often achieved in epitaxial thin-film geometries. Oxygen
vacancies tend to be the dominant type of defect in these materials but a
fundamental understanding of their stability and electronic structure has so
far mostly been established in the bulk or strained bulk, neglecting interfaces
and surfaces present in a thin-film geometry. We investigate here, via density
functional theory calculations, oxygen vacancies in the model system of a
SrMnO$_3$ (SMO) thin film grown on a SrTiO$_3$ (STO) (001) substrate.
Structural and electronic differences compared to bulk SMO result mainly from
undercoordination at the film surface. The changed crystal field leads to a
depletion of subsurface valence-band states and transfer of this charge to
surface Mn atoms, both of which strongly affect the defect chemistry in the
film. The result is a strong preference of oxygen vacancies in the surface
region compared to deeper layers. Finally, for metastable oxygen vacancies in
the substrate, we predict a spatial separation of the defect from its excess
charge, the latter being accommodated in the film but close to the substrate
boundary. These results show that surface and interface effects lead to
significant differences in stability and electronic structure of oxygen
vacancies in thin-film geometries compared to the (strained) bulk.
