Dear Yuhao,

The Green's function between two sites in your case is a 2x2 matrix. This is due to the spin degree of freedom. So, getting 18x18 in your case is the correct result. 

I hope this helps.
Adel

On Tuesday, March 20, 2018, yuhao kang <kymwswj@gmail.com> wrote:

Dear Kwant developer,

 

I’m trying to calculate the greens function as follows:

gf = kwant.greens_function(sys,0).submatrix(1,0)

 

It returns a 18*18 matrix.  Does it mean the green function between 18 points in lead0 to 18 points in lead1?

However, when I plot this system, there is only 9 points at each lead.  If the base used here are not the lattice point?

 

Can I get the coordinates of the 18 points in both leads? So I can know the green function between two designated positions.

 

Thank you.

Best,

Yuhao

 

Here is my code.

 

##

import numpy as np

import kwant

 

m, t=0.4, -0.133

dis=0

a=1

lat = kwant.lattice.general([[a, 0], [a/2, a*np.sqrt(3)/2]],

                            [[0, 0], [0, a/np.sqrt(3)]])

A,B=lat.sublattices

sys=kwant.Builder()

s0=np.identity(2)

sx=np.array([[0,1],[1,0]])

sz=np.array([[1,0],[0,-1]])

 

def disk(pos):

    x,y=pos

    return abs(y)<2 and np.sqrt(3)*x-1<y<np.sqrt(3)*x+5

 

def edge(pos):

    x,y=pos

    return abs(y)<2 and np.sqrt(3)*x-0.1<y<np.sqrt(3)*x+0.58

def edge1(pos):

    x,y=pos

    return abs(y)<2 and np.sqrt(3)*x-0.1<y<np.sqrt(3)*x+0.58

 

def hopp(site1,site2):

    x1,y1=site1.pos

    x2,y2=site2.pos

    if (y1+0.1*a)*(y2+0.1*a)>0 and y1+0.1*a<0:

        return -t*s0

    else:

        return np.zeros([2,2])

   

def hopp2(site1,site2):

    x1,y1=site1.pos

    x2,y2=site2.pos

    if (y1+0.1*a)*(y2+0.1*a)>0 and y1+0.1*a<0:

        return t*s0

    else:

        return np.zeros([2,2])

   

 

def onsite(site):

    x,y=site.pos

    if (x-25*a)**2+(y-9*a)**2<8:

        return -m*sz+0*sx

    elif y>-0.1*a:

        return m*sz+0*sx

    else:

        return np.zeros([2,2])

   

    

sys[lat.shape(disk,(0,0))]=onsite

sys[lat.neighbors()]=-s0*2/3

sys[A.neighbors()]=hopp

sys[B.neighbors()]=hopp2

 

lead0=kwant.Builder(kwant.TranslationalSymmetry((-a,0)))

lead0[lat.shape(edge,(0,0))]=onsite

lead0[lat.neighbors()]=-s0*2/3

lead0[A.neighbors()]=hopp

lead0[B.neighbors()]=hopp2

sys.attach_lead(lead0)

sys.attach_lead(lead0.reversed())

 

kwant.plot(sys, fig_size=(30, 12))

 

sys=sys.finalized()

 

gf=kwant.greens_function(sys,0).submatrix(1,0)

##



--
Abbout Adel