def plot_Peierls_Hubbard_green(u=0.0): ''' plot the Det(G) in the plane dt-w''' L = 6 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 = Peierls_Hubbard(L, t=1., dt=d, U=u, pbc=False) evals, evecs = func.solve_hamiltonian(H) Gwk = np.zeros(num, dtype=np.complex) Gij_up = func.green(ws, op.fermion_up(), L, evals, evecs) Gij_down = func.green(ws, op.fermion_down(), L, evals, evecs) for i in range(num): Gwk[i] = det(Gij_up[i]) * det(Gij_down[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)
def plot_Peierls_Hubbard_green(u=0.0): ''' plot the Det(G) in the plane dt-w''' L = 6 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 = Peierls_Hubbard(L, t=1., dt=d, U=u, pbc=False) evals, evecs = func.solve_hamiltonian(H) Gwk = np.zeros(num, dtype=np.complex) Gij_up = func.green(ws, op.fermion_up(), L, evals, evecs) Gij_down = func.green(ws, op.fermion_down(), L, evals, evecs) for i in range(num): Gwk[i] = det(Gij_up[i])*det(Gij_down[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)
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)
def plot_Hubbard_green_wk(): L = 6 H = Hubbard(L, t=1., u=1., f=1., pbc=True) evals, evecs = func.solve_hamiltonian(H) sec = 0 ge = evals[0][0] for s in range(evals.shape[0]): if evals[s][0] < ge: ge = evals[s][0] sec = s num = op.fermion_up().hermitian().mult(op.fermion_up()) num.plus(op.fermion_down().hermitian().mult(op.fermion_down())) density = func.expectation(L, evecs[sec][:, 0], sec, [num]) num = 11 ws = np.linspace(-3, 3, num) Gij = func.green(ws, op.fermion_up(), L, evals, evecs) Gwk = np.zeros((num, L + 1), dtype=np.complex) for i in range(num): Gwk[i, :] = func.fourier(Gij[i][0, :]) print Gij[(num - 1) / 2][0, :] print func.fourier(Gij[(num - 1) / 2][0, :]) plt.figure("Green") plt.imshow(np.imag(Gwk), interpolation='nearest', aspect='auto') plt.colorbar() print "density of the state:", density
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)
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)
def plot_Hubbard_green_wk(): L=6 H = Hubbard(L, t=1., u=1., f=1., pbc=True) evals, evecs = func.solve_hamiltonian(H) sec= 0 ge = evals[0][0] for s in range(evals.shape[0]): if evals[s][0] < ge: ge = evals[s][0] sec = s num = op.fermion_up().hermitian().mult( op.fermion_up() ) num.plus( op.fermion_down().hermitian().mult( op.fermion_down() ) ) density = func.expectation(L, evecs[sec][:,0], sec, [num] ) num = 11 ws = np.linspace(-3,3,num) Gij = func.green(ws, op.fermion_up(), L, evals, evecs) Gwk = np.zeros((num, L+1), dtype=np.complex) for i in range(num): Gwk[i, :] = func.fourier(Gij[i][0,:]) print Gij[(num-1)/2][0,:] print func.fourier(Gij[(num-1)/2][0,:]) plt.figure("Green") plt.imshow(np.imag(Gwk), interpolation='nearest', aspect='auto') plt.colorbar() print "density of the state:", density
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)