def ent_agr_var_plots(spin, N, hmin, hmax, points, c, num_psis, phis): """ This function creates data dumps for plotting of eigenstate entropy, adjusted gap ratio, and variance. Also data for histograms :param spin: is the spin of the individual particles :param N: is the system size :param hmin: minimum h to plot :param hmax: maximum h to plot :param points: number of h to plot :param c: quasirandom factor :param num_psis: number of eigenstates to find near a specified energy :param phis: number of phases to average over :return: dumped data files """ h_list = np.linspace(hmin, hmax, points) phi_list = np.linspace(0, 0.5 * np.pi, phis + 1) phi_list = phi_list[0:-1] Sz_tot = aubryC.half_chain_Sz(N) Sz_tot2 = Sz_tot**2 ent_plt = np.zeros(points) # var_plt = np.zeros(points) agr_plt = np.zeros(points) ent_std = np.zeros(points) # var_std = np.zeros(points) agr_std = np.zeros(points) timer = Timer(points*phis, mode='average') for i in range(points): ent_lst_full = np.array([]) # var_lst_full = np.array([]) agr_lst_full = np.array([]) # eig_lst_full = ent_lst_full for k in range(phis): H = aubryHo.spin_block(N, h_list[i], c, phi_list[k]) try: H, psis, eigvs = aubryC.gen_eigenpairs(N, H, num_psis) except: print("Configuration failed to converge: H ", h_list[i], " Phi ", phi_list[k]) continue ent_lst, var_lst = \ aubryC.ent_var_lst(psis, spin, N, Sz_tot, Sz_tot2) eigvs = np.sort(eigvs) agr_lst = aubryC.adj_gap_ratio(eigvs) ent_lst_full = np.append(ent_lst_full, ent_lst) # var_lst_full = np.append(var_lst_full, var_lst) agr_lst_full = np.append(agr_lst_full, agr_lst) # eig_lst_full = np.append(eig_lst_full, eigvs) timer.progress() ent_plt[i] = np.mean(ent_lst_full/N) ent_std[i] = np.std(ent_lst_full/N) # var_plt[i] = np.mean(var_lst_full) # var_std[i] = np.std(var_lst_full) agr_plt[i] = np.mean(agr_lst_full) agr_std[i] = np.std(agr_lst_full) ent_hst_file = 'DATA/ent_hst_L' + str(N) + '_h' + str( h_list[i]) + '_c' + str(round(c, 2)) + '.txt' # var_hst_file = 'DATA/var_hst_L' + str(N) + '_h' + str( # h_list[i]) + '_c' + str(round(c, 2)) + '.txt' agr_hst_file = 'DATA/agr_hst_L' + str(N) + '_h' + str( h_list[i]) + '_c' + str(round(c, 2)) + '.txt' # eig_hst_file = 'eig_hst_L' + str(N) + '_h' + str( # h_list[i]) + '_c' + str(round(c, 2)) + '.txt' np.savetxt(ent_hst_file, np.transpose(ent_lst_full)) # np.savetxt(var_hst_file, np.transpose(var_lst_full)) np.savetxt(agr_hst_file, np.transpose(agr_lst_full)) # np.savetxt(eig_hst_file, eig_lst_full) ent_agr_var_plot_file = 'DATA/plot_data_L' + str(N) + '_c' + str(round(c, 2))\ + '_phi' + str(phis) + '.txt' # np.savetxt(ent_agr_var_plot_file, (h_list, ent_plt, ent_std, agr_plt, agr_std, var_plt, var_std)) np.savetxt(ent_agr_var_plot_file, (h_list, ent_plt, ent_std, agr_plt, agr_std))