axes = clp.initialize(col=2, row=1, width=4.3, height=4.3 * 0.618 * 2, fontsize=12, LaTeX=True, labelthem=True, labelthemPosition=[0.04, 0.96]) xs, ys = gather_data(Nlst) clp.plotone([x / kFGR for x in xs], ys, axes[0], labels=labels, colors=["r--", "c", "b"], xlabel="time ($t$)", ylabel="Avg. excited state popu. $\\bar{\\rho}_{ee}(t)$", lw=2, alphaspacing=0.02) # In the second subplot, we need to calculate the effective decay rate Nlst = [7, 9, 11, 15, 19, 25, 35, 45] xs, ys = gather_data(Nlst) from scipy.optimize import curve_fit def exponenial_func(x, k): return np.exp(-k * x)
t_QM, p1_QM, p2_QM = get_popu_data(path+"traj_QM.txt") t_MMST, p1_MMST, p2_MMST = get_popu_data(path+"traj_MultiEh.txt") xs = [t_MMST /np.pi, t_QM / np.pi] y1s = [p1_MMST, p1_QM] y2s = [p2_MMST, p2_QM] labels = ["MMST", "QM"] colors1 = ["r--", "k--"] colors2 = ["r", "k"] ax = clp.initialize(col=1, row=1, width=4.3, fontsize=12, LaTeX=True) clp.plotone(xs, y1s, ax, colors=colors1, alphaspacing=0.0, lw=2) clp.plotone(xs, y2s, ax, labels=labels, colors=colors2, xlabel="time ($t$)", ylabel="Electronic population", alphaspacing=0.0, lw=2) # Plot x-axis as a function of PI def format_func(value, tick_number): # find number of multiples of pi/2 N = value if N == 0: return "0" else: return r"${0}\pi$".format(N) ax.xaxis.set_major_formatter(FuncFormatter(format_func)) # output figure
width=4.3, height=4.3 * 0.618 * 2, fontsize=12, LaTeX=True, labelthem=True, labelthemPosition=[0.04, 0.95]) # For the first plot, gather many trajs xs, ys = get_N_trajs(path=path, Ntraj=5, Natoms=35) x_avg, y_avg = gather_dpdt([35]) clp.plotone(xs, ys, axes[0], labels=["No.%d MMST traj N=35" % (i + 1) for i in range(len(xs))], xlabel="time ($t$)", ylabel="$d\\bar{\\rho}_{ee}/dt$", lw=1.5, xlim=[-0.005, 0.2], ylim=[-10, 105]) clp.plotone(x_avg, y_avg, axes[0], colors=["b"], labels=["MMST avg traj N=35"], xlabel="time ($t$)", ylabel="$d\\bar{\\rho}_{ee}/dt$", lw=3, xlim=[-0.005, 0.2], ylim=[-10, 105])
return xnew, ynew def calc_analytical(xs, ys, Nlst): xnew, ynew = xs, [] for i in range(len(xs)): x, y = xs[i], ys[i] N = Nlst[i] td = x[np.argmax(y)] y_analytical = kFGR * N / 4.0 * np.cosh(kFGR*N / 2.0 * (x - td))**(-2) ynew.append(y_analytical) return xnew, ynew Nlst = [7, 35] labels = ["MMST N = %d" %N for N in Nlst] ax = clp.initialize(col=1, row=1, width=4.3, height=4.3*0.618, fontsize=12, LaTeX=True) xs, ys = gather_data(Nlst) xnew, dydt = calculate_derivative(xs,ys) clp.plotone(xnew, dydt, ax, labels=labels, colors=["c", "b"], xlabel="time ($t$)", ylabel="$d\\bar{\\rho}_{ee}/dt$", lw=2, xlim=[-0.005, 0.2]) xnew, dydt = calc_analytical(xnew,dydt, Nlst) labels = ["mean-field N = %d" %N for N in Nlst] clp.plotone(xnew, dydt, ax, labels=labels, colors=["k-.", "k--"], xlabel="time ($t$)", lw=2, xlim=[-0.005, 0.2], ylim=[-2, 30]) # output figure clp.adjust(tight_layout=True, savefile="SE_Dicke_delay_time.pdf")
LaTeX=True) N = 50 #average over 50 points for i in range(n): X = [data_EhR[:, 0], data_QM[:, 0]] X = [x / np.pi for x in X] Y = [data_EhR[:, i + 1], data_QM[:, i + 1]] Y = [(y + spacing_y * i) / spacing_y for y in Y] X_avg = [X[0][int(N / 2) - 1:-int(N / 2)]] Y_avg = [running_mean(Y[0], N)] X = X + X_avg Y = Y + Y_avg clp.plotone( X, Y, ax, colors=['r', "k--", "c-."], labels=["MMST", "QM", "coarse-grained MMST"] if i == 0 else None, alphaspacing=0.01, ylim=[-0.2, 12]) ax.set_xlabel("Cavity position") ax.set_ylabel("E-field Intensity (arbi. units)") def format_func(value, tick_number): # find number of multiples of pi/2 N = value if N == 0: return "0" else: return r"${0}\pi$".format(N)
] colors1 = ["b--", "g--", "r--", 'k--'] colors2 = ["b--", "g-.", "r", 'k--'] ax = clp.initialize(col=1, row=1, width=4.6, fontsize=12, LaTeX=True, sharex=True) clp.plotone(xs, y2s, ax, labels=labels, colors=colors2, xlabel="time (t)", ylabel="Excited state population", alphaspacing=0.0, lw=2, ylim=[-0.51, 2.0]) # Plot x-axis as a function of PI def format_func(value, tick_number): # find number of multiples of pi/2 N = value if N == 0: return "0" else: return r"${0}\pi$".format(N)
axes = clp.initialize(col=1, row=3, width=4.3 * 2, height=4.3 * 0.618, fontsize=12, LaTeX=True, sharey=True, labelthem=True, labelthemPosition=[0.13, 0.95]) xs, y2s = gather_data("SE_101TLS_FDTD_dx_25") clp.plotone(xs, y2s, axes[0], labels=labels, colors=colors2, xlabel="time ($t$)", ylabel="Excited state population", alphaspacing=0.1, lw=2) axes[0].set_title("101 TLSs, $a = \lambda/2$") xs, y2s = gather_data("SE_101TLS_FDTD_dx_13") clp.plotone(xs, y2s, axes[1], labels=labels, colors=colors2, xlabel="time ($t$)", alphaspacing=0.1, lw=2, showlegend=False)
spacing_y = np.max(np.max(data_QM[1:-1, :])) * 1.15 for i in range(n): X = [data_EhR[:, 0], data_QM[:, 0]] X = [x / np.pi for x in X] Y = [data_EhR[:, i + 1], data_QM[:, i + 1]] Y = [(y + spacing_y * i) / spacing_y for y in Y] X_avg = [X[0][int(N / 2) - 1:-int(N / 2)]] Y_avg = [running_mean(Y[0], N)] X = X + X_avg Y = Y + Y_avg for k in range(2): clp.plotone(X, Y, axes[k, j], colors=['r', "k--", "c-."], labels=["MMST", "QM", "coarse-grained MMST"] if (i == 0 and j == 0) else None, alphaspacing=0.01, ylim=[-0.2, 12], showlegend=True if (j == 0 and k == 0) else False, xlim=None if k == 0 else [0.9622, 1.0378]) axes[0, j].set_title(methods[j]) axes[1, j].set_xlabel("Cavity position") if j is 0: for k in range(2): axes[k, j].set_ylabel("E-field Intensity (arbi. units)") axes[0, j].xaxis.set_major_formatter(FuncFormatter(format_func)) axes[1, j].xaxis.set_major_formatter(FuncFormatter(format_func)) # Add arrow axes[0, -1].text(2.25, 5.0, 'time increment', rotation=90, color='b', size=12) #axes[1, -1].text(2.25, 5.0, 'time increment', rotation=90, color='b', size=12)
t_MMST, p1_MMST, p2_MMST = get_popu_data(path+"traj_MultiEh.txt") t_p, p1_p, p2_p = get_popu_data(path+"traj_PreBinSQC.txt") t_sed, p1_sed, p2_sed = get_popu_data(path+"traj_StochasticED.txt") xs = [t_p /np.pi, t_sed/np.pi, t_MMST / np.pi] y1s = [p1_p, p1_sed, p1_MMST] y2s = [p2_p, p2_sed, p2_MMST] labels = ["Sampling electronic ZPE (self-interaction)", "Sampling photonic ZPE (vacuum fluctuations)", "Sampling both (MMST)"] colors1 = ["b--", "g-.", "r"] colors2 = ["b--", "g--", "r--"] ax = clp.initialize(col=1, row=1, width=4.3, fontsize=10, LaTeX=True) clp.plotone(xs, y2s, ax, labels=labels, colors=colors1, xlabel="time ($t$)", ylabel="Excited state population", alphaspacing=0.0, lw=2, xlim=[0, 1.2], ylim=[-0.6, 1.0]) # Plot x-axis as a function of PI def format_func(value, tick_number): # find number of multiples of pi/2 N = int(value * 10) if N == 0: return "0" else: return r"${0}\pi$".format(N/10) ax.xaxis.set_major_formatter(FuncFormatter(format_func)) # output figure clp.adjust(tight_layout=True, savefile="ground_state_popu.pdf")
colors2 = ["r", "k--", "0.7"] axes = clp.initialize(col=1, row=2, width=4.3 * 1.5, height=4.3 * 0.618, fontsize=12, LaTeX=True, sharey=True) xs, y2s = gather_data("SE_1TLS_FDTD_near_mirror/dx_25") clp.plotone(xs, y2s, axes[0], labels=labels, colors=colors2, xlabel="time ($t$)", ylabel="Excited state population", alphaspacing=0.1, lw=2, xlim=[0, 1.0]) axes[0].set_title("1 TLS near mirror, $r = \lambda/2$") xs, y2s = gather_data("SE_1TLS_FDTD_near_mirror/dx_13") clp.plotone(xs, y2s, axes[1], labels=labels, colors=colors2, xlabel="time ($t$)", alphaspacing=0.1, lw=2, showlegend=False,
fontsize=12, LaTeX=True, labelthem=True, labelthemPosition=[0.10, 0.95]) # Subplot 1: decay dynamics for different spacing with N = 35 Nlst = [1, 7, 35] xs, ys = gather_data(Nlst, path="SE_Dicke_dx_13/") labels = ["N=%d, $a = \lambda / 4$" % N for N in Nlst] labels[0] = "N=1" colors = ["r--", "c", "b"] clp.plotone([x / kFGR for x in xs], ys, axes[0], labels=labels, colors=colors, xlabel="time ($t$)", ylabel="Avg. excited state popu. $\\bar{\\rho}_{ee}(t)$", lw=2, xlim=[-0.01, 1.5]) #, ylog=True, ylim= [6e-3, 2.0]) axes[0].xaxis.set_major_formatter(FuncFormatter(format_func)) # Subplot 2: effective decay rate as a function of spacing for N = 35 Nlst = [7, 9, 11, 15, 19, 25, 35, 45] xs, ys = gather_data(Nlst, path="SE_Dicke_dx_13/") from scipy.optimize import curve_fit def biexponenial_func(x, ks, kf, A): return A * np.exp(-ks * x) + (1.0 - A) * np.exp(-kf * x)