Exemple #1
0
def run_imag_axis():
    params = read_params(basedir, rfolder)
    migdal = Migdal(params, basedir)
    G = np.load(basedir + 'data/' + rfolder + 'G.npy')
    D = np.load(basedir + 'data/' + rfolder + 'D.npy')
    print(G.shape)
    migdal.compute_jjcorr(G, D)

    params = read_params(basedir, ufolder)
    migdal = Migdal(params, basedir)
    G = np.load(basedir + 'data/' + ufolder + 'G.npy')
    D = np.load(basedir + 'data/' + ufolder + 'D.npy')
    print(G.shape)
    migdal.compute_jjcorr(G, D)
Exemple #2
0
def run_real_axis():
    params = read_params(basedir, rfolder)
    params['band'] = band_square_lattice
    migdal = RealAxisMigdal(params, basedir)
    G  = np.load(basedir + 'data/' + rfolder + 'G.npy')
    GR = np.load(basedir + 'data/' + rfolder + 'GR.npy')
    migdal.compute_jjcorr(G, GR)


    params = read_params(basedir, ufolder)
    params['band'] = band_square_lattice
    migdal = RealAxisMigdal(params, basedir)
    G  = np.load(basedir + 'data/' + ufolder + 'G.npy')
    GR = np.load(basedir + 'data/' + ufolder + 'GR.npy')
    migdal.compute_jjcorr(G, GR)
Exemple #3
0
def plot_real_axis():
    jjwu = np.load(basedir + 'data/' + ufolder + 'jjw.npy')
    jjwr = np.load(basedir + 'data/' + rfolder + 'jjw.npy')

    params = read_params(basedir, rfolder)
    params['band'] = band_square_lattice
    migdal = RealAxisMigdal(params, basedir)
    wn, vn, ek, w, nB, nF, DRbareinv = migdal.setup_realaxis()

    nr = len(w)
    print('nr', nr)
    print('len(w)', len(w))

    '''
    plt.figure()
    plt.plot(w[nr//2+1:], jjw[nr//2+1:].real)
    plt.savefig('jjw_re')

    plt.figure()
    plt.plot(w[nr//2+1:], jjw[nr//2+1:].imag)
    plt.savefig('jjw_im')

    plt.figure()
    plt.plot(w[nr//2+1:], 1/w[nr//2+1:]*jjw[nr//2+1:].real)
    plt.savefig('cond_re')
    '''

    plt.figure()
    plt.plot(w[nr//2+1:], -1/w[nr//2+1:]*jjwu[nr//2+1:].imag)
    plt.plot(w[nr//2+1:], -1/w[nr//2+1:]*jjwr[nr//2+1:].imag)
    plt.legend(['unrenormalized ME', 'renormalized ME'])
    plt.ylabel('$\sigma(\omega)$', fontsize=13)
    plt.xlabel('$\omega$', fontsize=13)
    plt.savefig('cond')
Exemple #4
0
def plot_N_cut(basedir, folder0, folder1):

    params = read_params(basedir, folder0)    
  
    N0 = np.load(basedir + 'data/' + folder0 + '/Nphonon.npy')
    N1 = np.load(basedir + 'data/' + folder1 + '/Nphonon.npy')

    def get_N_cut(N):
        nk = params['nk']
        Ncut = []
        for i in range(nk//2):
            Ncut.append(N[i,i])
        for i in range(nk//2):
            Ncut.append(N[nk//2-i, nk//2])
        for i in range(nk//2):
            Ncut.append(N[0, nk//2-i])
        Ncut.append(N[0,0])
        return Ncut

    Ncut0 = get_N_cut(N0)
    Ncut1 = get_N_cut(N1)

    plt.figure()
    plt.plot(Ncut0)
    plt.plot(Ncut1)
    plt.savefig(basedir + 'Nphonon_cut')
    plt.close()
Exemple #5
0
def el_occ(basedir, folder):
    # electronic occupation as a test

    params = read_params(basedir, folder)
    
    #print(params['wmin'], params['wmax'])
    w = np.arange(params['wmin'], params['wmax'], params['dw'])
    
    G = np.load(os.path.join(basedir, 'data', folder, 'GR.npy'))
    #G = np.load(basedir + folder + '/GR.npy')
    
    nF = 1/(np.exp(params['beta']*w) + 1)
    norm = -1/np.pi * np.trapz(G.imag, dx=params['dw'], axis=2)
    nk = -1/np.pi * np.trapz(nF[None,None,:]*G.imag, dx=params['dw'], axis=2)

    plt.figure()
    plt.imshow(nk, origin='lower', aspect='auto')
    plt.colorbar()
    plt.savefig(basedir + 'nk')
    plt.close()
    
    plt.figure()
    plt.imshow(norm, origin='lower', aspect='auto')
    plt.colorbar()
    plt.savefig(basedir + 'norm')
    plt.close()
Exemple #6
0
    def plot():
        basedir = '../test/'
        folder = 'data_unrenormalized_nk12_abstp0.000_dim2_g00.16667_nw128_omega0.100_dens0.800_beta40.0000_QNone/'

        params = read_params(basedir, folder)
        G = np.load(os.path.join(basedir, 'data', folder, 'G.npy'))

        nk = params['nk']
        plt.figure()
        plt.plot(-1 / np.pi * G[nk // 4, nk // 2, :].imag)
        plt.savefig('test')
        plt.close()

        A = -1 / np.pi * G[:, nk // 2, :].imag
        plt.figure()
        plt.imshow(A, origin='lower', aspect='auto')
        plt.colorbar()
        plt.savefig('test2')
        plt.close()
Exemple #7
0
def ph_occ(basedir, folder):
    # electronic occupation as a test
    print(folder)

    params = read_params(basedir, folder)
    
    print(params['wmin'], params['wmax'], params['dw'])
    w = np.arange(params['wmin'], params['wmax'], params['dw'])
    dw = params['dw']

    D = np.load(os.path.join(basedir, 'data', folder, 'DR.npy'))

    if np.shape(D)[2]==840:
        print('wtf nr')
        w = np.arange(params['wmin'], params['wmax'], 0.010)
        dw = 0.010

    nB = 1/(np.exp(params['beta']*w) - 1)

    plt.figure()
    plt.plot(w, -1/np.pi * nB*D[0,0,:].imag)
    plt.savefig(basedir + 'DI' + folder[5])
    plt.close()    

    nr = np.shape(D)[2]
    I = -1/np.pi * np.trapz(D.imag[:,:,:nr//2], dx=dw, axis=2)
    print('integral of DI from -inf to 0 (avg, min, max)', np.mean(I), np.amin(I), np.amax(I))

    N = -1/np.pi * np.trapz(nB[None,None,:]*D.imag, dx=dw, axis=2)

    print('integral of nB DI (avg, min, max)', np.mean(N), np.amin(N), np.amax(N))

    N = (N - 1)/2

    print('N (avg, min, max)', np.mean(N), np.amin(N), np.amax(N))

    np.save(basedir + 'data/' + folder + '/Nphonon.npy', N)
    
    plt.figure()
    plt.imshow(N, origin='lower', aspect='auto')
    plt.colorbar()
    plt.savefig(basedir + 'data/' + folder + '/N')
    plt.close()
Exemple #8
0
def plot_imag_axis():

    '''
    plt.figure()
    plt.plot(jj0t.real)
    plt.plot(jj0t.imag)
    plt.ylabel('Re $\Lambda^0(\tau)$')
    #plt.title('jj0tau')
    plt.savefig('jj0tau{}'.format('r' if self.renormalized else 'u'))
    '''

    jjvu = np.load(basedir + 'data/' + ufolder + 'jjv.npy')
    jjvr = np.load(basedir + 'data/' + rfolder + 'jjv.npy')
    params = read_params(basedir, rfolder)
    ivn = 2*np.arange(len(jjvr))*np.pi/params['beta']

    plt.figure()
    plt.plot(ivn, jjvu.real, '.-')
    plt.plot(ivn, jjvr.real, '.-')
    plt.legend(['unrenormalized ME', 'renormalized ME'])
    plt.ylabel('Re ' + r'$\Lambda (i \nu_n)$', fontsize=13)
    plt.xlabel(r'$\nu_n$', fontsize=13)
    plt.xlim(0, 2.5)
    plt.savefig('jjv')
Exemple #9
0
    def plot_x_vs_t(l):
        basedir = '../test_dwave/'
        df = os.path.join(basedir, 'data/')
        folders = os.listdir(df)

        data = {}

        data['renormalized'] = {'betas': [], 'xscs': [], 'xcdws': []}
        data['unrenormalized'] = {'betas': [], 'xscs': [], 'xcdws': []}

        for folder in folders:
            params = read_params(basedir, folder)
            path = os.path.join(df, folder, 'Xsc.npy')
            pathcdw = os.path.join(df, folder, 'Xcdw.npy')

            lamb = myg02lamb(params['g0'], params['omega'], 8.0)
            #if params['nk']!=64: continue
            if not np.abs(lamb - l) < 1e-5:
                continue

            if not os.path.exists(path): continue

            xsc = np.load(path, allow_pickle=True)[0]
            xcdw = np.load(pathcdw, allow_pickle=True)
            print('argmax', np.argmax(xcdw), 'shape xcdw', np.shape(xcdw))
            xcdw = np.amax(xcdw)
            r = 'renormalized' if params['renormalized'] else 'unrenormalized'

            if xsc is not None:
                data[r]['betas'].append(params['beta'])
                data[r]['xscs'].append(xsc)
                data[r]['xcdws'].append(xcdw)

        d = data['renormalized']
        rb, rx, rc = zip(*sorted(zip(d['betas'], d['xscs'], d['xcdws'])))
        d = data['unrenormalized']
        rb = np.array(rb)
        rx = np.array(rx)
        rc = np.array(rc)

        if len(d['betas']) > 0:
            ub, ux, uc = zip(*sorted(zip(d['betas'], d['xscs'], d['xcdws'])))
            ub = np.array(ub)
            ux = np.array(ux)
            uc = np.array(uc)

        f, (ax1, ax2) = plt.subplots(1, 2)
        f.set_size_inches(6, 3)
        plt.title('lamb=1/6, n=0.8, 16x16, t\'=-0.3')
        '''
        ax1.plot(1/ub, 1/ux, 'k.-')
        ind = uc!=None
        ax1.plot(1/ub[ind], 20/uc[ind], 'k.--')
        ax1.legend(['1/Xsc', '20/Xcdw'])
        ax1.set_title('unrenormalized ME')
        ax1.set_xlabel('T', fontsize=13)
         
        ax1.set_xlim(0, 0.6)
        ax1.set_ylim(0, 6)
        '''

        ax2.plot(1 / rb, 1 / rx, 'k.-')
        ind = rc != None
        ax2.plot(1 / rb[ind], 20 / rc[ind], 'k.--')

        #ax2.set_xlim(0, 0.25)
        #ax2.set_ylim(0, 6)
        ax2.legend(['1/Xsc', '20/Xcdw'])
        ax2.set_title('renormalized ME')
        ax2.set_xlabel('T', fontsize=13)

        plt.tight_layout()

        plt.savefig(basedir + 'div_l')
        plt.close()
Exemple #10
0
        ls.append('lamb=%.1f'%lamb)
        
    plt.legend(ls)
    plt.savefig(f'{basedir}omega')

analyze_single_particle(basedir)


#-------------------------------------------------------------
# compare renormalized and unrenormalized
print('comparing renormalized and unrenormalized')

basedir = '/scratch/users/bln/migdal_check_vs_ilya/single_particle/'
folder = 'data_renormalized_nk12_abstp0.300_dim2_g00.33665_nw512_omega0.170_dens0.800_beta16.0000_QNone/'

params = read_params(basedir, folder)
lamb = g02lamb_ilya(params['g0'], params['omega'], 8)
print('lambda = ', lamb)

S = np.load(basedir + 'data/' + folder + 'S.npy')
wn = (2*np.arange(params['nw'])+1)*np.pi/params['beta']
S = fourier.t2w(S, params['beta'], 2, 'fermion')[0]
nk = params['nk']


basedir = '/scratch/users/bln/migdal_check_vs_ilya/single_particle_unrenorm/'
folder = 'data_unrenormalized_nk12_abstp0.300_dim2_g00.33665_nw512_omega0.170_dens0.800_beta16.0000_QNone/'

uS = np.load(basedir + 'data/' + folder + 'S.npy')
uS = fourier.t2w(uS, params['beta'], 2, 'fermion')[0]
Exemple #11
0
def a2F_imag(basedir, folder, ntheta=5, separate_imag_folder=None):

    if separate_imag_folder:
        i1 = len(folder)
        for _ in range(3):
            i1 = folder.rfind('_', 0, i1 - 1)
        folder_ = folder[:i1]
    else:
        folder_ = folder

    params = read_params(basedir, folder_)
    t = params['t']
    tp = params['tp']
    mu = params['mu']

    nk = params['nk']
    g0 = params['g0']

    print('beta', params['beta'])

    dtheta = np.pi / (2 * ntheta)
    thetas = np.arange(dtheta / 2, np.pi / 2, dtheta)
    assert len(thetas) == ntheta

    corners = ((0, -np.pi, -np.pi), (-np.pi / 2, -np.pi, np.pi),
               (-np.pi, np.pi, np.pi), (np.pi / 2, np.pi, -np.pi))

    kxfs = []
    kyfs = []
    dEdks = []
    vels = []
    rs = []
    for corner in corners:
        for theta in thetas:
            (kx, ky), r, dEdk = kF(theta, corner[0], corner[1], corner[2], t,
                                   tp, mu)
            kxfs.append(kx)
            kyfs.append(ky)
            rs.append(r)
            dEdks.append(dEdk)
            vels.append(np.abs(dEdk))

    # compute normalization factor
    dos = 0
    for ik in range(ntheta):
        dos += rs[ik] / vels[ik] * dtheta

    lamb = 0
    lambk = np.zeros(ntheta)

    # compute D
    PI = np.load(basedir + 'data/' + folder_ + '/PI.npy')
    PI = fourier.t2w(PI, params['beta'], 2, kind='boson')

    if len(np.shape(PI)) == 3:
        migdal = RME2d(params, basedir)
    elif len(np.shape(PI)) == 5:
        migdal = RME2dsc(params, basedir)

    vn = 2 * np.arange(params['nw'] + 1) * np.pi / params['beta']
    D = migdal.compute_D(vn, PI)

    #D = np.load(basedir + 'data/' + folder + '/D.npy')

    # extend D

    D = np.concatenate((D, D[0, :, :][None, :, :]), axis=0)
    D = np.concatenate((D, D[:, 0, :][:, None, :]), axis=1)

    # fourier transform....
    #beta = np.load(basedir + 'data/' + folder + '/beta.npy')[0]
    #dim  = 2
    #D    = fourier.t2w(D, beta, dim, 'boson')

    plt.figure()
    plt.imshow(D[:, :, 0].real, origin='lower')
    plt.colorbar()
    plt.savefig(basedir + 'data/' + folder + '/Diw0')
    plt.close()

    ks = np.linspace(-np.pi, np.pi, nk + 1)

    #I = interp2d(ks, ks, B[:,:,iw], kind='linear')
    I = interp2d(ks, ks, D[:, :, 0].real, kind='linear')
    print('size of maximum real part : ', np.amax(np.real(D[:, :, 0])))

    #print('size of imag part : ', np.amax(np.imag(D[:,:,0])))

    for ik in range(ntheta):
        a2Fk = 0

        for ikp in range(4 * ntheta):
            dkx = kxfs[ikp] - kxfs[ik]
            dky = kyfs[ikp] - kyfs[ik]
            a2Fk += -I(dkx, dky) / vels[ikp] / (2 *
                                                np.pi)**2 * rs[ikp] * dtheta

        lambk[ik] = a2Fk
        lamb += lambk[ik] / vels[ik] * rs[ik] * dtheta

    lambk *= g0**2
    lamb *= g0**2 / dos

    print('lamb a2F imag', lamb)

    np.save(basedir + 'data/' + folder + '/lambk_a2F_imag.npy', lambk)
    np.save(basedir + 'data/' + folder + '/lamb_a2F_imag.npy', lamb)

    return lambk, np.array(rs) / np.array(vels)