Re: [Kwant] Units of density

2018-10-22 Thread Marc Vila
Hi Joseph,


Playing with my code (graphene lattice), I see that if I double my hopping 
parameter, the density in my colourplot is reduced by 2, which makes sense 
according to the units. However I'm not finding any changes when varying either 
the scattering region size or the lattice parameter. I thought that when we 
said volume (or area in my case) it was related to the unit cell volume. Is it 
or is for example the area of the scattering region or something else?


Thanks again for your time.


Marc





Marc Vila Tusell
La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience 
Group
Catalan Institute of Nanoscience and Nanotechnology (ICN2)
Barcelona Institute of Science and Technology (BIST)

Additional information:

http://icn2.cat/en/theoretical-and-computational-nanoscience-group

https://www.researchgate.net/profile/Marc_Vila_Tusell

https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true

https://orcid.org/-0001-9118-421X




From: Joseph Weston 
Sent: Monday, October 22, 2018 11:03 AM
To: Marc Vila; kwant-discuss@kwant-project.org
Subject: Re: [Kwant] Units of density


Hi,


I've found in other threads in the mailing list that the units of current is 
for example (unit of charge)/(hbar/unit of energy) 
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg01100.html). 
Also, the local density of states has units of energy/volume 
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html?<https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html%E2%80%8B>).

The units of local density of states is rather "per energy per volume" (this is 
what is written in the linked message) not "energy per volume". Though


My question is, what is the units of the output of the density operator? Is it 
energy/volume as well?

It is "per energy per volume", as is the local density of states.

If you sum the output of a kwant.operator.Density for all scattering states at 
a given energy and divide the result by 2pi, it will be identical (up to 
numerical precision) to the output of kwant.ldos. I've attached a script that 
illustrates this.


I ask this because intuitively I view it as the square of the wavefunction, but 
it gives me values larger than 1 for each site when there is only 1 mode 
involved (see attached picture) ?so it is not just the probability of findinge 
the electron at that site because this should be maximum 1. I have also noticed 
that the values I get in the colorbar depend on the value of my hopping (e.g. 
case of graphene), but overall I'm not so sure of the units.

The scattering wavefunctions are not normalized over the scattering region, so 
if you sum the absolute square of the wavefunction you will not obtain 1.  The 
lead modes are normalized such that they carry unit current, and the scattering 
wavefunctions are thus normalized in a way that is commensurate with this 
normalization of the lead modes.

In the attached script I also show that the norm of the scattering wavefunction 
over the scattering region is not 1.

Happy Kwanting,

Joe


Re: [Kwant] Units of density

2018-10-22 Thread Marc Vila
?Hi Joseph,


Thank you a lot for the fast and detailed response and the example. Now I 
understand much better.


Kind regards,


Marc




Marc Vila Tusell
La Caixa - Severo Ochoa PhD in the Theoretical and Computational Nanoscience 
Group
Catalan Institute of Nanoscience and Nanotechnology (ICN2)
Barcelona Institute of Science and Technology (BIST)

Additional information:

http://icn2.cat/en/theoretical-and-computational-nanoscience-group

https://www.researchgate.net/profile/Marc_Vila_Tusell

https://www.becarioslacaixa.net/marc-vila-tusell-BI00042?nav=true

https://orcid.org/-0001-9118-421X




From: Joseph Weston 
Sent: Monday, October 22, 2018 11:03 AM
To: Marc Vila; kwant-discuss@kwant-project.org
Subject: Re: [Kwant] Units of density


Hi,


I've found in other threads in the mailing list that the units of current is 
for example (unit of charge)/(hbar/unit of energy) 
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg01100.html). 
Also, the local density of states has units of energy/volume 
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html?<https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html%E2%80%8B>).

The units of local density of states is rather "per energy per volume" (this is 
what is written in the linked message) not "energy per volume". Though


My question is, what is the units of the output of the density operator? Is it 
energy/volume as well?

It is "per energy per volume", as is the local density of states.

If you sum the output of a kwant.operator.Density for all scattering states at 
a given energy and divide the result by 2pi, it will be identical (up to 
numerical precision) to the output of kwant.ldos. I've attached a script that 
illustrates this.


I ask this because intuitively I view it as the square of the wavefunction, but 
it gives me values larger than 1 for each site when there is only 1 mode 
involved (see attached picture) ?so it is not just the probability of findinge 
the electron at that site because this should be maximum 1. I have also noticed 
that the values I get in the colorbar depend on the value of my hopping (e.g. 
case of graphene), but overall I'm not so sure of the units.

The scattering wavefunctions are not normalized over the scattering region, so 
if you sum the absolute square of the wavefunction you will not obtain 1.  The 
lead modes are normalized such that they carry unit current, and the scattering 
wavefunctions are thus normalized in a way that is commensurate with this 
normalization of the lead modes.

In the attached script I also show that the norm of the scattering wavefunction 
over the scattering region is not 1.

Happy Kwanting,

Joe


Re: [Kwant] Units of density

2018-10-22 Thread Joseph Weston
Hi,


> I've found in other threads in the mailing list that the units of
> current is for example (unit of charge)/(hbar/unit of energy)
> (https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg01100.html).
> Also, the local density of states has units of energy/volume
> (https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html​).
>
>

The units of local density of states is rather "per energy per volume"
(this is what is written in the linked message) not "energy per volume".
Though

> My question is, what is the units of the output of the density
> operator? Is it energy/volume as well?
>

It is "per energy per volume", as is the local density of states.

If you sum the output of a kwant.operator.Density for all scattering
states at a given energy and divide the result by 2pi, it will be
identical (up to numerical precision) to the output of kwant.ldos. I've
attached a script that illustrates this.

> I ask this because intuitively I view it as the square of the
> wavefunction, but it gives me values larger than 1 for each site when
> there is only 1 mode involved (see attached picture) ​so it is not
> just the probability of findinge the electron at that site because
> this should be maximum 1. I have also noticed that the values I get in
> the colorbar depend on the value of my hopping (e.g. case of
> graphene), but overall I'm not so sure of the units.
>

The scattering wavefunctions are not normalized over the scattering
region, so if you sum the absolute square of the wavefunction you will
not obtain 1.  The lead modes are normalized such that they carry unit
current, and the scattering wavefunctions are thus normalized in a way
that is commensurate with this normalization of the lead modes.

In the attached script I also show that the norm of the scattering
wavefunction over the scattering region is not 1.

Happy Kwanting,

Joe
import string
import numpy as np
import kwant

def onsite(site, salt):
return kwant.digest.uniform(site.tag, salt=salt)


def hopping(a, b, salt):
c = bytes(a.tag) + bytes(b.tag)
return complex(*kwant.digest.uniform2(c, salt=salt))


lat = kwant.lattice.square(norbs=1)

syst = kwant.Builder()
syst[(lat(i, j) for i in range(10) for j in range(5))] = onsite
syst[lat.neighbors()] = hopping

lead = kwant.Builder(kwant.TranslationalSymmetry((-1, 0)))
lead[(lat(0, j) for j in range(5))] = 4
lead[lat.neighbors()] = -1

syst.attach_lead(lead)
syst.attach_lead(lead.reversed())

syst = syst.finalized()


# Loop over a bunch of realizations of the randomness

params = dict(salt='')
energy = 0.5

for params['salt'] in string.ascii_lowercase:
wf = kwant.wave_function(syst, energy=energy, params=params)
psis = np.array([psi for i in (0, 1) for psi in wf(i)])
norms = np.sum(np.square(np.abs(psis)), axis=1)  # sum over all orbitals
# some norm may be 1 by coincidence, but this is unlikely.
assert not any(np.isclose(norms, 1))

rho = kwant.operator.Density(syst).bind(params=params)
op = sum(rho(psi) for psi in psis) / (2 * np.pi)

ldos = kwant.ldos(syst, energy=energy, params=params)

np.testing.assert_array_almost_equal(op, ldos)


print('all equal!')


Re: [Kwant] Units of density

2018-10-22 Thread Abbout Adel
Dear Marc,

There is no problem in a density of probability being larger than one. In
fact, this doesn’t prevent it from being normalizable. Example: the
probability of the transmission T in random cavities P(T)=1/(2 sqrt(T)) for
T in [0, 1]. This function is normalizable despite the fact that it
diverges near T=0.

Now, for the wavefunction, you should remember that for infinite systems
(open systems) the wavefucntion is not normalizable in the usual way.
In fact, we say that it is normalizable in the sens of Dirac-distributions.
(delta(k-k'))

The unit of your density is therefore 1/a  with 'a' the latice
constant. The hopping 't' and the parameter 'a' are related, that is way,
changing the hopping gives you a different result.
I hope this helps.
Adel


On Mon, Oct 22, 2018 at 9:40 AM Marc Vila  wrote:

> Dear Kwant developers,
>
>
> I've found in other threads in the mailing list that the units of current
> is for example (unit of charge)/(hbar/unit of energy) (
> https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg01100.html).
> Also, the local density of states has units of energy/volume (
> https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html
> ​).
>
>
> My question is, what is the units of the output of the density operator?
> Is it energy/volume as well? I ask this because intuitively I view it as
> the square of the wavefunction, but it gives me values larger than 1 for
> each site when there is only 1 mode involved (see attached picture) ​so it
> is not just the probability of findinge the electron at that site because
> this should be maximum 1. I have also noticed that the values I get in the
> colorbar depend on the value of my hopping (e.g. case of graphene), but
> overall I'm not so sure of the units.
>
>
> Thank you again for your help.
>
>
> Kind regards,
>
>
> Marc
>


-- 
Abbout Adel


[Kwant] Units of density

2018-10-22 Thread Marc Vila
Dear Kwant developers,


I've found in other threads in the mailing list that the units of current is 
for example (unit of charge)/(hbar/unit of energy) 
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg01100.html). 
Also, the local density of states has units of energy/volume 
(https://www.mail-archive.com/kwant-discuss@kwant-project.org/msg00169.html?).


My question is, what is the units of the output of the density operator? Is it 
energy/volume as well? I ask this because intuitively I view it as the square 
of the wavefunction, but it gives me values larger than 1 for each site when 
there is only 1 mode involved (see attached picture) ?so it is not just the 
probability of findinge the electron at that site because this should be 
maximum 1. I have also noticed that the values I get in the colorbar depend on 
the value of my hopping (e.g. case of graphene), but overall I'm not so sure of 
the units.


Thank you again for your help.


Kind regards,


Marc