Author Topic: Contour plots for VB CB carrier densities  (Read 7492 times)

0 Members and 1 Guest are viewing this topic.

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Contour plots for VB CB carrier densities
« 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?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #1 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!

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #2 on: April 3, 2013, 10:14 »
how to specify the highest valence band in the "cb_plot.py"?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #3 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 :) )

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #4 on: April 5, 2013, 13:13 »
Could you modify the code to give normalized values?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #5 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?

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #6 on: January 20, 2015, 11:14 »
How should this script be modified for a simple orthorhombic unitcell.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #7 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.

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #8 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?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #9 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.

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #10 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

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #11 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.

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #12 on: February 16, 2015, 18:48 »
sending via e-mail  ;D for confidentiality :)

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Contour plots for VB CB carrier densities
« Reply #13 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.

Offline ams_nanolab

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 389
  • Country: in
  • Reputation: 11
    • View Profile
Re: Contour plots for VB CB carrier densities
« Reply #14 on: February 18, 2015, 06:10 »
It's working now, thanks  ;D