#read in the dos object dos = nlread('nio2_lsda.nc',DensityOfStates)[0] #generate some energies energies = numpy.linspace(-5,5,400)*eV #calculate the spectrum n0_up = dos.tetrahedronSpectrum(energies=energies, spin=Spin.Up, projection_list = ProjectionList([0])) n0_down = dos.tetrahedronSpectrum(energies=energies, spin=Spin.Down, projection_list = ProjectionList([0])) e = dos.energies() #do the same for LSDA+U dos_u = nlread('nio2_lsda_u.nc',DensityOfStates)[0] n0_up_u = dos_u.tetrahedronSpectrum(energies=energies, spin=Spin.Up, projection_list = ProjectionList([0])) n0_down_u = dos_u.tetrahedronSpectrum(energies=energies, spin=Spin.Down, projection_list = ProjectionList([0])) #plot the spectrum using pylab import pylab #first plot the up component with dots pylab.plot(e.inUnitsOf(eV), n0_up.inUnitsOf(eV**-1), 'k:',label = 'LSDA') #now plot the down component with negative values and dots pylab.plot(e.inUnitsOf(eV), -1.*n0_down.inUnitsOf(eV**-1), 'k:') #now plot the LSDA+U up components with solid pylab.plot(e.inUnitsOf(eV), n0_up_u.inUnitsOf(eV**-1),'k',label = 'LSDA+U') #now plot the LSDA+U down component with negative values and solid pylab.plot(e.inUnitsOf(eV), -1.*n0_down_u.inUnitsOf(eV**-1),'k') #show legends pylab.legend() pylab.xlabel("Energy (eV)") pylab.ylabel("DOS (1/eV)") pylab.show()