Пример #1
0
    ################# INITIALIZATION  ######################
    product_state = [np.array([1., 0.]).reshape([2, 1, 1]) for i in range(L)]
    for dep_idx in range(depth):
        # Trotterization initization
        my_circuit.append([t.copy() for t in U_list])
        current_depth = dep_idx + 1

    # try:
    #     init_path = '../3_state_approx/data/1d_TFI_g%.4f_h%.4f/L31_chi32/T%.1f/circuit_depth%d_Niter100000_1st_circuit.pkl' % (g, h, T, depth)
    #     my_circuit = pickle.load(open(init_path, 'rb'))

    # except:
    #     pass

    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]]

    E_list.append(np.sum(mps_func.expectation_values(mps_of_layer[-1],
                                                     H_list)))
    Sz_array[0, :] = mps_func.expectation_values_1_site(
        mps_of_layer[-1], Sz_list)
    ent_array[0, :] = mps_func.get_entanglement(mps_of_last_layer)
    fidelity_reached = np.abs(mps_func.overlap(target_mps,
                                               mps_of_last_layer))**2
    error_list.append(1. - fidelity_reached)

    dir_path = 'data/1d_%s_g%.4f_h%.4f/L%d_chi%d/T%.1f/' % (Hamiltonian, g, h,
                                                            L, chi, T)
    if not os.path.exists(dir_path):
        os.makedirs(dir_path)
Пример #2
0
    depth_list = []
    color = color_set[2][0]
    fidelity_error_list = []
    diff_sz_list = []
    ent_list = []
    for idx, depth in enumerate([1, 2, 3, 4, 5, 6, 7, 8]):
        try:
            exact_idx = int(T * 100)

            rohit_circuit = pickle.load(
                open(
                    rohit_wf_dir + '%d_layers_exponential_schedule_T%.1f.pkl' %
                    (depth, T), 'rb'))
            # rohit_circuit = pickle.load(open(rohit_wf_dir + '%d_layers_linear_schedule_T%.1f.pkl' % (depth, T),'rb'))

            mps_of_layer = qTEBD.circuit_2_mps(rohit_circuit, product_state)
            mps_of_last_layer = [A.copy() for A in mps_of_layer[depth]]

            fidelity_reached = np.abs(
                qTEBD.overlap(exact_state, mps_of_last_layer))**2
            f_error = 1. - fidelity_reached
            print('f_error : ', f_error)
            fidelity_error_list.append(f_error)

            sz_data = qTEBD.expectation_values_1_site(mps_of_last_layer,
                                                      Sz_list)
            abs_diff_sz = np.abs(sz_data[L // 2] - exact_sz[exact_idx, L // 2])
            diff_sz_list.append(abs_diff_sz)

            ent_data = qTEBD.get_entanglement(mps_of_last_layer)[L // 2]
            ent_list.append(ent_data)