In [33]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [49]:
h2eV=27.21

with open("EL086.log","r") as f:
    lines=f.readlines()
    optcomplete=False
    occorb=[]
    virtorb=[]
    for line in lines:
        if "Optimization completed." in line:
            optcomplete=True
        if optcomplete==True:
            if "Alpha  occ. eigenvalues" in line:
                a=line.split()
                occorb.append(float(a[4]))
            elif "Alpha virt. eigenvalues" in line:
                a=line.split()
                virtorb.append(float(a[4]))
        
occorb=np.array(occorb)*h2eV
virtorb=np.array(virtorb)*h2eV
#print virtorb
plt.ylabel('Energy [eV]')
plt.hlines(occorb,[0],[0.1] ,color="r")
plt.hlines(virtorb,[0],[0.1],color="b")
plt.ylim(-20,+10)
plt.xlim(0,0.11)
plt.tick_params(
    axis='x',          # changes apply to the x-axis
    which='both',      # both major and minor ticks are affected
    bottom='off',      # ticks along the bottom edge are off
    top='off',         # ticks along the top edge are off
    labelbottom='off')

plt.savefig("levels.svg")



In [46]:



<matplotlib.figure.Figure at 0x7f6934058c50>

In [ ]: