Access to eigenvalue, eigenvector and number of points in each unit cell
Dear all, I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian. Is there any one to help me and let me know if it is possible in kwan to access them. Best wishes, Sajad
Hi Sajad,
Dear all,
I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian.
Is there any one to help me and let me know if it is possible in kwan to access them.
Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom. It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure. Posting a complete code example is useful because it is more precise than describing your problem with words. Happy Kwanting, Joe
Dear Joseph Weston, yes you are right. "I am trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom." We know according to the nanoribbon, we have a scattering region that is attached to the leads. I want to find the number of kwant site (which I mentioned as atom) in the scattering region (which I mentioned as unit cell). Please look at the following example for the graphene nanoribbon: import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath import matplotlib d=1.42; a1=d*math.sqrt(3) t=3.033; latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder() #................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d syst[latt.shape(rectangle, (1,1))]=0 syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t ax=kwant.plot(syst); sym = kwant.TranslationalSymmetry(latt.vec((5,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)]) lead = kwant.Builder(sym) def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d lead[latt.shape(lead_shape, (1,1))] = 0 lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst); def plot_bands(syst): fsys = syst.finalized() plt.figure() kwant.plotter.bands(fsys.leads[0], args=(dict(gamma=1., ep=0.),)) plt.xlabel("K") plt.ylabel("band structure (eV)") plt.ylim((4.0,4.0)) plt.show() plot_bands(syst) Here we have a main region such that the whole system can be made by repeating this region. I want to know the number of site in the main region. "It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure." When we plot the band structure, we have a Hamiltonian (the dimension is N*N) in terms of K point. So, we have N eigenvalues for each K point. How we can find these eigenvalues for each K point. How is it shown in Kwant? Would you please help me. Best, Sajad From: "Joseph Weston" <joseph.weston08@gmail.com> To: "Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir>, kwantdiscuss@kwantproject.org Sent: Thursday, Aban 30, 1398 3:59:57 PM Subject: Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell Hi Sajad, Dear all, I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian. Is there any one to help me and let me know if it is possible in kwan to access them. Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom. It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure. Posting a complete code example is useful because it is more precise than describing your problem with words. Happy Kwanting, Joe
Dear Sajad, Getting the number of sites in the central system is easy in kwant. sysf= syst.finalized() Sites= list(sysf.sites) #list of all the sites in the scattering region number_of_sites=len(Sites). Getting the Hamiltonian of the central system is also straightforward: H=sysf.hamiltonian_submatrix() I want just to stress that the eigenvalues of this Hamiltonian have nothing to do with the band structure. In fact, to get the band structure, you need the hamiltonian H0 of the unit cell in the lead and the hopping matrix V between two unit cells. With the help of the Bloch theorem, the band can be obtained by diagonalizing: H0+V*exp(+ik)+V^\dagger *exp(ik) for all your k points. ps: (H and H0 may be different depending on how you define your system!) I hope this helps. Adel On Sat, Nov 23, 2019 at 1:09 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir> wrote:
Dear Joseph Weston,
yes you are right.
"I am trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom."
We know according to the nanoribbon, we have a scattering region that is attached to the leads. I want to find the number of kwant site (which I mentioned as atom) in the scattering region (which I mentioned as unit cell).
Please look at the following example for the graphene nanoribbon:
import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath
import matplotlib d=1.42; a1=d*math.sqrt(3) t=3.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder()
#................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d
syst[latt.shape(rectangle, (1,1))]=0
syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t
ax=kwant.plot(syst);
sym = kwant.TranslationalSymmetry(latt.vec((5,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)])
lead = kwant.Builder(sym)
def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d
lead[latt.shape(lead_shape, (1,1))] = 0
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t
syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst);
def plot_bands(syst): fsys = syst.finalized()
plt.figure() kwant.plotter.bands(fsys.leads[0], args=(dict(gamma=1., ep=0.),)) plt.xlabel("K") plt.ylabel("band structure (eV)") plt.ylim((4.0,4.0)) plt.show() plot_bands(syst)
Here we have a main region such that the whole system can be made by repeating this region. I want to know the number of site in the main region.
"It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure."
When we plot the band structure, we have a Hamiltonian (the dimension is N*N) in terms of K point. So, we have N eigenvalues for each K point. How we can find these eigenvalues for each K point. How is it shown in Kwant? Would you please help me.
Best,
Sajad
*From: *"Joseph Weston" <joseph.weston08@gmail.com>
*To: *"Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir>, kwantdiscuss@kwantproject.org *Sent: *Thursday, Aban 30, 1398 3:59:57 PM *Subject: *Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell
Hi Sajad,
Dear all,
I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian.
Is there any one to help me and let me know if it is possible in kwan to access them.
Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom.
It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure.
Posting a complete code example is useful because it is more precise than describing your problem with words.
Happy Kwanting,
Joe
 Abbout Adel
Dear Adel, Thank you for your response. I am trying to use your Instructions for finding all site in the scattering region and also finding eigenvalu but I can not. That is very kind of you if you send me a short example of these problem. Would you please? Best regard Sajad From: "Abbout Adel" <abbout.adel@gmail.com> To: "Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir> Cc: "kwantdiscuss" <kwantdiscuss@kwantproject.org> Sent: Saturday, Azar 2, 1398 7:21:58 PM Subject: Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell Dear Sajad, Getting the number of sites in the central system is easy in kwant. sysf= syst.finalized() Sites= list(sysf.sites) #list of all the sites in the scattering region number_of_sites=len(Sites). Getting the Hamiltonian of the central system is also straightforward: H=sysf.hamiltonian_submatrix() I want just to stress that the eigenvalues of this Hamiltonian have nothing to do with the band structure. In fact, to get the band structure, you need the hamiltonian H0 of the unit cell in the lead and the hopping matrix V between two unit cells. With the help of the Bloch theorem, the band can be obtained by diagonalizing: H0+V*exp(+ik)+V^\dagger *exp(ik) for all your k points. ps: (H and H0 may be different depending on how you define your system!) I hope this helps. Adel On Sat, Nov 23, 2019 at 1:09 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir > wrote: Dear Joseph Weston, yes you are right. "I am trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom." We know according to the nanoribbon, we have a scattering region that is attached to the leads. I want to find the number of kwant site (which I mentioned as atom) in the scattering region (which I mentioned as unit cell). Please look at the following example for the graphene nanoribbon: import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath import matplotlib d=1.42; a1=d*math.sqrt(3) t=3.033; latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder() #................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d syst[latt.shape(rectangle, (1,1))]=0 syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t ax=kwant.plot(syst); sym = kwant.TranslationalSymmetry(latt.vec((5,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)]) lead = kwant.Builder(sym) def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d lead[latt.shape(lead_shape, (1,1))] = 0 lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst); def plot_bands(syst): fsys = syst.finalized() plt.figure() kwant.plotter.bands(fsys.leads[0], args=(dict(gamma=1., ep=0.),)) plt.xlabel("K") plt.ylabel("band structure (eV)") plt.ylim((4.0,4.0)) plt.show() plot_bands(syst) Here we have a main region such that the whole system can be made by repeating this region. I want to know the number of site in the main region. "It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure." When we plot the band structure, we have a Hamiltonian (the dimension is N*N) in terms of K point. So, we have N eigenvalues for each K point. How we can find these eigenvalues for each K point. How is it shown in Kwant? Would you please help me. Best, Sajad From: "Joseph Weston" < joseph.weston08@gmail.com > To: "Saj.ZiaBorujeni" < saj.ziaborujeni.sci@iauctb.ac.ir >, kwantdiscuss@kwantproject.org Sent: Thursday, Aban 30, 1398 3:59:57 PM Subject: Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell Hi Sajad, Dear all, I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian. Is there any one to help me and let me know if it is possible in kwan to access them. Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom. It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure. Posting a complete code example is useful because it is more precise than describing your problem with words. Happy Kwanting, Joe  Abbout Adel
Dear Sajjad, The documentation of kwant is very rich and explains all these requirements with multiple examples. Please have a thorough look at those examples. The requested code is below. I hope this helps, Adel import kwant from numpy import * lat=kwant.lattice.square() sys=kwant.Builder() def pot(site, V): return V sys[(lat(x,y) for x in range(5) for y in range(5))]=pot sys[lat.neighbors()]=1 sym_lead = kwant.TranslationalSymmetry((1, 0)) lead = kwant.Builder(sym_lead) lead[(lat(0,y) for y in range(5))]=0 lead[lat.neighbors()]=1 sys.attach_lead(lead) kwant.plot(sys) sysf=sys.finalized() Sites=list(sysf.sites) Sites_pos=[site.pos for site in Sites] #getting the positions for example H=sysf.hamiltonian_submatrix(params=dict(V=5)) On Mon, Dec 2, 2019 at 9:41 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir> wrote:
Dear Adel,
Thank you for your response. I am trying to use your Instructions for finding all site in the scattering region and also finding eigenvalu but I can not. That is very kind of you if you send me a short example of these problem. Would you please?
Best regard
Sajad *From: *"Abbout Adel" <abbout.adel@gmail.com> *To: *"Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir> *Cc: *"kwantdiscuss" <kwantdiscuss@kwantproject.org> *Sent: *Saturday, Azar 2, 1398 7:21:58 PM *Subject: *Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell
Dear Sajad,
Getting the number of sites in the central system is easy in kwant.
sysf= syst.finalized()
Sites= list(sysf.sites) #list of all the sites in the scattering region
number_of_sites=len(Sites).
Getting the Hamiltonian of the central system is also straightforward:
H=sysf.hamiltonian_submatrix()
I want just to stress that the eigenvalues of this Hamiltonian have nothing to do with the band structure. In fact, to get the band structure, you need the hamiltonian H0 of the unit cell in the lead and the hopping matrix V between two unit cells. With the help of the Bloch theorem, the band can be obtained by diagonalizing:
H0+V*exp(+ik)+V^\dagger *exp(ik) for all your k points.
ps: (H and H0 may be different depending on how you define your system!)
I hope this helps.
Adel
On Sat, Nov 23, 2019 at 1:09 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir> wrote:
Dear Joseph Weston,
yes you are right.
"I am trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom."
We know according to the nanoribbon, we have a scattering region that is attached to the leads. I want to find the number of kwant site (which I mentioned as atom) in the scattering region (which I mentioned as unit cell).
Please look at the following example for the graphene nanoribbon:
import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath
import matplotlib d=1.42; a1=d*math.sqrt(3) t=3.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder()
#................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d
syst[latt.shape(rectangle, (1,1))]=0
syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t
ax=kwant.plot(syst);
sym = kwant.TranslationalSymmetry(latt.vec((5,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)])
lead = kwant.Builder(sym)
def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d
lead[latt.shape(lead_shape, (1,1))] = 0
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t
syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst);
def plot_bands(syst): fsys = syst.finalized()
plt.figure() kwant.plotter.bands(fsys.leads[0], args=(dict(gamma=1., ep=0.),)) plt.xlabel("K") plt.ylabel("band structure (eV)") plt.ylim((4.0,4.0)) plt.show() plot_bands(syst)
Here we have a main region such that the whole system can be made by repeating this region. I want to know the number of site in the main region.
"It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure."
When we plot the band structure, we have a Hamiltonian (the dimension is N*N) in terms of K point. So, we have N eigenvalues for each K point. How we can find these eigenvalues for each K point. How is it shown in Kwant? Would you please help me.
Best,
Sajad
*From: *"Joseph Weston" <joseph.weston08@gmail.com>
*To: *"Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir>, kwantdiscuss@kwantproject.org *Sent: *Thursday, Aban 30, 1398 3:59:57 PM *Subject: *Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell
Hi Sajad,
Dear all,
I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian.
Is there any one to help me and let me know if it is possible in kwan to access them.
Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom.
It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure.
Posting a complete code example is useful because it is more precise than describing your problem with words.
Happy Kwanting,
Joe

Abbout Adel
 Abbout Adel
Dear Adel, At first I thought that we can make scattering region and then attached it to the lead. But now I understant that scattering region depends on the symetry vector. Am I right? Please look at my code: import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath #import scipy.linalg as la import matplotlib d=1.42; a1=d*math.sqrt(3); #onsite energy................................................... t=3.033; latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder() #................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d syst[latt.shape(rectangle, (1,1))]=0 def delet(pos): x, y = pos z=x**2+y**2 return z<(1*a1)**2 del syst[latt.shape(delet, (1,1))] #nearest neighbors............................................................. syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t ax=kwant.plot(syst); ax.savefig('syst1.pdf') sym = kwant.TranslationalSymmetry(latt.vec((4,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)]) lead = kwant.Builder(sym) def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d lead[latt.shape(lead_shape, (1,1))] = 0 def delet_lead(pos): x, y = pos z=x**2+y**2 return z<(1*a1)**2 del lead[latt.shape(delet_lead, (1,1))] lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst); ax.savefig('syst.pdf') fsys = syst.finalized() Sites= list(fsys.sites) #list of all the sites in the scattering region number_of_sites=len(Sites) In the abovementioned code, the line with green color is a shape we constructe as scattering region and the line with pink color is a shape that kwant constructe according to the symmetry vector and attached leads. When we look at to the both shapes and also the number of their sites (they are saved as pdf format) the scattering region made by us is different by scattering region made by kwant (with lead). Is there any way that both scattering regions will be same? according to the fsys = syst.finalized() Sites= list(fsys.sites) #list of all the sites in the scattering region number_of_sites=len(Sites) kwant code gives us the number of sites of the scattering region in terms of the line with pink color. I need in the scattering region just have one hole like in the shape according to the line with green color. That is very kind of you if you help me. Best, Sajad From: "Abbout Adel" <abbout.adel@gmail.com> To: "Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir> Cc: "kwantdiscuss" <kwantdiscuss@kwantproject.org> Sent: Monday, Azar 11, 1398 10:57:27 AM Subject: Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell Dear Sajjad, The documentation of kwant is very rich and explains all these requirements with multiple examples. Please have a thorough look at those examples. The requested code is below. I hope this helps, Adel import kwant from numpy import * lat=kwant.lattice.square() sys=kwant.Builder() def pot(site, V): return V sys[(lat(x,y) for x in range(5) for y in range(5))]=pot sys[lat.neighbors()]=1 sym_lead = kwant.TranslationalSymmetry((1, 0)) lead = kwant.Builder(sym_lead) lead[(lat(0,y) for y in range(5))]=0 lead[lat.neighbors()]=1 sys.attach_lead(lead) kwant.plot(sys) sysf=sys.finalized() Sites=list(sysf.sites) Sites_pos=[site.pos for site in Sites] #getting the positions for example H=sysf.hamiltonian_submatrix(params=dict(V=5)) On Mon, Dec 2, 2019 at 9:41 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir > wrote: Dear Adel, Thank you for your response. I am trying to use your Instructions for finding all site in the scattering region and also finding eigenvalu but I can not. That is very kind of you if you send me a short example of these problem. Would you please? Best regard Sajad From: "Abbout Adel" < abbout.adel@gmail.com > To: "Saj.ZiaBorujeni" < saj.ziaborujeni.sci@iauctb.ac.ir > Cc: "kwantdiscuss" < kwantdiscuss@kwantproject.org > Sent: Saturday, Azar 2, 1398 7:21:58 PM Subject: Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell Dear Sajad, Getting the number of sites in the central system is easy in kwant. sysf= syst.finalized() Sites= list(sysf.sites) #list of all the sites in the scattering region number_of_sites=len(Sites). Getting the Hamiltonian of the central system is also straightforward: H=sysf.hamiltonian_submatrix() I want just to stress that the eigenvalues of this Hamiltonian have nothing to do with the band structure. In fact, to get the band structure, you need the hamiltonian H0 of the unit cell in the lead and the hopping matrix V between two unit cells. With the help of the Bloch theorem, the band can be obtained by diagonalizing: H0+V*exp(+ik)+V^\dagger *exp(ik) for all your k points. ps: (H and H0 may be different depending on how you define your system!) I hope this helps. Adel On Sat, Nov 23, 2019 at 1:09 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir > wrote: Dear Joseph Weston, yes you are right. "I am trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom." We know according to the nanoribbon, we have a scattering region that is attached to the leads. I want to find the number of kwant site (which I mentioned as atom) in the scattering region (which I mentioned as unit cell). Please look at the following example for the graphene nanoribbon: import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath import matplotlib d=1.42; a1=d*math.sqrt(3) t=3.033; latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder() #................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d syst[latt.shape(rectangle, (1,1))]=0 syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t ax=kwant.plot(syst); sym = kwant.TranslationalSymmetry(latt.vec((5,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)]) lead = kwant.Builder(sym) def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d lead[latt.shape(lead_shape, (1,1))] = 0 lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst); def plot_bands(syst): fsys = syst.finalized() plt.figure() kwant.plotter.bands(fsys.leads[0], args=(dict(gamma=1., ep=0.),)) plt.xlabel("K") plt.ylabel("band structure (eV)") plt.ylim((4.0,4.0)) plt.show() plot_bands(syst) Here we have a main region such that the whole system can be made by repeating this region. I want to know the number of site in the main region. "It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure." When we plot the band structure, we have a Hamiltonian (the dimension is N*N) in terms of K point. So, we have N eigenvalues for each K point. How we can find these eigenvalues for each K point. How is it shown in Kwant? Would you please help me. Best, Sajad From: "Joseph Weston" < joseph.weston08@gmail.com > To: "Saj.ZiaBorujeni" < saj.ziaborujeni.sci@iauctb.ac.ir >, kwantdiscuss@kwantproject.org Sent: Thursday, Aban 30, 1398 3:59:57 PM Subject: Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell Hi Sajad, Dear all, I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian. Is there any one to help me and let me know if it is possible in kwan to access them. Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom. It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure. Posting a complete code example is useful because it is more precise than describing your problem with words. Happy Kwanting, Joe  Abbout Adel  Abbout Adel
Dear Sajjad, Your request is not very clear. I bet that what you want to achieve is already implemented in kwant if you search well. When you attach leads, kwant adds some sites to your central system, so it may differ from what you put in your functions. If you want to sudy a unifor system and you want the unit cell (supercell) you have to extract your hamiltonian from the lead: lead0=fsys.leads[0] lead0.cell_hamiltonian() if you want to get your hamiltonian from the scattering region but you do not want the extrasites added when you attached the lead you can do: 1) chose the indexes of the sites in your chosen system: chosen_indexes=[1,5,6,9] 2) fsys.hamiltonian_submatrix(to_sites= chosen_indexes ,from_sites= chosen_indexes ) On Mon, Dec 2, 2019 at 2:12 PM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir> wrote:
Dear Adel,
At first I thought that we can make scattering region and then attached it to the lead. But now I understant that scattering region depends on the symetry vector. Am I right?
Please look at my code:
import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath #import scipy.linalg as la import matplotlib d=1.42; a1=d*math.sqrt(3);
#onsite energy................................................... t=3.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder()
#................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d
syst[latt.shape(rectangle, (1,1))]=0
def delet(pos): x, y = pos z=x**2+y**2 return z<(1*a1)**2
del syst[latt.shape(delet, (1,1))]
#nearest neighbors............................................................. syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t
*ax=kwant.plot(syst); *
*ax.savefig('syst1.pdf')*
sym = kwant.TranslationalSymmetry(latt.vec((4,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)])
lead = kwant.Builder(sym)
def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d
lead[latt.shape(lead_shape, (1,1))] = 0
def delet_lead(pos): x, y = pos z=x**2+y**2 return z<(1*a1)**2
del lead[latt.shape(delet_lead, (1,1))]
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t
syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0)
*ax=kwant.plot(syst); * *ax.savefig('syst.pdf')*
fsys = syst.finalized() Sites= list(fsys.sites) #list of all the sites in the scattering region number_of_sites=len(Sites)
In the abovementioned code, the line with green color is a shape we constructe as scattering region and the line with pink color is a shape that kwant constructe according to the symmetry vector and attached leads. When we look at to the both shapes and also the number of their sites (they are saved as pdf format) the scattering region made by us is different by scattering region made by kwant (with lead). Is there any way that both scattering regions will be same?
according to the
fsys = syst.finalized() Sites= list(fsys.sites) #list of all the sites in the scattering region number_of_sites=len(Sites)
kwant code gives us the number of sites of the scattering region in terms of the line with pink color. I need in the scattering region just have one hole like in the shape according to the line with green color.
That is very kind of you if you help me.
Best,
Sajad
*From: *"Abbout Adel" <abbout.adel@gmail.com> *To: *"Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir> *Cc: *"kwantdiscuss" <kwantdiscuss@kwantproject.org> *Sent: *Monday, Azar 11, 1398 10:57:27 AM *Subject: *Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell
Dear Sajjad,
The documentation of kwant is very rich and explains all these requirements with multiple examples. Please have a thorough look at those examples.
The requested code is below.
I hope this helps,
Adel
import kwant from numpy import *
lat=kwant.lattice.square() sys=kwant.Builder() def pot(site, V): return V sys[(lat(x,y) for x in range(5) for y in range(5))]=pot sys[lat.neighbors()]=1 sym_lead = kwant.TranslationalSymmetry((1, 0)) lead = kwant.Builder(sym_lead) lead[(lat(0,y) for y in range(5))]=0 lead[lat.neighbors()]=1 sys.attach_lead(lead) kwant.plot(sys) sysf=sys.finalized()
Sites=list(sysf.sites) Sites_pos=[site.pos for site in Sites] #getting the positions for example H=sysf.hamiltonian_submatrix(params=dict(V=5))
On Mon, Dec 2, 2019 at 9:41 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir> wrote:
Dear Adel,
Thank you for your response. I am trying to use your Instructions for finding all site in the scattering region and also finding eigenvalu but I can not. That is very kind of you if you send me a short example of these problem. Would you please?
Best regard
Sajad *From: *"Abbout Adel" <abbout.adel@gmail.com> *To: *"Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir> *Cc: *"kwantdiscuss" <kwantdiscuss@kwantproject.org> *Sent: *Saturday, Azar 2, 1398 7:21:58 PM *Subject: *Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell
Dear Sajad,
Getting the number of sites in the central system is easy in kwant.
sysf= syst.finalized()
Sites= list(sysf.sites) #list of all the sites in the scattering region
number_of_sites=len(Sites).
Getting the Hamiltonian of the central system is also straightforward:
H=sysf.hamiltonian_submatrix()
I want just to stress that the eigenvalues of this Hamiltonian have nothing to do with the band structure. In fact, to get the band structure, you need the hamiltonian H0 of the unit cell in the lead and the hopping matrix V between two unit cells. With the help of the Bloch theorem, the band can be obtained by diagonalizing:
H0+V*exp(+ik)+V^\dagger *exp(ik) for all your k points.
ps: (H and H0 may be different depending on how you define your system!)
I hope this helps.
Adel
On Sat, Nov 23, 2019 at 1:09 AM Saj.ZiaBorujeni < saj.ziaborujeni.sci@iauctb.ac.ir> wrote:
Dear Joseph Weston,
yes you are right.
"I am trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom."
We know according to the nanoribbon, we have a scattering region that is attached to the leads. I want to find the number of kwant site (which I mentioned as atom) in the scattering region (which I mentioned as unit cell).
Please look at the following example for the graphene nanoribbon:
import kwant from math import sqrt import matplotlib.pyplot as plt import tinyarray import numpy as np import math import cmath
import matplotlib d=1.42; a1=d*math.sqrt(3) t=3.033;
latt = kwant.lattice.general([(a1,0),(a1*0.5,a1*math.sqrt(3)/2)], [(a1/2,d/2),(a1/2,d/2)]) a,b = latt.sublattices syst= kwant.Builder()
#................................................................................... def rectangle(pos): x, y = pos z=x**2+y**2 return 2.9*a1<x<2.9*a1 and 7.5*d<y<7.5*d
syst[latt.shape(rectangle, (1,1))]=0
syst[[kwant.builder.HoppingKind((0,0),a,b)]] =t syst[[kwant.builder.HoppingKind((0,1),a,b)]] =t syst[[kwant.builder.HoppingKind((1,1),a,b)]] =t
ax=kwant.plot(syst);
sym = kwant.TranslationalSymmetry(latt.vec((5,0))) sym.add_site_family(latt.sublattices[0], other_vectors=[(1, 2)]) sym.add_site_family(latt.sublattices[1], other_vectors=[(1, 2)])
lead = kwant.Builder(sym)
def lead_shape(pos): x, y = pos return 7.5*d<y<7.5*d
lead[latt.shape(lead_shape, (1,1))] = 0
lead[[kwant.builder.HoppingKind((0,0),a,b)]] =t lead[[kwant.builder.HoppingKind((0,1),a,b)]] =t lead[[kwant.builder.HoppingKind((1,1),a,b)]] =t
syst.attach_lead(lead,add_cells=0) syst.attach_lead(lead.reversed(),add_cells=0) ax=kwant.plot(syst);
def plot_bands(syst): fsys = syst.finalized()
plt.figure() kwant.plotter.bands(fsys.leads[0], args=(dict(gamma=1., ep=0.),)) plt.xlabel("K") plt.ylabel("band structure (eV)") plt.ylim((4.0,4.0)) plt.show() plot_bands(syst)
Here we have a main region such that the whole system can be made by repeating this region. I want to know the number of site in the main region.
"It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure."
When we plot the band structure, we have a Hamiltonian (the dimension is N*N) in terms of K point. So, we have N eigenvalues for each K point. How we can find these eigenvalues for each K point. How is it shown in Kwant? Would you please help me.
Best,
Sajad
*From: *"Joseph Weston" <joseph.weston08@gmail.com>
*To: *"Saj.ZiaBorujeni" <saj.ziaborujeni.sci@iauctb.ac.ir>, kwantdiscuss@kwantproject.org *Sent: *Thursday, Aban 30, 1398 3:59:57 PM *Subject: *Re: [Kwant] Access to eigenvalue, eigenvector and number of points in each unit cell
Hi Sajad,
Dear all,
I need to access to the number of atoms of my unit cell, the eigenvalue and eigenvectors for each eigenvalue of my Hamiltonian.
Is there any one to help me and let me know if it is possible in kwan to access them.
Could you post a short code example showing what you are doing? You refer to "atoms" and "unit cell", so I presume that you are trying to create a system with translational symmetry, and that each Kwant *site* corresponds to a single atom.
It is not 100% clear to me what you want when you say "the eigenvectors and eigenvalue" of your Hamiltonian; if your system has translational symmetry then presumably you want the eigendecomposition *at a given quasimomentum*, but you do not explicitly state this, so I am not sure.
Posting a complete code example is useful because it is more precise than describing your problem with words.
Happy Kwanting,
Joe

Abbout Adel

Abbout Adel
 Abbout Adel
participants (3)

Abbout Adel

Joseph Weston

Saj.ZiaBorujeni