Author Topic: plot colors  (Read 4961 times)

0 Members and 1 Guest are viewing this topic.

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
plot colors
« on: September 13, 2012, 17:08 »
i did an LDDOS calculation, and plotted the results using scripts from quantumwise.com, and i get as attached.  I am wondering why the colors are repeating and why there are two bars on the right.  The part of the code where the colors are defined is:
Code
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)
pylab.contourf(X, Y, Z, contour_values)
pylab.colorbar()
attached are plots produced from the same code, but with different Vgs

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #1 on: September 13, 2012, 18:12 »
here is plot at 0.5 v ... what is going on?

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #2 on: September 14, 2012, 00:32 »
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:
Code
			# 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()


Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #3 on: September 14, 2012, 00:34 »
actually in the first one it looks to me as if the LDDOS is being run only on the center section, since the device is n/i/p from left to right, and it looks like there is some band bending ... the configuration given to the LocalDeviceDensityOfStates function is the whole device though .. why does it look like the center section only?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5428
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: plot colors
« Reply #4 on: September 14, 2012, 05:22 »
If you are looping over voltages in the script, then the colorbar() command adds a new colorbar each time. Insert a pylab.clf() (clear figure) after the save statement, and I think it might work better.
« Last Edit: September 14, 2012, 05:24 by Anders Blom »

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #5 on: September 14, 2012, 05:27 »
yes thank you i remember that trick now .. what about the 2nd question .. is lddos only run on the bulk section if given a device as input?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5428
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: plot colors
« Reply #6 on: September 14, 2012, 05:30 »
That is to be expected. Everything ATK computes for devices is in the central region. The electrodes are bulk-like, so if you want to know more about them, you can extract the electrode geometry and compute it's DOS etc separately, as a bulk system.

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #7 on: September 14, 2012, 05:39 »
ok thank you

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #8 on: September 16, 2012, 20:08 »
i am not sure what to make of this .. is it not being plotted correctly?  white is not even in the colorbar ...

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5428
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: plot colors
« Reply #9 on: September 16, 2012, 21:36 »
The plot is constructed such that everything above the maximum is white. The reason for this is that the maximum DOS can be very high, so if the colorscale covers really the range of the DOS values, you don't get a really good resolution of the transition from zero DOS to finite DOS; which is basically the point of the plot (to visualize the band gap).

Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #10 on: September 16, 2012, 21:48 »
so you are thinking that the exactly linear white blue separation is real, and not a mistake somehow? I am surprised you did not say something must be wrong given the picture

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5428
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: plot colors
« Reply #11 on: September 16, 2012, 22:02 »
Either that, or perhaps more likely there are tiny amounts of negative DOS, which then get white also for being outside the color range. Try by setting the minimum to a negative value and see how things change.

I made some changes to the script a while back, to make it easier to play with the colors. My version saves the averaged data, and can read it back in, which only takes a few seconds compared to re-reading all the NC file, which can be quite slow. I have attached this version, you need to scrub it a bit, but I know you are familiar with Python enough by now ;)


Offline esp

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 318
  • Country: us
  • Reputation: 3
    • View Profile
    • University of Minnesota
Re: plot colors
« Reply #12 on: September 16, 2012, 22:07 »
thank you

wouldn't it make sense to just set the colors based on min and max of the actual data, instead of a fixed value?
« Last Edit: September 16, 2012, 22:13 by esp »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5428
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: plot colors
« Reply #13 on: September 16, 2012, 23:05 »
See above :)
Of course you can try, it just made it hard to see the relevant things (the transition from zero to finite DOS) in the cases I tried.
In general there are very many options for the colorscale for this plot, I have played with many different versions, like greyscale, completely custom as in my latest version of the script (courtesy of another customer), inverted grescale. I think each problem will have a different "ideal" colormap.
« Last Edit: September 16, 2012, 23:07 by Anders Blom »