what you are doing is just diagonalizing a matrix and obtaining the eigenvectors. So, first, this does not concern the whole system (sys with the leads ). second, the eigenvectors are not the wavefunction at a given site and theirfore evecs[i] will return the eigenvector corresponding the the eigenvalues number "i".
If you want the wavefunction, look at this in the documentation: http://kwant-project.org/doc/1.0/reference/generated/kwant.solvers.default.w...
I have also written this code as an example for you:
import kwant from matplotlib import pyplot
def make_sys(a=1,t=1,l=50): def Tshape(pos): x,y=pos return x**2+y**2<=l lat = kwant.lattice.square(a) sys = kwant.Builder() sys[lat.shape(Tshape, (0, 1))] = 0 sys[lat.neighbors()]=-1
sym = kwant.TranslationalSymmetry((-2, 1)) lead = kwant.Builder(sym) lead[lat.wire((0, 3), 5)] = 0 lead[lat.neighbors()] = -1 sys.attach_lead(lead) sys.attach_lead(lead.reversed())
sys = make_sys() kwant.plot(sys) sys = sys.finalized() wf = kwant.solvers.default.wave_function(sys, energy=0) wfs_of_lead_0 = wf(0) #wave function due to lead 0 and mode 4 (counting starts from 0)
# if you want this wave function at site 35 just do wf_35=wfs_of_lead_0
#if you want this function at the position x,y=(-5,7) just do Positions=[sys.sites[i].pos for i in range(len(sys.sites))] #list of all the positions of the sites site_index=Positions.index((-5,7))
wf_5_7=wfs_of_lead_0[site_index] #wave function at site (-5,7) due to mode 4 of lead 0
#plot_conductance(Mysys, energies=[-4.5+0.01/3 * i for i in xrange(3*900)])
# Call the main function if the script gets executed (as opposed to imported). # See http://docs.python.org/library/__main__.html. if __name__ == '__main__': main()
I hope it will help. Best regards, Adel
On Mon, Apr 18, 2016 at 4:32 PM, Johnny Wu email@example.com wrote:
I obtained the wavefunction of the system by using ham = sys.hamiltonian_submatrix() evecs = la.eigh(ham)
Is the wavefunction corresponding to site i given by evecs[i] ? Thanks!
On 18 April 2016 at 03:44, Abbout Adel firstname.lastname@example.org wrote:
you need just to finalize your system before doing calculation. so : sys=sys.finalized() m=len(sys.sites)
and it will work . Best regards, Adel
On Sun, Apr 17, 2016 at 7:23 PM, Johnny Wu email@example.com wrote:
Dear Dr. Adel
I could not compute len(sys.sites) since sys.sites is of the type "method". How should I change it? Thanks.
On 14 April 2016 at 18:44, Abbout Adel firstname.lastname@example.org wrote:
if you want to get the index of a site in you system, you can do it as follow:
sys=make_system() sys=sys.finalized() Positions=[sys.sites[i].pos for i in range(len(sys.sites))] #
list of all the positions of the sites
Since you know the form of you system, you can obtain the positions of the sites at the edge. for example if the site at (3,5) is at the edge you can find its index straightforwardly:
once you know the index of your site, you can do whatever you want. for example delete that site:
or you can pass it to a function which has site as an argument :
I hope that this helps
Best regards, Adel www.abboutadelhomepage.com
-- Abbout Adel