Deriving accurate work functions from thin-slab calculations | Synapse