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 
> 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 of `sf`, the scaling factor). In
addition, I call the function with sf=1 so the `sf` by itself

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

2017-09-13 Thread Anton Akhmerov
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  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
> 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 

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, irrespectively of how many nanometers 1 actually 
corresponds to? When I get the lattice 

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

2017-09-10 Thread George Datseris

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, 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 whatever units I choose.

The length argument to the honeycomb lattice is the lattice constant.
Creating a lattice does not change the units of length. The site
positions are then calculated according to the lattice definition, so
a site (i, j) belonging square lattice with a lattice constant a would
have coordinates (a*i, a*j).


Now, is the wavenumber represented in units of `1`, or in units of 1/32.123? If 
I have a value of `k=3` and my `1` corresponds to 1 nanometer, does this value 
of `k` correspond to `3`nm^{-1} or to `3/32.123` nm^{-1} ?

kwant.physics.Bands and kwant.plotter.Bands calculate the spectrum of
a system with a 1D translation invariance as a function of its lattice
wave vector (so, these band structures always have a period of 2*pi).
In other words, they measure momentum in units of inverse period of
the system whose band structure you are calculating. This is different
from kwant.wraparound.plot_2d_bands (introduced in kwant v1.3) that
uses units of inverse length.


What is the input given to the function `bands(k)`, obtained from 
`kwant.physics.Bands` ? Does it have to always be within the interval -pi/2 to 
pi/2 , meaning 

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

2017-09-10 Thread Anton Akhmerov
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, 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 whatever units I 
> choose.

The length argument to the honeycomb lattice is the lattice constant.
Creating a lattice does not change the units of length. The site
positions are then calculated according to the lattice definition, so
a site (i, j) belonging square lattice with a lattice constant a would
have coordinates (a*i, a*j).

> Now, is the wavenumber represented in units of `1`, or in units of 1/32.123? 
> If I have a value of `k=3` and my `1` corresponds to 1 nanometer, does this 
> value of `k` correspond to `3`nm^{-1} or to `3/32.123` nm^{-1} ?

kwant.physics.Bands and kwant.plotter.Bands calculate the spectrum of
a system with a 1D translation invariance as a function of its lattice
wave vector (so, these band structures always have a period of 2*pi).
In other words, they measure momentum in units of inverse period of
the system whose band structure you are calculating. This is different
from kwant.wraparound.plot_2d_bands (introduced in kwant v1.3) that
uses units of inverse length.

> What is the input given to the function `bands(k)`, obtained from 
> `kwant.physics.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
 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