Work function changes induced by deposition of ultrathin dielectric films on metals: A theoretical analysis