예제 #1
0
def plot_Kitaev_green():
    ''' plot the Det(G) in the plane u-w'''
    L = 8
    num = 51
    u_num = 20
    ws = np.linspace(-3, 3, num)
    Gd = np.zeros((num, u_num), dtype=np.complex)
    for j, u in enumerate(np.linspace(0, 2, u_num)):
        H = Kitaev(L, t=1., u=u, d=1., pbc=False)
        evals, evecs = func.solve_hamiltonian(H)

        Gwk = np.zeros(num, dtype=np.complex)
        Gij = func.green(ws, op.fermion_c(), L, evals, evecs)
        for i in range(num):
            Gwk[i] = det(Gij[i])
        Gd[:, j] = Gwk

    plt.figure("poles")
    fig = plt.imshow(np.real(Gd), interpolation='nearest', aspect=0.4)
    fig.set_clim(-1, 1)
    plt.colorbar(ticks=[-1, 0, 1], label="Det(G)")
    plt.xticks([0.5, u_num / 2., u_num - 0.5], [0, 1, 2], fontsize=20)
    plt.yticks([0.5, num / 2., num - 0.5], [3, 0, -3], fontsize=20)
    plt.xlabel('u', fontsize=20)
    plt.ylabel('w', fontsize=20)
예제 #2
0
def plot_SSH_green():
    ''' plot the Det(G) in the plane dt-w'''
    L = 8
    num = 51
    d_num = 20
    ws = np.linspace(-3, 3, num)
    Gd = np.zeros((num, d_num), dtype=np.complex)
    for j, d in enumerate(np.linspace(-1, 1, d_num)):
        H = SSH(L, t=1., d=d, pbc=False)
        evals, evecs = func.solve_hamiltonian(H)

        Gwk = np.zeros(num, dtype=np.complex)
        Gij = func.green(ws, op.fermion_c(), L, evals, evecs)
        for i in range(num):
            Gwk[i] = det(Gij[i])
        Gd[:, j] = Gwk

        # plt.figure("Green u=%.2f"%d)
        # plt.plot(ws, np.real(Gwk),'o-')
        # plt.ylim([-1,1])
        # print np.min( np.imag(Gwk) ), np.max( np.imag(Gwk) )

    plt.figure("poles")
    fig = plt.imshow(np.real(Gd), interpolation='nearest', aspect=0.4)
    fig.set_clim(-1, 1)
    plt.colorbar(ticks=[-1, 0, 1], label="Det(G)")
    plt.xticks([0.5, d_num / 2., d_num - 0.5], [-1, 0, 1], fontsize=20)
    plt.yticks([0.5, num / 2., num - 0.5], [3, 0, -3], fontsize=20)
    plt.xlabel('d', fontsize=20)
    plt.ylabel('w', fontsize=20)
예제 #3
0
def plot_SSH_green_wk(dt=1.):
    ''' plot the greens function in the k-w plane '''
    L = 12
    num = 51  # number of energies to calculate
    ws = np.linspace(-3, 3, num)
    H = SSH(L, t=1., d=dt, pbc=True)
    evals, evecs = func.solve_hamiltonian(H)

    f, ax = plt.subplots(2, 2)  #, sharex='col', sharey='row')

    d_num = L / 2 + 1
    Gij = func.green(ws, op.fermion_c(), L, evals, evecs)
    lim = 2
    cdict = {
        'red': [(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 1.0, 1.0)],
        'green': [(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 0.0, 0.0)],
        'blue': [(0.0, 1.0, 1.0), (0.5, 1.0, 1.0), (1.0, 0.0, 0.0)]
    }
    from matplotlib.colors import LinearSegmentedColormap
    cmap = LinearSegmentedColormap('mycm', cdict)

    for x1 in range(2):
        for x2 in range(2):
            Gd = np.zeros((num, d_num), dtype=np.complex)
            for i in range(num):
                Gd[i, :] = func.fourier(Gij[i][x1, x2::2])
            # plt.figure("%d-%d"%(x1,x2))
            im = ax[x1][x2].imshow(np.real(Gd),
                                   interpolation='nearest',
                                   origin='lower',
                                   extent=(0, np.pi * 2, -3., 3.),
                                   aspect='auto',
                                   cmap=cmap)
            im.set_clim(-lim, lim)
예제 #4
0
파일: plots.py 프로젝트: clover199/pyLIB
def plot_Kitaev_green():
	''' plot the Det(G) in the plane u-w'''
	L = 8
	num = 51
	u_num = 20
	ws = np.linspace(-3,3,num)
	Gd = np.zeros((num, u_num), dtype=np.complex)
	for j, u in enumerate(np.linspace(0,2,u_num)):
		H = Kitaev(L, t=1., u=u, d=1., pbc=False)
		evals, evecs = func.solve_hamiltonian(H)

		Gwk = np.zeros(num, dtype=np.complex)
		Gij = func.green(ws, op.fermion_c(), L, evals, evecs)
		for i in range(num):
			Gwk[i] =  det(Gij[i])
		Gd[:,j] = Gwk

	plt.figure("poles")
	fig = plt.imshow(np.real(Gd), interpolation='nearest', aspect=0.4)
	fig.set_clim(-1,1)
	plt.colorbar(ticks=[-1,0,1],label="Det(G)")
	plt.xticks([0.5,u_num/2.,u_num-0.5], [0,1,2], fontsize=20)
	plt.yticks([0.5,num/2.,num-0.5], [3,0,-3], fontsize=20)
	plt.xlabel('u', fontsize=20)
	plt.ylabel('w', fontsize=20)
예제 #5
0
파일: plots.py 프로젝트: clover199/pyLIB
def plot_SSH_green():
	''' plot the Det(G) in the plane dt-w'''
	L = 8
	num = 51
	d_num = 20
	ws = np.linspace(-3,3,num)
	Gd = np.zeros((num, d_num), dtype=np.complex)
	for j, d in enumerate(np.linspace(-1,1,d_num)):
		H = SSH(L, t=1., d=d, pbc=False)
		evals, evecs = func.solve_hamiltonian(H)

		Gwk = np.zeros(num, dtype=np.complex)
		Gij = func.green(ws, op.fermion_c(), L, evals, evecs)
		for i in range(num):
			Gwk[i] =  det(Gij[i])
		Gd[:,j] = Gwk

		# plt.figure("Green u=%.2f"%d)
		# plt.plot(ws, np.real(Gwk),'o-')
		# plt.ylim([-1,1])
		# print np.min( np.imag(Gwk) ), np.max( np.imag(Gwk) )

	plt.figure("poles")
	fig = plt.imshow(np.real(Gd), interpolation='nearest', aspect=0.4)
	fig.set_clim(-1,1)
	plt.colorbar(ticks=[-1,0,1],label="Det(G)")
	plt.xticks([0.5,d_num/2.,d_num-0.5], [-1,0,1], fontsize=20)
	plt.yticks([0.5,num/2.,num-0.5], [3,0,-3], fontsize=20)
	plt.xlabel('d', fontsize=20)
	plt.ylabel('w', fontsize=20)
예제 #6
0
파일: plots.py 프로젝트: clover199/pyLIB
def plot_SSH_green_wk(dt=1.):
	''' plot the greens function in the k-w plane '''
	L = 12
	num = 51	# number of energies to calculate
	ws = np.linspace(-3,3,num)
	H = SSH(L, t=1., d=dt, pbc=True)
	evals, evecs = func.solve_hamiltonian(H)

	f, ax = plt.subplots(2,2)#, sharex='col', sharey='row')

	d_num = L/2+1
	Gij = func.green(ws, op.fermion_c(), L, evals, evecs)
	lim = 2
	cdict = {'red':   [(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0,  1.0, 1.0)],
			'green': [(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0,  0.0, 0.0)],
			'blue':  [(0.0, 1.0, 1.0), (0.5, 1.0, 1.0), (1.0,  0.0, 0.0)]}
	from matplotlib.colors import LinearSegmentedColormap
	cmap = LinearSegmentedColormap('mycm', cdict)

	for x1 in range(2):
		for x2 in range(2):
			Gd = np.zeros((num, d_num), dtype=np.complex)
			for i in range(num):
				Gd[i, :] =  func.fourier(Gij[i][x1,x2::2])
			# plt.figure("%d-%d"%(x1,x2))
			im = ax[x1][x2].imshow(np.real(Gd), interpolation='nearest', origin='lower',
									extent=(0,np.pi*2,-3.,3.), aspect='auto', cmap=cmap)
			im.set_clim(-lim,lim)
예제 #7
0
def Kitaev(L, t=1., u=1., d=1., pbc=False):
    ''' - t * c^d * c + 2u * n + d * c * c
		= ( -t * c^d + d * c) * c + h.c. + 2u * n '''
    print "\n--> Construct the Hamiltonian for the Kitaev model of size L=%d ..." % (
        L)

    store = [[None, None, None] for i in range(L + 1)]
    store[1][0] = op.fermion_c().hermitian().mult(op.fermion_c()).times(u)
    store[1][1] = op.fermion_c().hermitian().times(-t).plus(
        op.fermion_c().times(d))
    store[1][2] = op.fermion_c()

    def iterate(l):
        if store[l] != store[0]: return store[l]

        le = int(l / 2)
        lH, llo, lro = iterate(le)
        rH, rlo, rro = iterate(l - le)

        lid = lH.identity()
        rid = rH.identity()
        store[l][0] = lH.kron(rid)
        temp = lid.kron(rH)
        store[l][0].plus(temp)
        store[l][0].plus(lro.kron(rlo))
        store[l][1] = llo.kron(rid)
        store[l][2] = lid.kron(rro)
        return store[l]

    H, lo, ro = iterate(L)
    if pbc:
        edge = operator(L, [store[1][1], store[1][2]], [0, L - 1])
        edge.times(-d)
        H.plus(edge)
    temp = H.hermitian()
    H.plus(temp)
    print "--> Hamiltonian constructed."
    H.basis = op.basis(2)
    H.L = L
    return H
예제 #8
0
def SSH(L, t=1., d=1., pbc=False):
    ''' - (t-d) * c^d * c - (t+d) * c^d * c '''

    print "\n--> Construct the Hamiltonian for the SSH model of size L=%d ..." % (
        L)

    ope_z = op.fermion_c().times(0.0)
    ope_c = op.fermion_c()
    ope_cd = op.fermion_c().hermitian()

    def iterate(a, b):

        if a == b: return [ope_z, ope_c, ope_cd]

        ab = a + int((b - a + 1) / 2)
        lH, llo, lro = iterate(a, ab - 1)
        rH, rlo, rro = iterate(ab, b)

        lid = lH.identity()
        rid = rH.identity()
        H = lH.kron(rid)
        temp = lid.kron(rH)
        H.plus(temp)
        td = -t + d
        if ab % 2: td = -t - d
        H.plus(lro.kron(rlo).times(td))
        return [H, llo.kron(rid), lid.kron(rro)]

    H, lo, ro = iterate(1, L)
    if pbc:
        edge = operator(L, [ope_cd, ope_c], [0, L - 1])
        edge.times(t + d)
        H.plus(edge)
    temp = H.hermitian()
    H.plus(temp)
    print "--> Hamiltonian constructed."
    H.basis = op.basis(2)
    H.L = L
    return H