Hello,
In the system I use two lattices to represent spin up and down.
lat_u = kwant.lattice.honeycomb(a=1, name='up') lat_d = kwant.lattice.honeycomb(a=1, name='down')
When I obtain the scattering wave functions from wf=kwant.wave_function(sys, en), it contains the value for both lat_u and lat_d.
Is that possible to extract the wave function only for lat_u or lat_d?
I tried to separate the wave function based on the odd/even index, but it is not the right sequence.
Thank you in advance.
Regards, Yuhao
Dear Yuhao,
The order of the wavefunction elements is the same as that of the sites. Since you know the order of sites from sys.sites the task becomes very simple.
In the following example, you can check the family of the sites in sys.sites and notice that you have the electrons first and then the holes. The wavefunction order becomes straightforward.
I hope this helps Adel
import kwant from matplotlib import pyplot import numpy as np
def make_system(a=1, W=30, L=20, barrier=1., barrierpos=(3, 8), mu=0.4, Delta=0.1, Deltapos=4, t=1.0): # Start with an empty tight-binding system and two square lattices, # corresponding to electron and hole degree of freedom lat_e = kwant.lattice.square(a, name='e') lat_h = kwant.lattice.square(a, name='h')
sys = kwant.Builder() sys1 = kwant.Builder() sys2 = kwant.Builder() #### Define the scattering region. #### sys1[(lat_e(x, y) for x in range(L) for y in range(W))] = 4 * t - mu sys2[(lat_h(x, y) for x in range(L) for y in range(W))] = mu - 4 * t
# the tunnel barrier sys1[(lat_e(x, y) for x in range(barrierpos[0], barrierpos[1]) for y in range(W))] = 4 * t + barrier - mu sys2[(lat_h(x, y) for x in range(barrierpos[0], barrierpos[1]) for y in range(W))] = mu - 4 * t - barrier
# hoppings for both electrons and holes sys1[lat_e.neighbors()] = -t sys2[lat_h.neighbors()] = t sys+=sys1 sys+=sys2 # Superconducting order parameter enters as hopping between # electrons and holes sys[((lat_e(x, y), lat_h(x, y)) for x in range(Deltapos, L) for y in range(W))] = Delta
#### Define the leads. #### # Symmetry for the left leads. sym_left = kwant.TranslationalSymmetry((-a, 0))
# left electron lead lead0 = kwant.Builder(sym_left) lead0[(lat_e(0, j) for j in range(W))] = 4 * t - mu lead0[lat_e.neighbors()] = -t
# left hole lead lead1 = kwant.Builder(sym_left) lead1[(lat_h(0, j) for j in range(W))] = mu - 4 * t lead1[lat_h.neighbors()] = t
# Then the lead to the right # this one is superconducting and thus is comprised of electrons # AND holes sym_right = kwant.TranslationalSymmetry((a, 0)) lead2 = kwant.Builder(sym_right) lead2 += lead0 lead2 += lead1 lead2[((lat_e(0, j), lat_h(0, j)) for j in range(W))] = Delta
#### Attach the leads and return the system. #### sys.attach_lead(lead0) sys.attach_lead(lead1) sys.attach_lead(lead2)
return sys,sys1,sys2
#I used sys1 and sys2 to help in the 2D-plot sys,sys1,sys2 = make_system()
# Check that the system looks as intended. kwant.plot(sys)
# Finalize the system. sys = sys.finalized()
#sys and sys1 have the same positions of sites
wf=kwant.wave_function(sys,energy=1)
wavefunction=wf(0)[1].reshape(2,-1)# lead number 0, mode number 2
#plot of wf for electrons: kwant.plotter.map(sys1.finalized(),abs(wavefunction[0])**2 )
#plot of wf for holes: kwant.plotter.map(sys1.finalized(),abs(wavefunction[1])**2 )
On Thu, Nov 1, 2018 at 11:15 AM Yuhao Kang ykang1@gradcenter.cuny.edu wrote:
Hello,
In the system I use two lattices to represent spin up and down.
lat_u = kwant.lattice.honeycomb(a=1, name='up') lat_d = kwant.lattice.honeycomb(a=1, name='down')
When I obtain the scattering wave functions from wf=kwant.wave_function(sys, en), it contains the value for both lat_u and lat_d.
Is that possible to extract the wave function only for lat_u or lat_d?
I tried to separate the wave function based on the odd/even index, but it is not the right sequence.
Thank you in advance.
Regards, Yuhao
Hi Yuhao
In the system I use two lattices to represent spin up and down.
lat_u = kwant.lattice.honeycomb(a=1, name='up') lat_d = kwant.lattice.honeycomb(a=1, name='down')
When I obtain the scattering wave functions from wf=kwant.wave_function(sys, en), it contains the value for both lat_u and lat_d.
On 11/01/2018 01:33 PM, Abbout Adel wrote:
Dear Yuhao,
The order of the wavefunction elements is the same as that of the sites. Since you know the order of sites from sys.sites the task becomes very simple.
In the following example, you can check the family of the sites in sys.sites and notice that you have the electrons first and then the holes. The wavefunction order becomes straightforward.
Adel's answer is correct, however I wanted to point out that there's little need to separate internal degrees of freedom onto separate lattices in modern Kwant.
You can define your system much more concisely using matrix-valued onsites, not to mention you can use more advanced functionality such as the kwant.operator module to get spatially resolved spin currents etc.
Historically the only reason to separate internal degrees of freedom (e.g. spin) onto separate lattices was to force Kwant to choose a certain mode basis in the leads, e.g. modes with spin up and spin down, which would mean that the scattering matrix blocks could be more easily interpreted (e.g. reflection from spin up channel into spin down channel). In modern Kwant you can declare that your lead satisfies a certain conservation law (e.g. spin conservation), as illustrated in the documentation [1], which forces Kwant to use a mode basis that is compatible with the conservation law.
For example, if your on-site degrees of freedom are (spin up, spin down) and your lead Hamiltonian conserves spin, then you could declare your lead like so:
sigma_z = np.array([[1, 0], [0, -1]]) lead = kwant.Builder(lead_symmetry, conservation_law=-sigma_z) ...
This will guarantee that each of the lead modes has a well-defined spin, i.e. that a mode wavefunctions are non-zero only on the spin up or spin down degrees of freedom.
Happy Kwanting,
Joe
[1]: https://kwant-project.org/doc/1/tutorial/superconductors
Thank you! That's very helpful.
Best,
yuhao
________________________________ From: Joseph Weston joseph.weston08@gmail.com Sent: Thursday, November 1, 2018 10:22:52 AM To: Abbout Adel; Yuhao Kang; kwant-discuss Subject: Re: [Kwant] Extract wavefunction for one lattice
Hi Yuhao
In the system I use two lattices to represent spin up and down.
lat_u = kwant.lattice.honeycomb(a=1, name='up') lat_d = kwant.lattice.honeycomb(a=1, name='down')
When I obtain the scattering wave functions from wf=kwant.wave_function(sys, en), it contains the value for both lat_u and lat_d.
On 11/01/2018 01:33 PM, Abbout Adel wrote:
Dear Yuhao,
The order of the wavefunction elements is the same as that of the sites. Since you know the order of sites from sys.sites the task becomes very simple.
In the following example, you can check the family of the sites in sys.sites and notice that you have the electrons first and then the holes. The wavefunction order becomes straightforward.
Adel's answer is correct, however I wanted to point out that there's little need to separate internal degrees of freedom onto separate lattices in modern Kwant.
You can define your system much more concisely using matrix-valued onsites, not to mention you can use more advanced functionality such as the kwant.operator module to get spatially resolved spin currents etc.
Historically the only reason to separate internal degrees of freedom (e.g. spin) onto separate lattices was to force Kwant to choose a certain mode basis in the leads, e.g. modes with spin up and spin down, which would mean that the scattering matrix blocks could be more easily interpreted (e.g. reflection from spin up channel into spin down channel). In modern Kwant you can declare that your lead satisfies a certain conservation law (e.g. spin conservation), as illustrated in the documentation [1], which forces Kwant to use a mode basis that is compatible with the conservation law.
For example, if your on-site degrees of freedom are (spin up, spin down) and your lead Hamiltonian conserves spin, then you could declare your lead like so:
sigma_z = np.array([[1, 0], [0, -1]]) lead = kwant.Builder(lead_symmetry, conservation_law=-sigma_z) ...
This will guarantee that each of the lead modes has a well-defined spin, i.e. that a mode wavefunctions are non-zero only on the spin up or spin down degrees of freedom.
Happy Kwanting,
Joe
[1]: https://kwant-project.org/doc/1/tutorial/superconductors