As I know, by DFT, work fucntion is calculated from Ev(Vacuum level) - Ef(fermi energy) = WF
And Vacuum level can be calculated from vacuum region of slab model
fermi energy can get from OUTCAR or DOSCAR
But, as i know, fermi energy is the highest occupied energy of electron in 0K, so this definition is correct for metal, but different for semiconductor.
For calculating work function of semiconductor, I think that I must calculate fermi-dirac distribution to find fermi level of semiconductor, which is the point 1/2 probability.
Is it right? or are there different method?