Re: [Kwant] [PROVENANCE INTERNET] Re: Problem with bands in the lead

Hi Pawel,
It seems that Joe was too fast for me.
In addition to what Joe wrote - the need to rescale the momenta properly - you also rescaled the energy twice so the energy scale was also wrong.
The following script adapted from yours gives correct results.
Regards, Xavier
from matplotlib import pyplot import kwant import numpy import math
def make_lead(W=30,dx=1.0,m=0.0667): lat=kwant.lattice.square(dx) #uzupelnianie t=1.0/m/dx/dx
sym = kwant.TranslationalSymmetry((-dx, 0)) lead=kwant.Builder(sym) lead[(lat(0,y) for y in range(-W+1,W))]=4*t lead[lat.neighbors()]=-t
return lead
def calculation(mydx,W): m=0.0667 lead=make_lead(W=100,dx=mydx).finalized() band=kwant.physics.Bands(lead) momenta = numpy.linspace(-numpy.pi, numpy.pi, 101) energies = [band(k) for k in momenta] f=open("band_W"+str(W)+"_dx"+str(mydx)+".dat",'w') for i in range(len(momenta)): f.write("%f " % (momenta[i]/mydx)) for j in range(len(energies[0])): f.write("%f " % (energies[i][j])) f.write("\n") f.close()
calculation(0.1,100) calculation(0.2,50)
__________________________________________ Xavier Waintal SPSMS-INAC-CEA,17 rue des Martyrs, 38054 Grenoble CEDEX 9, FRANCE Tel: 33 (0)4 38 78 03 27 email: xavier.waintal@cea.fr http://inac.cea.fr/Pisp/xavier.waintal __________________________________________
Le 27 févr. 2014 à 14:28, Joseph Weston joseph.weston@cea.fr a écrit :
Pawel Wojcik <Pawel.Wojcik <at> fis.agh.edu.pl> writes:
Hello, I have just started working with KWANT but at the beginning I have a
problem with the calculation of the
energy band in lead. Blow I paste my code in which a define the lead and
try to calculate the energy vs wave
vector. The definition of the lead comes from the example on the website documentation. I assume a lattice with the size dx and then t=h/m/dx/dx.
The energy from the function kwant.bands is expresed in units of [t] and
in this point a have a problem
because if I define the lead with W=100 points and dx=0.1 nm and calculate
the E vs k bands, it differs from
the E vs k bands calculated for W=50 points and dx=0.2 nm (of course scale
the energy multiplying it by t),
although the width of the lead W_eff=W*dx is the same for both cases.
Hi,
The reason that you see different band structures is that you have not re-scaled the "momenta" correctly when calling the `bands` object returned by `kwant.physics.Bands`. Concretely, when you call `bands(k)`, the "k" value you give is in units reciprocal to the distance units which you have chosen (which manifests in the onsite and hopping parameters). This means that for the "dx = 0.2" case, the momentum units are twice as small as for the "dx = 0.1" case. If you want to plot the two band structures on the same curve then you need to rescale the momentum units::
lead100 = make_lead(W=100,dx=0.1*f_nm2au).finalized() lead50 = make_lead(W=50,dx=0.2*f_nm2au).finalized() band100 = kwant.physics.Bands(lead100) band50 = kwant.physics.Bands(lead50)
# define this to be in units corresponding to "dx = 0.1" momenta = numpy.linspace(-numpy.pi, numpy.pi, 101) energies100 = [band100(k) for k in momenta] energies50 = [band50(2 * k) for k in momenta] # rescale momenta pyplot.plot(momenta, energies100, 'k', momenta, energies50)
You should now see that for small "k" the two sets of curves match up.
Regards,
Joe
participants (1)
-
Xavier Waintal