QuantumATK Forum

QuantumATK => Scripts, Tutorials and Applications => Topic started by: Anders Blom on May 13, 2012, 06:17

Title: Hexagonal plot of transmission coefficients
Post by: Anders Blom on May 13, 2012, 06:17
Normally when you plot the k-point resolved transmission, it becomes a square plot of T vs kA and kB (the actual point K=kA*b1+kB*b2 where b1,2 are the reciprocal lattice vectors), because that is how we sample the Brillouin zone.

In the hexagonal case, it is more illustrative to see the plot in the actual Brillouin zone, i.e. as a function of kx,ky in the hexagon. To make that plot is rather challenging because as it turns out, the Monkhorst-Pack regular grid in kA,kB space actually samples points in the 2nd Brillouin zone, which you then have to map back into the first zone. And, there are some tricks needed in matplotlib to get a hexagonal axis plot. But in the end, you can get the attached picture!

The labels K and M have been added afterwards in an image editing program.

The inspiration for this came from PRB 80, 035408 (2009) (http://prb.aps.org/abstract/PRB/v80/i3/e035408).
Title: Re: Hexagonal plot of transmission coefficients
Post by: Roc2019 on April 28, 2020, 04:51
Dear Dr. Blom,

Would you like to update this script for the latest version?   It doesn't work for the 2019.12.sp1 version.

Thank you so much.
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on April 29, 2020, 07:21
Minor changes, but a bit tricky because of deprecation of matplotlib.mlab.griddata
Title: Re: Hexagonal plot of transmission coefficients
Post by: Roc2019 on April 30, 2020, 16:06
Thank you Dr. Blom for your new script.

It works now. However, a strange pic is printed, as shown in the attachment named "pic".
It seems that the new script doesn't need the transmission sprectum and only reads the band structure?   

I just got the band of graphene from input.py and the pic from the new script.

The new script seems only to  print the Fermi surface of CBM or VBM (like the Ferm_ surface.py script in the examples https://docs.quantumatk.com/tutorials/topological_insulator_bi2se3/topological_insulator_bi2se3.html)? not the transmission coefficient?
So, 1 ) Would you like to update the script to plot the transission coefficients in the hexgonal?
     2) Would you like to update the script to plot the spin texture  for the newest version 2019.12.sp1?
    3) It's great if you can also update the script for calculating the topological invariants
   
Thank you so much.
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on May 5, 2020, 08:29
Ok, I didn't notice the original script was for transmission - it is more outdated than the band structure version because nxplot was deprecated already in Matplotlib 1.3. So, more work to update it. But my main problem is actually that I have no good data to test the plot with, I deleted all old "nc" files a long time ago.

Thus, I made a blind attempt to apply the same changes as for band structure - maybe it works, but if not perhaps you can provide me a test HDF5 file with transmission data to experiment on?

The reason for the strange plot is that  you have computed a usual band structure, from G to K to M etc. For this plot you need to get eigenvalues on a regular k-point mesh around the K point (or in the whole zone). The transmission spectrum already has such data, though. I have attached also a script to generate the input data for the band structure plot.

For the other questions, that is outside my expertise, but I understand you are saying the scripts in the tutorial do not work anymore? That should be considered a "bug" and I can report it to have it fixed.
Title: Re: Hexagonal plot of transmission coefficients
Post by: Roc2019 on May 5, 2020, 11:36
Thank you Dr. Blom.
It seems that your script does not work for the new version 2019.12.sp1. 
The attachment is the input and output files for the transmission of graphene obtained by the newest version.
If possible, would you like to test and update the new srcipt to obtain the hexgonal transmission picture using the attachments.

Thank you so much again.
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on May 5, 2020, 20:18
Ooooh, I just missed that print needs to be a function now...!

So the script should technically work now. Using your HDF5 file didn't allow to make a nice plot to show it, because for whatever reason all transmission is zero for all energies and k-points in your example.
 
Title: Re: Hexagonal plot of transmission coefficients
Post by: Roc2019 on May 6, 2020, 03:58
Thank you Dr. Blom.

The new script works now. It is great!!!   :D

Expect you or other experts could update some other scripts for the neweast version 2019.12.sp1,  for examples,
     2) the script to plot the spin texture  for the newest version 2019.12.sp1
    3) the script for calculating the topological invariants
Title: Re: Hexagonal plot of transmission coefficients
Post by: Roc2019 on June 8, 2020, 14:18
Dear Dr. Blom,

Would you like to give the two new files of hexplot.py and transmission_hexplot.py for a spin polarization calculation?   The present version of the both scripts does not work for a spin-resolved calculation.

Thank you very much.
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on June 9, 2020, 09:04
I don't have good test data for that but should be easy by just modifying the nlread around line 48-49 to select the right spin component, no?

If the current code doesn't work, try

t = nlread(ncfile, TransmissionSpectrum)[0]
T = t.transmission(spin=Spin.Up or Spin.Down)[Epoint]
Title: Re: Hexagonal plot of transmission coefficients
Post by: Roc2019 on June 9, 2020, 15:21
Thank you very much, Dr. Blom.  I  get it.   ;)
Title: Re: Hexagonal plot of transmission coefficients
Post by: John Donald Raj on April 18, 2022, 13:25
Dear Dr. Blom,
I tried to run the transmission_hexplot.py to plot the hexagonal transmission plot. But the code is not working for me for the ATK version 2020.09. It will be great if you could you help me to plot the hexagonal transmission plot. I'm attaching my .hdf5 file, which is a spinpolarised transmission file.

Thanking You.
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on June 7, 2022, 02:38
Sorry I don't have such an old version installed on my machine. What is the error?
Title: Re: Hexagonal plot of transmission coefficients
Post by: kartiksamanta on March 21, 2024, 18:45
Dear Anders,

                       Could you please let me know how to extract and write the data points for the kpoint (kx,ky) resolve transmission plot (kx,ky vs T at Fermi energy)  using  your  script transmision_hexaplot.py in a separate file ? If you could modify the script it would be very helpful.
Thanks!

With best,
Kartik
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on March 21, 2024, 21:19
The variables of relevance for this are kx, ky and zi. You can just loop over them and print to a text file in desired format, although I would argue that any analysis or plotting you want to do might be better done in Python...

Code: python
kvalues = ky[0]
for i in range(len(kvalues)):
    for j in range(len(kvalues)):
        print(kvalues[i], kvalues[j], zi[i,j])
Title: Re: Hexagonal plot of transmission coefficients
Post by: kartiksamanta on March 22, 2024, 04:53
Dear Anders,

                   I am having the follwing error while writting the data file,
"File "/util/opt/atk/2022.12/bin/../atkpython/bin/atkpython", line 8, in <module>
    sys.exit(__run_atkpython())
  File "zipdir/ATKExecutables/atkwrappers/__init__.py", line 876, in __run_atkpython
  File "transmission_hexplot-kartik-modified.py", line 105
        for j in range(len(kvalues)):
SyntaxError: invalid character in identifier"

Could you please look into and send me a modified script?

With best,
Kartik
Title: Re: Hexagonal plot of transmission coefficients
Post by: Anders Blom on March 26, 2024, 18:31
Looks like the copy/paste from the webpage uses the null character instead of normal spaces. So just delete all spaces before "for" and "print" and change it to normal spaces.  Or, you can use the little "copy" icon in the code box, that seems to work properly.