The **work function** is the minimum thermodynamic work needed to remove an electron from a solid (or surface) to a point in the vacuum. The work function is not a characteristic of a bulk material, but rather a property of the surface of the material. The work function //W// for a given surface is defined by the difference between Fermi level and electrostatic potential in the vacuum: $W = -e\phi - E_f$ where $\phi$ is the electrostatic potential in the vacuum and $E_f$ is the Fermi level of the surface. Those two quantities can be obtained from [[https://manual.cp2k.org/cp2k-2022_1-branch/CP2K_INPUT/FORCE_EVAL/DFT/PRINT/PDOS.html| PDOS]] and [[https://manual.cp2k.org/cp2k-2022_1-branch/CP2K_INPUT/FORCE_EVAL/DFT/PRINT/V_HARTREE_CUBE.html | V_HARTREE_CUBE]]. One can use [[https://www.cp2k.org/tools:cubecruncher | Cubecruncher]] to compute the profile along the normal of the surface to obtained the electrostatic potential of the given surface and vacuum. cubecruncher.x -i input.cube -o output.cube -1d_profile 3 0.001