예제 #1
0
def ED_MF_refdata():
    start = time.time()

    # Takes arguments from console
    U = float(sys.argv[1])
    N = int(sys.argv[2])
    tperp = float(sys.argv[3])
    ord_par = float(sys.argv[4])
    mu = float(sys.argv[5])

    d = 2
    model = "HCboson"
    g1 = [1., U]
    g2 = [0., 0.]

    g2[1] = 4 * tperp * ord_par

    # Gets a density given a chemical potential mu and stores them in a file
    dens = get_dens(g1, [mu, g2[1]], N, d, model)
    data = [dens, mu]

    direc_name = "rho_of_mu_tperp=" + str(tperp) + ",U=" + str(U)
    file_name = "ordpar=" + str(ord_par) + ",mu=" + str(mu) + ".txt"
    store.cwd_store(direc_name, file_name, data)
    end = time.time()

    print("Time cost:", end - start)
    return
예제 #2
0
def main():
    date = str(datetime.date.today())
    N = int(sys.argv[1])
    alf = float(sys.argv[2])
    g1 = [1., 1.]
    g2 = [1., alf]
    model = "HCboson"
    d = 2

    ED = ed.ExactD(g1, g2, N, d, model)

    ED.exact_GS()

    adag = np.array([[0., 1.], [0, 0]])
    a = np.array([[0, 0], [1, 0]])
    corr_mat = [
        ED.ED_correl(ED.GS, adag, a, i, j) for i in range(N) for j in range(N)
    ]

    data = [ED.E_GS] + corr_mat

    file_name = "bench_ED.txt"
    direc_name = "alf=" + str(alf)
    cwd_store(direc_name, file_name, data)
    print("Success!")
예제 #3
0
def main():
    N = int(sys.argv[1])
    dt = float(sys.argv[2])
    T = int(sys.argv[3])
    chi = int(sys.argv[4])
    alf = float(sys.argv[5])
    step_num = int(T / dt)
    g1 = [1., 1.]
    g2 = [1., alf]
    d = 2
    algo = "tDMRG"

    H = st.Hamiltonian(g1,
                       g2,
                       N,
                       dt,
                       d,
                       chi,
                       model="HCboson",
                       TO="fourth",
                       grow_chi=False)
    Psi = st.StateChain(g1, g2, N, d, chi, algo)

    Psi = H.time_evolve(Psi, step_num, algo)

    M = st.Measure()

    adag = np.array([[0., 1.], [0, 0]])
    a = np.array([[0, 0], [1, 0]])
    corr_matrix = M.corr_mat(Psi, adag, a)
    E_GS = sum(Psi.get_ener(H.Hchain))

    data = [E_GS, Psi.err]
    corr_matrix = np.reshape(corr_matrix, (corr_matrix.shape[0]**2))
    data += [corr for corr in corr_matrix]

    direc_name = "alf=" + str(alf)
    file_name = "chi=" + str(chi) + ",T=" + str(T) + ",dt=" + str(dt) + ".txt"

    cwd_store(direc_name, file_name, data)
    print("Success!")
예제 #4
0
def refine():
    model = "HCboson"
    
    N = int(sys.argv[1])
    U = float(sys.argv[2])
    
    dt = 0.1
    hom = os.path.expanduser("~")
    dname = hom + "/Data/Static_MF/SMF_N=" + str(N) + "_1/"
    fname = "GS_N=" + str(N) + ",U=" + str(U) + ".txt"
    
    Psi = get_GS(dname + fname)
    
    H = st.Hamiltonian(Psi.g1, Psi.g2, N, dt, Psi.d, Psi.chi, model,
                       TO="fourth")
    
    Psi = H.time_evolve(Psi, 1000, "tDMRG", fast_run=False)
    
    gs_mat = store_GS(Psi)
    
    cwd_folder = "refined_gsdata"
    
    cwd_store(cwd_folder, fname, gs_mat)
예제 #5
0
def mptk_SMF():
    rho_max_err = 1e-5
    orp_max_err = 1e-6

    N = eval(sys.argv[1])
    U = eval(sys.argv[2])
    tperp = eval(sys.argv[3])
    chi = eval(sys.argv[4])
    num_bos = eval(sys.argv[5])
    cl_flag = bool(int(sys.argv[6]))

    mu = 0
    orp_guess = 1 / math.sqrt(2)
    alp = 4 * tperp * orp_guess
    dens = num_bos / N

    mu_list = [0]
    orp_list = [orp_guess]
    err = 1
    i = 0

    run_script = "bin/mptk_script.sh"
    dname = lambda p1, p2, p3, p4, p5: ("mptk_states/tperp=" + str(
        p1) + "/N=" + str(p2) + "/n=" + str(p3) + "/U=" + str(p4) + "/chi=" +
                                        str(p5))

    while True:
        arg_list = [N, U, mu, alp, chi]

        mpsol = mp.MPTKState(dname(tperp, N, num_bos, U, chi),
                             run_script,
                             arg_list,
                             model="SMF",
                             cluster=cl_flag)

        is_finished = mpsol.mptk_run()
        if is_finished:
            return

        new_dens = get_av_expec(mpsol, "N", 1, N + 1)
        density_err = abs(new_dens - dens) / dens

        if density_err > rho_max_err:
            if new_dens > dens:
                over = True
            else:
                over = False
            mu_guess = guess_mu(alp, U, tperp, over, new_dens, goal_dens=dens)
            mu = new_mu(mu_guess, new_dens, dens, mpsol, rho_max_err)

        av_start = int(N / 2) - int(N / 4) + 1
        av_end = int(N / 2) + int(N / 4) + 1 if N % 2 == 0 else int(
            N / 2) + int(N / 4) + 2

        new_orp = abs(get_av_expec(mpsol, "B", av_start, av_end))
        err = abs(new_orp - orp_list[-1]) / abs(new_orp)
        print(new_orp)

        orp_list.append(new_orp)
        mu_list.append(mu)
        alp = 4 * tperp * new_orp

        if i % 20 == 0:
            print("Error in order param. is", err)

        if ((err < orp_max_err and density_err < rho_max_err) or i == 500
                or orp_list[-1] < 1e-8):
            break
        else:
            mpsol.delete_solution()

        i += 1
    print("Final error in order param. is", err)

    if cl_flag and not is_finished:
        #        Do NOT add chi at the end: it will create a chi=$chi/chi=$chi
        #        structure
        mpsol.copy_solution("/mptk_states/tperp=" + str(tperp) + "/N=" +
                            str(N) + "/n=" + str(num_bos) + "/U=" + str(U) +
                            "/")

    fol = "transf_n=" + str(num_bos) + "/SMF_N=" + str(N)
    fnam = "N=" + str(N) + ",U=" + str(U) + ".txt"
    cwd_store(fol, fnam, orp_list)
    cwd_store(fol, "mu_" + fnam, mu_list)

    return orp_list, mu_list