The role of impurities in the stability of ZnO surfaces