def main(path_hams, s1, s2, ts, wsd, wdeph): if ts == 'All': files = glob.glob(os.path.join(path_hams, 'Ham_*_re')) ts = len(files) else: ts = int(ts) energies = read_energies(path_hams, ts) couplings = read_couplings(path_hams, ts) # Compute the energy difference between pair of states d_E = energies[:, s1] - energies[:, s2] # Generate a matrix with s1, s2 and diff between them en_states = np.column_stack((energies[:, s1], energies[:, s2], d_E)) # Compute autocorrelation function for each column (i.e. state) acf = np.stack( autocorrelate(en_states[:, i]) for i in range(en_states.shape[1])).transpose() # Compute the spectral density for each column using the normalized acf sd = np.stack( spectral_density(acf[:, 1, i]) for i in range(en_states.shape[1])).transpose() # Compute the dephasing time for the uncorrelated acf between two states deph, rate = dephasing(acf[:, 0, 2]) # Plot stuff plot_stuff(en_states, couplings, acf, sd, deph, rate, s1, s2, ts, wsd, wdeph)
def main(path_output, nstates, nconds, dt, sigma): outs = read_pops_pyxaid(path_output, 'out', nstates, nconds) energies = read_energies_pyxaid(path_output, 'me_energies', nstates, nconds) ################################## # Remove the ground state and scale the energies to the lowest excitation energy outs = outs[:, 1:, :] energies = energies[:, 1:, :] lowest_hl_gap = np.amin(energies, axis=1) highest_hl_gap = np.amax(energies, axis=1) # Convolute a gaussian for each timestep and for each initial condition x_grid = np.linspace(np.min(lowest_hl_gap), np.max(highest_hl_gap), 100) y_grid = np.stack( np.stack( convolute(energies[time, :, iconds], outs[time, :, iconds], x_grid, sigma) for time in range(energies.shape[0])) for iconds in range(nconds)) # Scale the energy for computing the excess energy plots energies_scaled = np.stack(energies[:, istate, :] - lowest_hl_gap for istate in range(nstates - 1)) energies_scaled = energies_scaled.swapaxes( 0, 1) # Just reshape to have the energies shape (time, nstates, nconds) x_grid_scaled = np.linspace(0, np.max(energies_scaled), 100) y_grid_scaled = np.stack( np.stack( convolute(energies_scaled[time, :, iconds], outs[time, :, iconds], x_grid_scaled, sigma) for time in range(energies_scaled.shape[0])) for iconds in range(nconds)) # This part is done ################################## # Compute weighted energies vs population at a given time t eav_outs = energies * outs el_ene_outs = np.sum(eav_outs, axis=1) # Scale them to the lowest excitation energy ene_outs_ref0 = el_ene_outs - lowest_hl_gap #Average over initial conditions ene_outs_ref0 = np.average(ene_outs_ref0, axis=1) el_ene_av = np.average(el_ene_outs, axis=1) ################################## # Compute autocorrelation function for consecutive pair of states d_en = np.stack(energies[:, istate, 0] - energies[:, istate - 1, 0] for istate in range(1, nstates - 1)) acf = np.stack( autocorrelate(d_en[istate, :]) for istate in range(d_en.shape[0])) # Compute spectral density nacf = acf[:, 1, :] sd = np.stack( spectral_density(nacf[istate, :], dt) for istate in range(d_en.shape[0])) ################################# # Call plotting function ts = np.arange(energies.shape[0]) plot_stuff(x_grid, y_grid, x_grid_scaled, y_grid_scaled, sd, el_ene_av, ene_outs_ref0, nconds, outs, energies, ts, dt)
def main(path_output, nstates, nconds, dt, sigma): outs = read_pops_pyxaid(path_output, 'out', nstates, nconds) energies = read_energies_pyxaid(path_output, 'me_energies', nstates, nconds) ################################## # Remove the ground state and scale the energies to the lowest excitation energy outs = outs[:, 1:, :] energies = energies[:, 1:, :] lowest_hl_gap = np.amin(energies, axis=1) highest_hl_gap = np.amax(energies, axis=1) # Convolute a gaussian for each timestep and for each initial condition x_grid = np.linspace(np.min(lowest_hl_gap), np.max(highest_hl_gap), 100) y_grid = np.stack(np.stack( convolute(energies[time, :, iconds], outs[time, :, iconds], x_grid, sigma) for time in range(energies.shape[0]) ) for iconds in range(nconds) ) # Scale the energy for computing the excess energy plots energies_scaled = np.stack(energies[:, istate, :] - lowest_hl_gap for istate in range(nstates-1)) energies_scaled = energies_scaled.swapaxes(0,1) # Just reshape to have the energies shape (time, nstates, nconds) x_grid_scaled = np.linspace(0, np.max(energies_scaled), 100) y_grid_scaled = np.stack(np.stack( convolute(energies_scaled[time, :, iconds], outs[time, :, iconds], x_grid_scaled, sigma) for time in range(energies_scaled.shape[0]) ) for iconds in range(nconds) ) # This part is done ################################## # Compute weighted energies vs population at a given time t eav_outs = energies * outs el_ene_outs = np.sum(eav_outs, axis=1) # Scale them to the lowest excitation energy ene_outs_ref0 = el_ene_outs - lowest_hl_gap #Average over initial conditions ene_outs_ref0 = np.average(ene_outs_ref0, axis=1) el_ene_av = np.average(el_ene_outs, axis = 1) ################################## # Compute autocorrelation function for consecutive pair of states d_en = np.stack(energies[:, istate, 0] - energies[:, istate-1, 0] for istate in range(1, nstates-1)) acf = np.stack(autocorrelate(d_en[istate, :]) for istate in range(d_en.shape[0])) # Compute spectral density nacf = acf[:, 1, :] sd = np.stack(spectral_density(nacf[istate, :], dt) for istate in range(d_en.shape[0])) ################################# # Call plotting function ts = np.arange(energies.shape[0]) plot_stuff(x_grid, y_grid, x_grid_scaled, y_grid_scaled, sd, el_ene_av, ene_outs_ref0, nconds, outs, energies, ts, dt)
def main(path_output, s1, s2, dt, wsd, wdeph): fn = 'me_energies0' # it is only necessary the first initial condition inpfile = os.path.join(path_output, fn) cols = (s1 * 2 + 5, s2 * 2 + 5) energies = np.loadtxt(inpfile, usecols=cols) # Compute the energy difference between pair of states d_E = energies[:, 0] - energies[:, 1] # Generate a matrix with s1, s2 and diff between them en_states = np.stack((energies[:, 0], energies[:, 1], d_E)) # Compute autocorrelation function for each column (i.e. state) acf = np.stack(autocorrelate(en_states[i, :]) for i in range(en_states.shape[0])).T # Take the transpose to have the correct shape for spectral_density # Compute the spectral density for each column using the normalized acf sd = np.stack(spectral_density(acf[:, 1, i], dt) for i in range(en_states.shape[0])) # Compute the dephasing time for the uncorrelated acf between two states deph, rate = dephasing(acf[:, 0, 2], dt) # Plot stuff plot_stuff(en_states, acf, sd, deph, rate, s1, s2, dt, wsd, wdeph)
def main(path_output, s1, s2, ts, nconds, wsd, wdeph): ts = int(ts) energies = read_energies(path_output, 'me_energies', s1, s2, nconds, ts) # Compute the energy difference between pair of states d_E = energies[0:ts, 0, :] - energies[0:ts, 1, :] # Generate a matrix with s1, s2 and diff between them en_states = np.stack((energies[0:ts, 0, :], energies[0:ts, 1, :], d_E)) # Compute autocorrelation function for each column (i.e. state) acf = np.stack( np.stack( autocorrelate(en_states[i, :, j]) for i in range(en_states.shape[0])) for j in range(nconds)).transpose() # Average the acf over initial conditions acf_av = np.average(acf, axis=3) # Compute the spectral density for each column using the normalized acf sd = np.stack( spectral_density(acf_av[:, 1, i]) for i in range(en_states.shape[0])).transpose() # Compute the dephasing time for the uncorrelated acf between two states deph, rate = dephasing(acf_av[:, 0, 2]) # Plot stuff plot_stuff(en_states, acf_av, sd, deph, rate, s1, s2, ts, wsd, wdeph)
def main(path_hams, s1, s2, dt, ts, wsd, wdeph): if ts == 'All': files = glob.glob(os.path.join(path_hams, 'Ham_*_re')) ts = len(files) else: ts = int(ts) energies = read_energies(path_hams, ts) couplings = read_couplings(path_hams, ts) # Compute the energy difference between pair of states d_E = energies[:, s1] - energies[:, s2] # Generate a matrix with s1, s2 and diff between them en_states = np.column_stack((energies[:, s1], energies[:, s2], d_E)) # Compute autocorrelation function for each column (i.e. state) acf = np.stack( autocorrelate(en_states[:, i]) for i in range(en_states.shape[1])).transpose() # Compute the spectral density for each column using the normalized acf sd = np.stack( spectral_density(acf[:, 1, i], dt) for i in range(en_states.shape[1])).transpose() # Compute the dephasing time for the uncorrelated acf between two states deph, rate = dephasing(acf[:, 0, 2], dt) # Plot stuff plot_stuff( en_states, couplings, acf, sd, deph, rate, s1, s2, ts, wsd, wdeph, dt)