time_propagator[1, 0] = k01 time_step = t[1] - t[0] dynamics = te.liouvillian_time_evolution(np.array([1, 0]), time_propagator, t[-1], time_step, wave_nums=False) return dynamics[:, 0] print '[Calculating Forster rates...]' print 'Started at: ' + str(time_utils.getTime()) for i, v in enumerate(reorg_energy_values): #print 'Calculating rates for reorg energy: ' + str(v) forster_time = np.linspace(0, 20., 16000) lbf = os.site_lbf_ed(forster_time, os.lbf_coeffs(v, cutoff_freq, temperature, None, 5)) forster_rates[i] = os.forster_rate(100., 0, v, v, lbf, lbf, 0, 0, np.array([1., 0]), np.array([0, 1.]), system_hamiltonian, forster_time) print 'Finished at: ' + str(time_utils.getTime()) def calculate_HEOM(reorg_energy): print reorg_energy system_hamiltonian = np.array([[100., 20.], [20., 0]]) cutoff_freq = 53. temperature = 300. hs = HierarchySolver(system_hamiltonian, environment(reorg_energy, beta, K), beta, N=trunc_level)
e1 = 1000.0 delta_E_values = np.logspace(0, 3.0, 100) # wavenumbers coupling_values = np.array([20.0, 100.0, 500.0]) # wavenumbers def hamiltonian(delta_E, V): return np.array([[delta_E / 2.0, V], [V, -delta_E / 2.0]]) reorg_energy = 100.0 # wavenumbers cutoff_freq = 53.0 # wavenumbers temperature = 300.0 time = np.linspace(0, 0.5, 1000) lbf_coeffs = os.lbf_coeffs(reorg_energy, cutoff_freq, temperature, None, 0) site_lbf = os.site_lbf_ed(time, lbf_coeffs) site_lbf_dot = os.site_lbf_dot_ed(time, lbf_coeffs) site_lbf_dot_dot = os.site_lbf_dot_dot_ed(time, lbf_coeffs) """ # comparison of reorganisation energy calculations exciton_reorg_energies1 = [] exciton_reorg_energies2 = [] for i,delta_E in enumerate(delta_E_values): evals, evecs = utils.sorted_eig(hamiltonian(delta_E, 20.)) exciton_reorg_energies1.append(os.generalised_exciton_reorg_energy(np.array([evecs[0], evecs[0], evecs[1], evecs[1]]), np.array([reorg_energy, reorg_energy]))) exciton_reorg_energies2.append(np.sum(evecs[0]**2 * evecs[1]**2) * reorg_energy) plt.plot(delta_E_values, exciton_reorg_energies1, label='1') plt.plot(delta_E_values, exciton_reorg_energies2, label='2', linewidth=2, ls='--', color='red') plt.legend()
reorg_energy = 100. # wavenumbers cutoff_freq = 53. # wavenumbers temperature = 300. # rates, integrands, time = os.MRT_rate_ed(hamiltonian(10.,500.), reorg_energy, cutoff_freq, temperature, None, 0, 60.0) # plt.plot(time, integrands[0,1]) # plt.show() # try to reproduce dimer rates using code copied from Mathematica rates_data = [] time_interval = 0.5 time = np.linspace(0, time_interval, int(time_interval * 2000)) lbf_coeffs = os.lbf_coeffs(reorg_energy, cutoff_freq, temperature, None, 0) g_site = os.site_lbf_ed(time, lbf_coeffs) g_site_dot = os.site_lbf_dot_ed(time, lbf_coeffs) g_site_dot_dot = os.site_lbf_dot_dot_ed(time, lbf_coeffs) scaling = 1. for i, V in enumerate(coupling_values): print 'calculating rates for coupling ' + str(V) rates = [] for delta_E in delta_E_values: evals, evecs = utils.sorted_eig(hamiltonian(delta_E, V)) print evals exciton_reorg_energies = np.array([ os.exciton_reorg_energy(exciton, [reorg_energy, reorg_energy]) for exciton in evecs ]) print exciton_reorg_energies
total_reorg_energy = 540. CT1_scaling = 3. CT2_scaling = 4. bare_chl_energy = system_hamiltonian[4,4] - total_reorg_energy bare_phe_energy = system_hamiltonian[6,6] - total_reorg_energy bare_CT1_energy = average_site_CT_energies[6] - total_reorg_energy*CT1_scaling bare_CT2_energy = average_site_CT_energies[7] - total_reorg_energy*CT2_scaling chl_state = np.array([0, 0, 1., 0, 0, 0, 0, 0]) phe_state = np.array([0, 0, 0, 0, 1., 0, 0, 0]) CT1_state = np.array([0, 0, 0, 0, 0, 0, 1., 0]) CT2_state = np.array([0, 0, 0, 0, 0, 0, 0, 1.]) time = np.linspace(0,2.,256000) site_lbf = os.site_lbf_ed(time, os.lbf_coeffs(reorg_energy, cutoff_freq, temperature, None, 100)) # primary CT rates in site basis chl_CT1_rate = os.forster_rate(bare_chl_energy, bare_CT1_energy, reorg_energy, reorg_energy*CT1_scaling, \ site_lbf, site_lbf*CT1_scaling, 0, 0, chl_state, CT1_state, coherent_hamiltonian, time) CT1_chl_rate = os.forster_rate(bare_CT1_energy, bare_chl_energy, reorg_energy, reorg_energy*CT1_scaling, \ site_lbf, site_lbf*CT1_scaling, 0, 0, chl_state, CT1_state, coherent_hamiltonian, time) phe_CT1_rate = os.forster_rate(bare_phe_energy, bare_CT1_energy, reorg_energy, reorg_energy*CT1_scaling, \ site_lbf, site_lbf*CT1_scaling, 0, 0, phe_state, CT1_state, coherent_hamiltonian, time) CT1_phe_rate = os.forster_rate(bare_CT1_energy, bare_phe_energy, reorg_energy, reorg_energy*CT1_scaling, \ site_lbf, site_lbf*CT1_scaling, 0, 0, phe_state, CT1_state, coherent_hamiltonian, time) forward_exciton_CT_rates = [2.86359127e+00, 2.09614196e-02, 7.89708095e+01, 5.47195323e+00, 2.91393623e+00, 2.92997893e-01] backward_exciton_CT_rates = [2.32445332e+00, 1.40848357e-02, 4.18754762e+01, 2.46325661e+00, 1.25847348e+00, 3.69904601e-02] # secondary CT rates
try: data = np.load(data_filename) print 'data file already exists, do you want to append to it?' except: pass time_interval = 10 integration_time = np.linspace(0, time_interval, time_interval*16000) # time_interval*16000 num_expansion_terms = 10 mode_params = PE545_mode_params(mode_damping) coeffs = os.lbf_coeffs(reorg_energy1, cutoff_freq1, temperature, mode_params, num_expansion_terms) coeffs = np.concatenate((coeffs, os.lbf_coeffs(reorg_energy2, cutoff_freq2, temperature, None, num_expansion_terms))) g_site = os.site_lbf_ed(integration_time, coeffs) g_site_dot = os.site_lbf_dot_ed(integration_time, coeffs) g_site_dot_dot = os.site_lbf_dot_dot_ed(integration_time, coeffs) total_site_reorg_energy = reorg_energy1 + reorg_energy2 + np.sum([mode[0]*mode[1] for mode in mode_params]) shift_before_diagonalisation = True # in each realisation pick the next value from the distribution for each site to construct the Hamiltonian for n in range(num_realisations): print 'Calculating realisation number ' + str(n+1) realisation_energies = np.zeros(site_energies.size) for i in range(site_energies.size): realisation_energies[i] = site_energy_samples[i][n] if not shift_before_diagonalisation: hamiltonian = np.diag(realisation_energies) + couplings + couplings.T evals, evecs = utils.sorted_eig(hamiltonian)
site_shifts = data['site_shift'] exciton_init_states = data['D0_save_ex'] num_realisations = site_shifts.shape[0] time_interval = 5 #10 integration_time = np.linspace(0, time_interval, time_interval * 32000) # 16000 num_expansion_terms = 40 mode_params = PE545_mode_params(mode_damping) coeffs = os.lbf_coeffs(reorg_energy1, cutoff_freq1, temperature, mode_params, num_expansion_terms) coeffs = np.concatenate( (coeffs, os.lbf_coeffs(reorg_energy2, cutoff_freq2, temperature, None, num_expansion_terms))) g_site = os.site_lbf_ed(integration_time, coeffs) g_site_dot = os.site_lbf_dot_ed(integration_time, coeffs) g_site_dot_dot = os.site_lbf_dot_dot_ed(integration_time, coeffs) total_site_reorg_energy = reorg_energy1 + reorg_energy2 + np.sum( [mode[0] * mode[1] for mode in mode_params]) # parameters for time evolution duration = 5. timestep = 0.01 time = np.arange(0, duration + timestep, timestep) #init_dv = np.array([0.35, 0.12, 0.1, 0.1, 0.34, 0.61, 0.46, 0.5]) # init state in site basis site_history_sum = np.zeros((average_site_hamiltonian.shape[0], time.size)) for n in range(num_realisations): print 'Calculating realisation ' + str(n + 1) + ' at time ' + str( datetime.now().time())
temperature = 300. init_state = np.array([[1., 0], [0, 0]]) hs = HierarchySolver(system_hamiltonian, 1., cutoff_freq, temperature) # error function for least squares fit def residuals(p, y, pops1, pops2): k12, k21 = p return y - (-k12*pops1 + k21*pops2) print '[Calculating Forster rates...]' print 'Started at: ' + str(time_utils.getTime()) for i,v in enumerate(reorg_energy_values): #print 'Calculating rates for reorg energy: ' + str(v) forster_time = np.linspace(0, 20., 16000) lbf = os.site_lbf_ed(forster_time, os.lbf_coeffs(v, cutoff_freq, temperature, None, 5)) forster_rates[i] = os.forster_rate(100., 0, v, v, lbf, lbf, 0, 0, np.array([1., 0]), np.array([0, 1.]), system_hamiltonian, forster_time) print 'Finished at: ' + str(time_utils.getTime()) def calculate_HEOM(reorg_energy): system_hamiltonian = np.array([[100., 20.], [20., 0]]) cutoff_freq = 53. temperature = 300. init_state = np.array([[1., 0], [0, 0]]) time_step = 0.00005 duration = 5. hs = HierarchySolver(system_hamiltonian, reorg_energy, cutoff_freq, temperature) HEOM_history, time = hs.hierarchy_time_evolution(init_state, 18, time_step, duration) return HEOM_history