U = 6.0 run = 1 site_num = 13 amplitude = 0.0 data_path = "data/dos/amplitude={0:.2f}/run={1}/".format(amplitude, run) data_name = "Phase12Center_t=-1.00_U={0:.2f}.npz".format(U) with np.load(data_path + data_name) as ld: dos = ld["dos"] omegas = ld["omegas"] domega = omegas[1] - omegas[0] avg_dos = np.mean(dos, axis=1) total_dos = np.sum(dos, axis=1) mu_h = Mu( total_dos, omegas, occupied_num=site_num, total_num=2*site_num, reverse=True ) mu_p = Mu( total_dos, omegas, occupied_num=site_num, total_num=2*site_num, reverse=False ) mu = (mu_p + mu_h) / 2 particle_num = np.sum(total_dos[omegas < mu]) * domega local_particle_num = np.sum(dos[omegas < mu], axis=0) * domega print("U = {0:.1f}".format(U)) print("Sum of DoS: {0:.8f}".format(np.sum(dos) * domega)) print("mu_p = {0:.8f}, mu_h = {1:.8f}, mu = {2:.8f}".format(mu_p, mu_h, mu)) print("Particle number: {0:.8f}".format(particle_num)) for index in range(site_num): num = local_particle_num[index] + local_particle_num[index+site_num]
}, ] lines = [] labels = [] yticks = [] baseline = 0.0 interval = 0.3 fig, ax = plt.subplots() for id in ids: with np.load(data_name_temp.format(**id)) as ld: dos = ld["dos"] omegas = ld["omegas"] avg_dos = np.mean(dos, axis=1) total_dos = np.sum(dos, axis=1) mu_h = Mu(total_dos, omegas, site_num, 2 * site_num, reverse=True) mu_p = Mu(total_dos, omegas, site_num, 2 * site_num, reverse=False) mu = (mu_p + mu_h) / 2 line, = ax.plot(omegas - mu, avg_dos + baseline, lw=2) lines.append(line) yticks.append(baseline) labels.append("t0={t0:.2f},t1={t1:.2f},U={U:.2f}".format(**id)) baseline += interval ax.set_yticks(yticks) ax.grid(axis="both", ls="dashed", color="gray") ax.legend(lines[::-1], labels[::-1], loc="lower left", fontsize=15) ax.set_title("t0={t0:.2f},U={U:.2f}".format(**ids[0]), fontsize=15) plt.get_current_fig_manager().window.showMaximized() plt.show()