[Kwant] Mistake on the docstring of `PropagatingModes` ?

2017-10-16 Thread George Datseris

Dear All,

(thanks so much for kwant ;) )

I am wondering whether there is a mistake/typo in the docstring of the 
PropagatingModes object.


The reason is the following: In a simple lead (specifically graphene 
zigzag nanoribbon) at energy that excites 6 modes (only 3 with positive 
derivative dE/dk),
when getting the `PropagatingModes` (either through physics.modes or by 
the Smatrix), and I get the momenta and velocities, it looks like this:


In [35]: modes
Out[35]: 

In [36]: modes.momenta
Out[36]:
array([-2.12874239,  2.0566145 ,  2.06992722,  2.12874239, -2.0566145 ,
   -2.06992722])

In [37]: modes.velocities
Out[37]:
array([-1.91098658, -2.24527103, -1.66541483,  1.91098658, 2.24527103,
    1.66541483])


Now, the docstring of Propagating modes states:


The first half of the
modes have negative velocity, the second half have positive velocity. The
modes with negative velocity are ordered from larger to lower momenta, the
modes with positive velocity vice versa.
However, this is not what I see. The first half, with negative velocity, 
is clearly sorted from smaller to bigger momenta, while the second half 
(with positive velocity) is sorted from bigger to slower momenta. This 
is the exact opposite of the docstring.


Thus I am writing this mail to see if I have misunderstood something or 
if this is simply a typo mistake.


Best,
George



[Kwant] Understanding the scaling of the energy and wavenumber units of measurement

2017-09-08 Thread George Datseris
how can I get the
   bands in eV versus nm^{-1} ?

I would also like to comment that the documentation string of `bands()` 
would solve all of these questions by only having 2 more sentences in 
it. The sentences that answer questions 2-3-4 would probably be enough. 
I am sure that the answers to my questions are almost trivial, but after 
many hours of trying to understand what is going on, I am not so 
confused that I had to ask. So, sorry in advance for the very easy question!


Best,
George Datseris

MPI For Dynamics & Self-Organization



Re: [Kwant] Understanding the scaling of the energy and wavenumber units of measurement

2017-09-13 Thread George Datseris

Dear Anton and Kwant team,

I have an important update: the energy becomes correct (in eV) if I 
multiply its values by sqrt(3).


This makes no sense to me and I really cannot understand why I have to 
multiply the energy by sqrt(3) to get the correct number in eV versus 
nanometers^{-1}.


It is important to know the following: a=0.142 is the *carbon-carbon* 
distance in graphene


lc = a*sqrt(3) is the lattice constant of the graphene (honeycomb lattice).

If I assume that the argument passed to honeycomb() *is lc and NOT a*, 
and if I assume that the argument given to the hoppings is -t (with t 
being 2.8 eV), then I should be getting the energy dispersion (dirac 
cone) to be of the value:


E = (3/2)*(lc/sqrt(3))*t , in eV

and this value is assympotically approximated by the bandstructure of an 
armchair nanoribbon for small energies.


This is *not the result *of kwant.physics.Bands however!!! I need to 
multiply the result of Bands() with sqrt(3) to get the correct values in eV.


Is this a bug or something missing from the documentation strings / 
documentation page? Or is it simply something I have understood wrongly? 
Because so far I have been following the documentation and what Anton 
said in his previous answer.


Best,
George


On 10-Sep-17 5:59 PM, George Datseris wrote:


Dear Anton,

Thank you for your kind reply, I really appreciate any help given!

From your answer:


The unit of energy everywhere is the same as the one you use when
defining the Hamiltonian.
This does not correspond with what is returned by 
`kwant.physics.Bands`, or I am doing some trivial mistake I cannot 
see. That is because the numbers do not correspond to what they should 
be if they were eV versus nm^{-1}. The following is the simplest code 
I could possibly imagine:


```python
a = 0.142 #inter-carbon distance in nm
lc = sqrt(3)*a #lattice constant in nm
t = 2.8 #hopping in eV

W = 50 #width in UNSCALED lattice constants, as if sf=1. (multiply by 
lc to get it in nm)

sf=1

def bandstructure(sf):  #sf = scaling factor

    glat = kwant.lattice.honeycomb(sf) #sf*la for lattice constant in nm
    A, B = glat.sublattices
    # create a lead pointing downwards (easy with pre-defined honeycomb)
    def leadshape(pos): #set leads width
    x, y = pos
    return (0 <= x < W)

    sym_lead_vertical = 
kwant.TranslationalSymmetry(glat.vec((-1*sf,2*sf)))

    armchair = kwant.Builder(sym_lead_vertical)
    armchair[glat.shape(leadshape, (0, 0))] = 0  #onsite energy is 0 
for undoped graphene.
    armchair[glat.neighbors()] = -1/sf   #hopping. use t/sf for value 
in eV


    bands = kwant.physics.Bands(armchair.finalized())
    wavenums = np.linspace(-pi/10 , pi/10, 41)

    #To get energy in eV (for any scaling factor) I do:
    energies = [bands(k)*(t) for k in wavenums]

    # Rescale the wavevectors so that it is measured in nm instead of 
lattice constants

    wavenums /= sf*lc

    # plot dirac dispersion first:
    pyplot.plot(wavenums, (3/2)*a*t*wavenums, color="black", 
linestyle="dashed")
    pyplot.plot(wavenums, -(3/2)*a*t*wavenums, color="black", 
linestyle="dashed")

    # plot armchair dispersion:
    pyplot.plot(wavenums, energies)
    pyplot.xlabel(r"Wavevector [nm$^{-1}$]", family = "serif")
    pyplot.ylabel(r"Energy [eV]", family = "serif")
    pyplot.xlim(-0.4, 0.4)
    pyplot.ylim(-0.2, 0.2)
bandstructure(sf)
```
yet the band structure it plots is wrong (see image at the end of the 
email). It is not contained within the (correct) Dirac cone, as it 
should. If I understand your statement correctly, the line ` energies 
= [bands(k)*(t) for k in wavenums]` should give me the energy in eV, 
irrespectively of how big the hopping is. (i.e. irrespectively of the 
value of `sf`, the scaling factor). In addition, I call the function 
with sf=1 so the `sf` by itself should influence nothing.


This code is extremely simple, yet there is obviously something wrong 
with it. The problem is that I cannot understand what it is wrong, 
precisely because the code is so simple! I simply plot the energy 
versus the wavevector, but I do it in units of eV and nm^{-1}...



The dirac cone is correct, as I have compared even with published 
papers, but the dispersion for the armchair is incorrect (should be 
contained within the dirac cone for such low energies).


I am sorry that my issue is not solved after your answer, but I would 
appreciate any input that can make me understand why the armchair 
dispersion is not contained within the Dirac cone...


Best,
George

On 10/09/2017 03:51, Anton Akhmerov wrote:

Dear George,

What does not make any assumptions about the units, leaving the
interpretation entirely up to you.


Which is the unit of measurement of length? I always thought that it is simply 
`1`! If I write `honeycomb(32.123)` is the unit of measurement of length still 
`1` or does it become 32.123, irrespec

Re: [Kwant] Understanding the scaling of the energy and wavenumber units of measurement

2017-09-13 Thread George Datseris

Dear Anton,

Now I understand.

The k values must not be in the units of the lattice constant, but in 
units of the period of the Unit cell of the nanoribbon.


For the armchair nanoribbon, it just so happens that this periodicity is 
sqrt(3) times the graphene lattice constant, meaning that simply 
dividing the wavevectors by sqrt(3) does the trick.


Thanks I am so happy I finally understand what is going on!

best,
George


On 13-Sep-17 12:35 PM, Anton Akhmerov wrote:

Dear George,

It isn't the energy scale that varies, but rather the momentum. It is 
important to remember that the k-values are in the units of the 
inverse period of the system whose band structure you are computing.


Best,
Anton

On Wed, Sep 13, 2017 at 12:31 PM, George Datseris 
<george.datse...@ds.mpg.de <mailto:george.datse...@ds.mpg.de>> wrote:


Dear Anton and Kwant team,

I have an important update: the energy becomes correct (in eV) if
I multiply its values by sqrt(3).

This makes no sense to me and I really cannot understand why I
have to multiply the energy by sqrt(3) to get the correct number
in eV versus nanometers^{-1}.

It is important to know the following: a=0.142 is the
*carbon-carbon* distance in graphene

lc = a*sqrt(3) is the lattice constant of the graphene (honeycomb
lattice).

If I assume that the argument passed to honeycomb() *is lc and NOT
a*, and if I assume that the argument given to the hoppings is -t
(with t being 2.8 eV), then I should be getting the energy
dispersion (dirac cone) to be of the value:

E = (3/2)*(lc/sqrt(3))*t , in eV

and this value is assympotically approximated by the bandstructure
of an armchair nanoribbon for small energies.

This is *not the result *of kwant.physics.Bands however!!! I need
to multiply the result of Bands() with sqrt(3) to get the correct
values in eV.

Is this a bug or something missing from the documentation strings
/ documentation page? Or is it simply something I have understood
wrongly? Because so far I have been following the documentation
and what Anton said in his previous answer.

Best,
George


On 10-Sep-17 5:59 PM, George Datseris wrote:


Dear Anton,

Thank you for your kind reply, I really appreciate any help given!

From your answer:


The unit of energy everywhere is the same as the one you use when
defining the Hamiltonian.

This does not correspond with what is returned by
`kwant.physics.Bands`, or I am doing some trivial mistake I
cannot see. That is because the numbers do not correspond to what
they should be if they were eV versus nm^{-1}. The following is
the simplest code I could possibly imagine:

```python
a = 0.142 #inter-carbon distance in nm
lc = sqrt(3)*a #lattice constant in nm
t = 2.8 #hopping in eV

W = 50 #width in UNSCALED lattice constants, as if sf=1.
(multiply by lc to get it in nm)
sf=1

def bandstructure(sf):  #sf = scaling factor

    glat = kwant.lattice.honeycomb(sf) #sf*la for lattice
constant in nm
    A, B = glat.sublattices
    # create a lead pointing downwards (easy with pre-defined
honeycomb)
    def leadshape(pos): #set leads width
    x, y = pos
    return (0 <= x < W)

    sym_lead_vertical =
kwant.TranslationalSymmetry(glat.vec((-1*sf,2*sf)))
    armchair = kwant.Builder(sym_lead_vertical)
    armchair[glat.shape(leadshape, (0, 0))] = 0 #onsite energy is
0 for undoped graphene.
    armchair[glat.neighbors()] = -1/sf   #hopping. use t/sf for
value in eV

    bands = kwant.physics.Bands(armchair.finalized())
    wavenums = np.linspace(-pi/10 , pi/10, 41)

    #To get energy in eV (for any scaling factor) I do:
    energies = [bands(k)*(t) for k in wavenums]

    # Rescale the wavevectors so that it is measured in nm
instead of lattice constants
    wavenums /= sf*lc

    # plot dirac dispersion first:
    pyplot.plot(wavenums, (3/2)*a*t*wavenums, color="black",
linestyle="dashed")
    pyplot.plot(wavenums, -(3/2)*a*t*wavenums, color="black",
linestyle="dashed")
    # plot armchair dispersion:
    pyplot.plot(wavenums, energies)
    pyplot.xlabel(r"Wavevector [nm$^{-1}$]", family = "serif")
    pyplot.ylabel(r"Energy [eV]", family = "serif")
    pyplot.xlim(-0.4, 0.4)
    pyplot.ylim(-0.2, 0.2)
bandstructure(sf)
```
yet the band structure it plots is wrong (see image at the end of
the email). It is not contained within the (correct) Dirac cone,
as it should. If I understand your statement correctly, the line
` energies = [bands(k)*(t) for k in wavenums]` should give me the
energy in eV, irrespectively of how big the hopping is. (i.e.
irrespectively of the value 

Re: [Kwant] Understanding the scaling of the energy and wavenumber units of measurement

2017-09-10 Thread George Datseris
hysics.Bands` ? Does it have to always be within the interval -pi/2 to 
pi/2 , meaning that it is always expected in units of 1/lattice const. 
irrespectively of which are the units of measurement of the wavenumber?

The input to bands does not have to be within that interval, but it is
measured in the units of the inverse period of the system, indeed.


What is the unit of energy, that is returned by the function `bands()`? Does it 
depend on the value that I give to the hopping, or it depends on how I define 
`1` ? E.g. when I write `armchair[glat.neighbors()] = -1/sf` is the unit of 
energy internally defined to be `1` or `1/sf` ??? It cannot possibly be the 
latter, because I could also assign some number to the on-site potential. So it 
must be the first, right? But then, how do you answer my question number 4:

Given that I know the length of the lattice constant in nanometers,
and I know the energy of the hopping value in eV, how can I get the
bands in eV versus nm^{-1} ?

The unit of energy everywhere is the same as the one you use when
defining the Hamiltonian.

I hope the above answers help.

Best,
Anton

On Fri, Sep 8, 2017 at 3:12 PM, George Datseris
<george.datse...@ds.mpg.de> wrote:

Hello,

I am having significant trouble understanding which are the units of
measurement of the energy and the wavenumber when using kwant and when using
different lattice constants.

I am trying to reproduce the results of the (probably well-known paper)
"Scalable Tight Binding Model for Graphene", Phys. Rev. Lett. 114, 036601
(2015).

I have read the answers to another question
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00069.html)
but I simply cannot understand which is the actual unit of measurement used
internally so I can translate those to nanometers and electronVolts. Even
though I have realized how I can translate internal wavenumbers into
nanometers^{-1}, I cannot understand how and why to use properly
kwants.physics.Bands().

Here is the minimal code that captures my problems:
```python
import kwant
from matplotlib import pyplot

a = 0.142 #inter-carbon distance in nm
lc = sqrt(3)*a #lattice constant in nm
t = 2.8 #hopping in eV

W = 200 #width in UNSCALED lattice constants, as if sf=1. (multiply by lc to
get it in nm)

def bandstructure(sf):  #sf = scaling factor

 glat = kwant.lattice.honeycomb(sf) #sf*la for lattice constant in nm
 A, B = glat.sublattices
 # create an armchair lead
 def leadshape(pos): #set leads width
 x, y = pos
 return (0 <= x < W)

 sym_lead_vertical = kwant.TranslationalSymmetry(glat.vec((-1*sf,2*sf)))
 armchair = kwant.Builder(sym_lead_vertical)
 armchair[glat.shape(leadshape, (0, 0))] = 0  #onsite energy is 0 for
Dirac
 armchair[glat.neighbors()] = -1/sf   #hopping. use t/sf for value in eV

 #function that gives the bands (energies) at a given wave vector:
 bands = kwant.physics.Bands(armchair.finalized())

 #The wavenumbers are measured in units of 1/lattice_const.
 #that is why they only need to go from -pi to pi (Bloch):
 wavenums = np.linspace(-pi/10 ,pi/10, 41)

 #I now want to get the energies, measured in eV. How
 energies = [bands(k/sf)*(t/sf) for k in wavenums] # doesn't work no
matter what I change!

 pyplot.figure(figsize=(6,8))

 # Rescale the wavevectors so that it is measured in nm instead of
lattice constants
 wavenums /= sf*lc #this works correctly

 # plot dirac dispersion first:
 pyplot.plot(wavenums, (3/2)*a*t*wavenums, color="black") #this works
correctly!

 # The band structure does not work.
 pyplot.plot(wavenums, energies)
 pyplot.xlabel(r"Wavevector [nm$^{-1}$]", family = "serif")
 pyplot.ylabel(r"Energy [eV]", family = "serif")
 pyplot.xlim(-0.4, 0.4)
 pyplot.ylim(-0.2, 0.2)

bandstructure(1)

```

 From previous answers, I cannot understand what corresponds to the "the
distance units that I have chosen". I have chosen here the distance units
such that `lc -> 1`. When I am creating the lattice with the command
honeycomb(sf), are my distance units still `lc` or are they now `lc*sf` ?

Notice that the above `bandstructure()` should give similar results
independently of scaling factor (see the paper for details on why).
Therefore, the only problem that may remain is the scaling of energy and/or
wavenumber. Let me summarize my questions as clearly as possible, to help
you giving me an easy answer:

Which is the unit of measurement of length? I always thought that it is
simply `1`! If I write `honeycomb(32.123)` is the unit of measurement of
length still `1` or does it become 32.123, irrespectively of how many
nanometers 1 actually corresponds to? When I get the lattice sites, I know
that they are assumed (i,j) TIMES the lattice constant, so the actual unit
of distance  is still (i,j)*32.123*1, and `1` corresponds to w

[Kwant] Direction of wavevector of kwant.physics.Bands?

2017-11-11 Thread George Datseris

Hello,

Let's say I have a system, and a lead attached to the left side of the 
system extending to infinity towards the left.


As far as kwant is concerned, the translation invariance vector for the 
lead points towards the left, i.e. in /negative/ x direction.


Now I call `kwant.physics.Bands` or equivalently `kwant.plotter.bands` 
on this lead.


I get a plot of the energy bands, with the wavevector ranging from -π to 
+π , in units of inverse lattice constants of the lead.


My question is the following: What does the positive x-axis of this plot 
correspond to? Does positive wavevector in this plot correspond to 
/positive/ x-direction (opposite to the lead translational vector) or to 
/negative/ x-direction, in parallel with the lead translational vector?


I know that e.g. incoming modes must have negative group velocity, but 
this doesn't answer my question, since I am using a graphene zigzag 
lead, which means that I have negative group velocities for both 
positive and negative wavevectors.


Also, I have checked the following documentations trying to answer my 
question:


 * kwant.physics.Bands
 * PropagatingModes
 * FAQ of development documentation page
 * kwant.plotter.band
 * |kwant.physics.||modes|

|It is still unclear to me whether in my case, positive wavevector 
corresponds to the positive x-direction of my system or the negative 
x-direction of my system, due to the lead convention.


If this is stated clearly somewhere in the kwant documentation, please 
excuse me for not finding it, and be kind enough to point me there.


P.S.: I need this because I am trying to calculate from which graphene 
"valley" each incoming mode belongs to. If the k_x wavevector of the 
incoming valley is postive, then it has valley pseudo-spin ξ=1, but I 
have to know whether my "positive wavevector" and the lead's positive 
wavevectors are the same or opposite.


Best regards,
George Datseris
|