Author Topic: resolution of kx -ky  (Read 7639 times)

0 Members and 1 Guest are viewing this topic.

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
resolution of kx -ky
« on: November 18, 2013, 17:56 »
Dear Sir,
    When I am extracting data from the Transmission Analyzer, I have seen that the resolution of k along kx and ky is not that fine. It is producing kx, ky in a difference of 0.05 only. Is there any way to increase the resolution of the k - resolved transmission at the time of extracting data?

Regards
Ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #1 on: November 19, 2013, 11:15 »
No, you have to recompute the transmission spectrum with more k-points. But you don't have to redo the self-consistent calculation, only the transmission.

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: resolution of kx -ky
« Reply #2 on: November 19, 2013, 19:03 »
Thanks a lot

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: resolution of kx -ky
« Reply #3 on: November 21, 2013, 18:35 »
Dear Sir,
       Is it possible to plot the transmission in log scale in the k-resolved transmission? In the Transmission Analyzer, it is possible make the x and y axis in log scale, not the transmission. If I want transmission in log scale, what should I have to do??

Thanks
Ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #4 on: November 21, 2013, 22:18 »
That's a good question, I think we should add this option for later.

For now, you can do one of two things.

1. You can modify the source code of the TransmissionAnalyzer plugin yourself. On line 241 of AddOns/TransmissionAnalyzer/ContourWidget.py you can change "t" to "numpy.log(t)", then restart VNL. Of course it's rather inconvenient to do this each time, but it's one way. Also be prepared that T=0 will become white (often happens) and the colorbar will map log(t) and not t.

The AddOns directory resides in vnl/lib/site-packages on Windows and vnl/lib/python2.7/site-packages on Linux. As always, make a backup first! If you mess up, you can delete the whole directory TransmissionAnalyzer and download the plugin fresh using Help>AddOn Manager inside VNL.

2. You can play with the attached script, and modify the same statement (contourf) for log-scale.

Edit: Better script below
« Last Edit: November 27, 2013, 23:53 by Anders Blom »

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: resolution of kx -ky
« Reply #5 on: November 22, 2013, 18:33 »
Dear Sir,
      I feel the 2nd option will be convenient right now (as all installations are admin protected :)). But when I am going to run the script then I am facing few problems. When I am running the script as it is with my transmissionSpectrum (.nc file) then I am facing the following the error:

Traceback (most recent call last):
  File "/tmp/4689083423001089.py", line 24, in <module>
    print "Energy = ", T.energies()[energy_index]
  File "./zipdir/NL/CommonConcepts/PhysicalQuantity.py", line 580, in __getitem__
IndexError: index out of bounds

Now, when I set this index as 0 then I am getting the error as below:


Energy =  0.0 eV
Traceback (most recent call last):
  File "/tmp/1889523592497030.py", line 60, in <module>
    pylab.contourf(K_A,K_B,T_uu.transpose(),40,cmap=pylab.cm.Spectral)
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2206, in contourf
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/axes.py", line 7322, in contourf
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/contour.py", line 1106, in __init__
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/contour.py", line 700, in __init__
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/contour.py", line 1119, in _process_args
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/contour.py", line 1166, in _contour_args
  File "./build/atkpython/lib/python2.7/site-packages/matplotlib/contour.py", line 1208, in _check_xyz
TypeError: Length of x must be number of columns in z,
and length of y must be number of rows.


What is this energy index? Is this energy index related with the up spin and down spin? Is there any particular choice for that? Above zero of this energy index value, I am always getting the 1st error massage.


In that script I am seeing only one "t" in the line number 22 as
t = T.transmission()[0][energy_index]

So, if I want this in log scale then will it be like
numpy.log(t) = T.transmission()[0][energy_index]      only??

or will it be like

t = T.transmission()[0][energy_index]
t = numpy.log(t)                                                   ??


As I am getting error without using numpy.log(t) only, so I am not able to go in this steps to check the plot.


Please help.

Thanks
Ramkrishna


 


Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #6 on: November 25, 2013, 15:23 »
The advantage of the script-based solution is that you can easily modify it (esp. if your installation is sysadm administrated). The downside is that you have to know a bit more about the data structures and the Python language. There are two primary things you need to set: the energy index and the k-point sampling. It appears that you maybe only have a single energy in your transmission spectrum, being the Fermi level. Thus, set as you did energy_index = 0. Second, the values you set for Nka and Nkb must match the settings used in the original calculation of the transmission spectrum. This should take care of the errors, and finally you need to do
Code: python
t = T.transmission()[0][energy_index]
t = numpy.log(t)

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: resolution of kx -ky
« Reply #7 on: November 27, 2013, 19:53 »
Dear Sir,
      Thanks for your reply. Now, I got the point of energy index. Now, when I set the energy index and Nka/Nkb perfectly then the script runs well but it prints the " T_uu, T_uu.shape", as zero matrix (without modifying the script for log). Whereas my .nc files gives finite k resolved values in the Transmission Analyzer.

Regards
ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #8 on: November 27, 2013, 23:33 »
Zero size matrix or zero values?

The script is originally designed to plot the results of one particular calculation. It's also a bit old, a few things have changed , namely how we treat spin w.r.t. the objects storage format, and the original application was spin-polarized. Maybe if you can share the NC file with me, I can solve it much easier. Use Dropbox or some other service that can transmit large files without using email.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #9 on: November 27, 2013, 23:53 »
There were lots of issues with the code, sorry about that. I hope I have fixed it now - at least it works for my test example.

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: resolution of kx -ky
« Reply #10 on: December 4, 2013, 19:07 »
Dear Sir,
      Thanks a lot. It works. However my .nc file contains both spin up spin down transmission. But this script only shows the plot for spin up. I was trying to generate for spin down also by modifying "t = T.transmission()[0][energy_index]" by "t = T.transmission()[1][energy_index]". But it gives a blank plot. So, how to modify this script if I want both both spin up and spin down?

One more thing, suppose my transmission data goes from 10^(-5) to 10^(0). Now  I want to plot the transmission in log scale so that it can  show the scale from 10^(-5) to 10^(1). Now if I use  t = numpy.log(t) for the transmission then it prints -ve value for transmission<1. So, what should I do to get the plot in log scale in +ve values like Fig. 1 or Fig 2 in the attached pdf (PHYSICAL REVIEW B 72, 140404R 2005)?

Regards
Ramkrishna
« Last Edit: December 4, 2013, 22:58 by Anders Blom »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #11 on: December 4, 2013, 22:34 »
The way spin is handled is different in ATK 13.8 compared to earlier, but I think the default works the same way, since it is "spin=Spin.All". So actually the way you do it would work - maybe the plot is empty because the transmission is zero?

About the log-scale, it's really just a matter of labels... But getting a logscale colorbar in Pylab is actually really hard, I tried and didn't manage so well - you needs lots of logic and code, and in the end the plot itself is just the same, it's only the colorbar that would change.

Btw, you can't attach copyrighted material here on the Forum.
« Last Edit: December 4, 2013, 23:00 by Anders Blom »

Offline ramkrishna

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 253
  • Country: us
  • Reputation: 5
    • View Profile
Re: resolution of kx -ky
« Reply #12 on: December 4, 2013, 23:04 »
Dear Sir,
      The transmission for spin down is not zero and it is showing nice plot in transmission analyzer in 13.8.

Regards
Ramkrishna

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #13 on: December 4, 2013, 23:14 »
Actually I was wrong - you must do either
t.transmission(Spin.Up)
or
t.transmission(Spin.Down)
to get what you want.

If you actually check the result of t.transmission(), there are 4 components. The 0th element is up+down, and the 3rd is up-down, while the 1st and 2nd are zero because this is a collinear calculation (those elements would be non-zero for noncollinear spin). I think we're missing a clear documentation of this, I'll add more details tomorrow here.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: resolution of kx -ky
« Reply #14 on: December 5, 2013, 10:22 »
So, starting in 13.8, unless you ask for a specific spin component you get "Spin.All". But to support noncollinear spin, "all" doesn't just mean up and down, it means a 4 values. By our convention, the functions return a 4-component array, and the elements of this are [Spin.Sum, Spin.X, Spin.Y, Spin.Z]. The notation is adapted for noncollinear spin; for unpolarized calculations only Spin.Sum is relevant, and for "ordinary" spin-polarized cases Spin.Sum = Spin.Up+Spin.Down and Spin.Z = Spin.Up-Spin.Down as I wrote yesterday. The primary conclusion is, that it's better to ask for the spin components explicitly:
Code: python
t_up = t.transmission(Spin.Up)
t_dn = t.transmission(Spin.Down)