QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: ams_nanolab on January 17, 2013, 08:19

Title: Contour plots for VB CB carrier densities
Post by: ams_nanolab on January 17, 2013, 08:19
Dear Sir,

Is it possible to make contour plots of conduction band valleys as in

http://arxiv.org/pdf/1201.5284.pdf

http://www.sciencedirect.com/science/article/pii/S0038109812000889

with ATK?
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on February 1, 2013, 11:58
Sure, it's a fun little exercise in Python :)

Attached are 3 scripts which produce the plot also posted. There are endless possibilities for the contour plots, colors, etc, but the key to getting this to work is to set up a regular grid of k-points and compute the band structure for these, then extract the lowest conduction band.

I start with a standard graphene calculation. Then, I run "calc_bs.py" which does the regular sampling. Here you need to edit the number of points, depending on the accuracy of the plot you want.

Then run "cb_plot.py". In this you can play with the axis limited and the color/contour settings on lines 34-38, the rest of the code is more or less generic.

Have fun!
Title: Re: Contour plots for VB CB carrier densities
Post by: ramkrishna on April 3, 2013, 10:14
how to specify the highest valence band in the "cb_plot.py"?
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on April 4, 2013, 05:56
Code: python
cb = [numpy.take(e,numpy.where(e<=0))[0][-1] for e in energies]

(You may want to change the variable name :) )
Title: Re: Contour plots for VB CB carrier densities
Post by: ams_nanolab on April 5, 2013, 13:13
Could you modify the code to give normalized values?
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on April 5, 2013, 16:19
k or E? Normalized to what? Isn't it easier to see what's going on if you have absolute energies?
Title: Re: Contour plots for VB CB carrier densities
Post by: ams_nanolab on January 20, 2015, 11:14
How should this script be modified for a simple orthorhombic unitcell.
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on February 9, 2015, 00:31
It's a lot simpler of course. You don't need the k-point mapping and griddata conversion, just do (from line 14)
Code: python
kx = bs.kpoints()[:,0]
ky = bs.kpoints()[:,1]

Then skip to
Code: python
P.contour(kx,ky,cb,20,colors=['w'])
P.contourf(kx,ky,cb,60,cmap=P.cm.hot)

And, in the other script (to generate the band structure) you can probably reduce the range of k-points to
Code: python
x = numpy.linspace(-1.0,1.0,Nk)

Of course, we are now assuming the kz doesn't matter, i.e. you are working with a 2D material.
Title: Re: Contour plots for VB CB carrier densities
Post by: ams_nanolab on February 13, 2015, 10:52
I modified the script as you said (attached herewith) but I'm getting an error. What I'm doing wrong?
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on February 13, 2015, 11:50
Right, cb is just a long array, it needs to be reshaped to match the k-point grid. Try

cb = cb.reshape(len(ky),len(kx))
(possibly other order of kx and ky, if they are different)

after kx and ky are defined.
Title: Re: Contour plots for VB CB carrier densities
Post by: ams_nanolab on February 16, 2015, 10:55
Still gives error:

Traceback (most recent call last):
  File "c:\users\ams\appdata\local\temp\2211826568161225.py", line 20, in <module>
    cb = cb.reshape(len(kx),len(ky))
ValueError: total size of new array must be unchanged
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on February 16, 2015, 11:45
If your NC file is not too large, can you send it? Should be easy but hard to solve without an example to work on.
Title: Re: Contour plots for VB CB carrier densities
Post by: ams_nanolab on February 16, 2015, 18:48
sending via e-mail  ;D for confidentiality :)
Title: Re: Contour plots for VB CB carrier densities
Post by: Anders Blom on February 17, 2015, 09:08
See attached script, it's a bit different (simpler) since you can directly make the regular grid.

Run as

atkpython orthoplot.py myfile.nc

and if you want to save the plot automatically you can uncomment the last line.
Title: Re: Contour plots for VB CB carrier densities
Post by: ams_nanolab on February 18, 2015, 06:10
It's working now, thanks  ;D