Esempio n. 1
0
    if np.isclose(g, 1.):
        chi = 128
    else:
        chi = 32

    # data_tebd_dt1.000000e-03/1d_TFI_g1.4000_h0.*/L31/trunc_wf_chi32_4th/
    mps_dir_path = './data_tebd_dt%e/1d_%s_g%.4f_h%.4f/L%d/trunc_wf_chi%d_4th/' % (
        1e-3, Hamiltonian, g, h, L, chi)
    filename = mps_dir_path + 'T%.1f.pkl' % T
    target_mps = pickle.load(open(filename, 'rb'))

    ############### SET UP INITIALIZATION #################
    ## We should test identity initialization and
    ## trotterization initialization
    dt = T / depth
    U_list = qTEBD.make_U(H_list, 1j * dt)
    U_half_list = qTEBD.make_U(H_list, 0.5j * dt)

    idx = 0
    my_circuit = []
    E_list = []
    t_list = [0]
    error_list = []
    Sz_array = np.zeros([N_iter, L], dtype=np.complex)
    ent_array = np.zeros([N_iter, L - 1], dtype=np.double)
    num_iter_array = np.zeros([N_iter], dtype=np.int)

    ################# INITIALIZATION  ######################
    product_state = [np.array([1., 0.]).reshape([2, 1, 1]) for i in range(L)]
    for dep_idx in range(depth):
        # Trotterization initization
Esempio n. 2
0
    if not os.path.exists(dir_path):
        os.makedirs(dir_path)

    try:
        my_circuit, data_dict = misc.load_circuit_simple(dir_path)
        print("Old data found !!!")
    except:
        print("No data found !!!")
        pass

    running_idx = len(data_dict['E_list'])



    for dt in [1.,]:
        U_list =  qTEBD.make_U(H_list, dt)
        U_half_list =  qTEBD.make_U(H_list, dt/2.)
        for i in range(running_idx, 1000000):
            mps_of_layer = qTEBD.circuit_2_mps(my_circuit, product_state)
            mps_of_last_layer = [A.copy() for A in mps_of_layer[current_depth]]
            # [TODO] remove the assertion below
            assert np.isclose(mps_func.overlap(mps_of_last_layer, mps_of_last_layer), 1.)

            ## mpo in the convention abpq
            new_mps = [ np.einsum('plr,LRqp->qlLrR', mps_of_last_layer[j], H_mpo[j]) for j in range(L)]
            # new_mps[-1] *= -1
            for j in range(L):
                dim_q, dim_l, dim_L, dim_r, dim_R = new_mps[j].shape
                new_mps[j] = new_mps[j].reshape([dim_q, dim_l*dim_L, dim_r*dim_R])

            ## Below is a sanity check