Hi Anton,

Thanks for your two suggestions. I am able to perform the second method but I don't know how to call syst.modes. Would you please show me the codes using syst.modes to calculate DOS(energy=0) of my minimal example?
#-------------------------------------------------------------------
import kwant
import numpy 

a=1
W=30
t=1
lat = kwant.lattice.square(a)
syst = kwant.Builder(kwant.TranslationalSymmetry((-a, 0)))
syst[(lat(0, j) for j in range(W))] = 4 * t
syst[lat.neighbors()] = -t
fsyst = syst.finalized()

# Then how to use fsyst.modes to calculate DOS(energy=0) ?
#-------------------------------------------------------------------

Thanks in advance!

Regards,
Zhan

发件人:Anton Akhmerov <anton.akhmerov+kd@gmail.com> 发送日期:2019-12-21 21:55:34 收件人:Cao Zhan <caozhan@baqis.ac.cn> 抄送人:kwant-discuss <kwant-discuss@kwant-project.org> 主题:Re: [Kwant] Can Kwant calculate density of states of quasi one-dimensional systems?>Hi Zhan, > >SpectralDensity indeed doesn't support translationally invariant >systems. You have two options instead. If you want to obtain the DOS >at a specific energy, you should use the output of >syst.modes—specifically the wave functions of the propagating modes. >If you need the DOS of the full spectrum, you should diagonalize the >Hamitlonian and perform a summation over all momenta on your own. > >Best, >Anton > >On Sat, 21 Dec 2019 at 13:51, Cao Zhan <caozhan@baqis.ac.cn> wrote: >> >> Dear Kwant users, >> >> In Kwant manual there is a section entitled "Calculating spectral density with the kernel polynomial method". I find that examples in this section are all talking about finite-size systems. I wonder whether Kwant can calculate density of states of a quasi one-dimensional system that is finite along y-direction but is translationally invariant along x-direction. For a minimal test, I have run the following codes but errors occurred. >> #-------------------------------------------------------------------------------------- >> import kwant >> import numpy >> >> a=1 >> W=30 >> t=1 >> lat = kwant.lattice.square(a) >> syst = kwant.Builder(kwant.TranslationalSymmetry((-a, 0))) >> syst[(lat(0, j) for j in range(W))] = 4 * t >> syst[lat.neighbors()] = -t >> fsyst = syst.finalized() >> energies = numpy.linspace(-0.1,0.1, 10) >> >> spectrum = kwant.kpm.SpectralDensity(fsyst) >> spectrum.add_moments(10) >> spectrum.add_vectors(5) >> densities = spectrum(energies) >> #-------------------------------------------------------------------------------------- >> What's wrong in above codes? Currently, are we able to employ Kwant to calculate density of states of 3D systems being translationally invariant along one or two directions? >> >> Regards, >> Zhan >> >> >> >> >> >> >> >> >> >>