Hello All,
Just a quick update that you might find interesting. I have just made this python script that will calculate the bandgap of your system from the *.save directory of a QE calculation. This is pretty straightforward and was created mainly for the new users of this wonderful world of computational material science.
If you are new to python, this is a pretty nifty tutorial on the subject: https://docs.python.org/2/tutorial/
#!/usr/bin/python # Run this command as follows: # ./*.py PREFIX # import xml.etree.ElementTree as ET import glob import sys prefix = sys.argv[1] savedir = prefix + ".save" CBM = 100000 VBM = -100000 for i in glob.glob(savedir + "/K*"): datafile = i + "/eigenval.xml" tree = ET.parse(datafile) root = tree.getroot() eig = root[2].text eig_vec = [s for s in eig.splitlines()] occup = root[3].text occup_vec = [s for s in occup.splitlines()] for j in range(len(occup_vec)): if float(occup_vec[j+1]) == 0: break CBMt = float(eig_vec[j+1]) VBMt = float(eig_vec[j]) if CBMt < CBM: CBM = CBMt if VBMt > VBM: VBM = VBMt print "CBM:\t",CBM*27.211396132 print "VBM:\t",VBM*27.211396132 print "Bandgap:\t",(CBM - VBM)*27.211396132
Happy simulations,
Levi