pw2gap: Quick Homo/Lumo gap check for QE

In order to check the Homo/Lumo gap from a Quantum Espresso (pw.x) calculation it is possible to plot the Density Of States and estimate the distance of empty states around the Fermi level (E=0), but what about if we only want a numerical (accurate) value?
This can be done very quick with “pw2gap” script, which can be downloaded from here.

It goes trough all the eigenvalues at the end of the output, including the case of spin-polarization (spin up/down) and k-points, and it simply prints the energies of the HOMO and LUMO orbitals as well as, of course, the difference between them. As simple as that.

It looks like this (for the example of the wustite):

user> pw2gap.py -o pwout
HOMO= 9.4503 LUMO= 11.5898 eV
H/L GAP = 2.1395