ok modified script to use a fixed range for LDOS values of 0 to 0.02 like on the tutorial ... still looks funny though and i am getting multiple colorbars .. not sure why .. 0, 0.1, and 0.5V Vgs attached ... full plot code below:
# Import list with ldos
# new format
lddos_list = nlread(oList["outFileName"] + "_ldos" + nm + ".nc", LocalDeviceDensityOfStates)
#Find the z-spacing
dX, dY, dZ = lddos_list[0].volumeElement().convertTo(Ang)
dz = dZ.norm()
shape = lddos_list[0].shape()
z = dz * numpy.arange(shape[2])
# calculate average lddos along z for each spectrum
energies = []
lddos_z = []
for lddos in lddos_list:
energies = energies + [lddos.energy().inUnitsOf(eV)]
avg_z = numpy.apply_over_axes(numpy.mean,lddos[:,:,:],[0,1]).flatten()
lddos_z = lddos_z + [avg_z]
# plot as contour plot
# make variables
energies = numpy.array(energies)
X, Y = numpy.meshgrid(z, energies)
Z = numpy.array(lddos_z).reshape(numpy.shape(X))
import pylab
#plot the LDDOS(E, z)
pylab.xlabel('z (Angstrom)',fontsize=12,family='sans-serif')
pylab.ylabel('Energy (eV)',fontsize=12,family='sans-serif')
#contour_values = numpy.linspace(minLDOS,maxLDOS,51)
contour_values = numpy.linspace(0,0.02,51)
pylab.contourf(X, Y, Z, contour_values)
pylab.colorbar()
# find range of z
configuration = nlread(oList["outFileName"], object_id="left")[0]
coords = configuration.cartesianCoordinates().inUnitsOf(Ang)
zmin1 = 1e6
zmax1 = -1e6
for el in coords:
if el[2] > zmax1:
zmax1 = el[2]
if el[2] < zmin1:
zmin1 = el[2]
configuration = nlread(oList["outFileName"], object_id="bulk")[0]
coords = configuration.cartesianCoordinates().inUnitsOf(Ang)
zmin2 = 1e6
zmax2 = -1e6
for el in coords:
if el[2] > zmax2:
zmax2 = el[2]
if el[2] < zmin2:
zmin2 = el[2]
#
zmin = min(zmin1, zmin2)
zmax = 2*(zmax1-zmin1)+(zmax2-zmin2)
pylab.axis([zmin,zmax,minE,maxE])
pylab.title('Device : LDDOS(E, z)')
pylab.savefig(oList["outFileName"] + ".lddos1" + nm + ".png",dpi=150)
#pylab.show()