time_interval = 10
time = np.linspace(0, time_interval, 32000.*time_interval)
num_expansion_terms = 20
g_site, g_site_dot, g_site_dot_dot, total_site_reorg_energy = os.modified_redfield_params(time, site_reorg_energy, cutoff_freq, temperature, mode_params, num_expansion_terms)
total_site_reorg_energies = np.array([total_site_reorg_energy, total_site_reorg_energy])
rates_data = []
   
print 'Calculating rates with high energy modes....'
for V in coupling_values:
    print 'Calculating rates for coupling ' + str(V)
    rates = []
    for i,delta_E in enumerate(delta_E_values):
        site_hamiltonian = hamiltonian(delta_E, V) + np.diag(total_site_reorg_energies) # adjust site energies by reorganisation shift
        evals, evecs = utils.sorted_eig(site_hamiltonian)
        # calculate exciton reorganisation energies
        exciton_reorg_energies = np.array([os.exciton_reorg_energy(evecs[i], total_site_reorg_energies) for i in range(site_hamiltonian.shape[0])])
        print exciton_reorg_energies
        evals = evals - exciton_reorg_energies # adjust to bare exciton reorganisation energies
        MRT = os.modified_redfield_rates(evals, evecs, g_site, g_site_dot, g_site_dot_dot, total_site_reorg_energy, temperature, time)
        rates.append(MRT[0,1])
    rates_data.append(rates)
      
#np.savez('../../data/modified_redfield_test_high_energy_modes_data.npz', delta_E_values=delta_E_values, coupling_values=coupling_values, rates=rates_data)
for i,rates in enumerate(rates_data):
    plt.subplot(1,3,i+1)
    plt.plot(delta_E_values, utils.WAVENUMS_TO_INVERSE_PS*np.array(rates))
plt.show()

# data = np.load('../../data/modified_redfield_test_high_energy_modes_data.npz')
# rates = data['rates']
# delta_E_values = data['delta_E_values']
Пример #2
0
                                   temperature, single_mode_params, 100)
        lbf = os.site_lbf_ed(time, lbf_coeffs)
        lbf_dot = os.site_lbf_dot_ed(time, lbf_coeffs)
        lbf_dot_dot = os.site_lbf_dot_dot_ed(time, lbf_coeffs)
        print 'Finished calculating lbfs at ' + str(time_utils.getTime())
        np.savez(lbf_fn,
                 lbf=lbf,
                 lbf_dot=lbf_dot,
                 lbf_dot_dot=lbf_dot_dot,
                 time=time)

    # calculate MRT rates
    evals, evecs = utils.sorted_eig(hamiltonian[:6, :6])

    exciton_reorg_energies = np.array([
        os.exciton_reorg_energy(exciton, site_reorg_energies)
        for exciton in evecs
    ])
    # print evals - exciton_reorg_energies
    # evals,evecs = utils.sort_evals_evecs(evals-exciton_reorg_energies, evecs)
    # print evals

    # MRT_rates2 = os.modified_redfield_rates_general_unordered(evals-exciton_reorg_energies, evecs, lbf, lbf_dot, lbf_dot_dot, total_site_reorg_energy, temperature, time)
    #
    # liouvillian2 = MRT_rates2 - np.diag(np.sum(MRT_rates2, axis=0))
    #
    # print evals
    # print MRT_rates2

    print evals - exciton_reorg_energies
    #MRT_rates,evals,evecs = os.modified_redfield_rates_general(evals-exciton_reorg_energies, evecs, lbf, lbf_dot, lbf_dot_dot, total_site_reorg_energy, temperature, time)
Пример #3
0
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
        rates.append(
            os.modified_redfield_rates_general(
                evals, evecs, np.array([g_site, scaling * g_site]),
                np.array([g_site_dot, scaling * g_site_dot]),
                np.array([g_site_dot_dot, scaling * g_site_dot_dot]),
                np.array([reorg_energy, scaling * reorg_energy]), temperature,
                time)[0][0, 1])
        #rates.append(os.MRT_rates(hamiltonian(delta_E, V), np.array([reorg_energy, reorg_energy]), cutoff_freq, temperature, None)[0,1])
    plt.subplot(1, coupling_values.size, i + 1)
    rates_data.append(rates)
    plt.loglog(delta_E_values,
               np.array(rates) * utils.WAVENUMS_TO_INVERSE_PS,
Пример #4
0
    [18532., 18008., 17973., 18040., 18711., 19574., 19050.,
     18960.])  # no reorganisation shift included

couplings = np.array([[0, 1., -37., 37., 23., 92., -16., 12.],
                      [0, 0, 4., -11., 33., -39., -46., 3.],
                      [0, 0, 0, 45., 3., 2., -11., 34.],
                      [0, 0, 0, 0, -7., -17., -3., 6.],
                      [0, 0, 0, 0, 0, 18., 7., 6.],
                      [0, 0, 0, 0, 0, 0, 40., 26.], [0, 0, 0, 0, 0, 0, 0, 7.],
                      [0, 0, 0, 0, 0, 0, 0, 0]])

site_hamiltonian = np.diag(site_energies) + couplings + couplings.T

evals, evecs = utils.sorted_eig(site_hamiltonian)

site_reorg_shift = 110.
site_reorg_energies = np.zeros(site_energies.size)
site_reorg_energies.fill(site_reorg_shift)
shifted_site_hamiltonian = site_hamiltonian + np.diag(site_reorg_energies)

shifted_evals, shifted_evecs = utils.sorted_eig(shifted_site_hamiltonian)
exciton_reorg_energies = os.exciton_reorg_energy(shifted_evecs,
                                                 site_reorg_energies)

print evals
print shifted_evals - exciton_reorg_energies
print exciton_reorg_energies
for i, el in enumerate(evecs.flatten()):
    print shifted_evecs.flatten()[i] + 0.0000001 > el > shifted_evecs.flatten(
    )[i] - 0.0000001
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)
    else:
        hamiltonian = np.diag(realisation_energies + total_site_reorg_energy) + couplings + couplings.T # shift site energies by reorg energy
        evals, evecs = utils.sorted_eig(hamiltonian) # diagonalise
        site_reorg_energies = np.zeros(hamiltonian.shape[0])
        site_reorg_energies.fill(total_site_reorg_energy)
        exciton_reorg_energies = np.zeros(hamiltonian.shape[0])
        for i in range(hamiltonian.shape[0]):
            exciton_reorg_energies[i] = os.exciton_reorg_energy(evecs[i], site_reorg_energies) # calculate exciton reorg energies
        evals = evals - exciton_reorg_energies # shift exciton energies down by exciton reorg energies
        
    # calculate the rates and time evolution for the realisation
    realisation_rates = os.MRT_rate_PE545_quick(evals, evecs, g_site, g_site_dot, g_site_dot_dot, total_site_reorg_energy, temperature, integration_time)
    
    liouvillian = np.zeros((realisation_rates.shape[0], realisation_rates.shape[1]))
    for i,row in enumerate(realisation_rates.T):
        liouvillian[i,i] = -np.sum(row)
    liouvillian += realisation_rates
    
    # make sure to return excitons in basis going from lowest to highest energy with sorted_eig
    evecs = evecs.T
    init_dv = np.diag(np.dot(evecs.T, np.dot(np.diag(init_dv), evecs))) # convert init dv in site basis to exciton basis before time evolution calculation
    
    dv_history = te.liouvillian_time_evolution(init_dv, liouvillian, duration, timestep)
Пример #6
0
                               temperature, mode_params(mode_damping), 100)
    lbf = os.site_lbf_ed(time, lbf_coeffs)
    lbf_dot = os.site_lbf_dot_ed(time, lbf_coeffs)
    lbf_dot_dot = os.site_lbf_dot_dot_ed(time, lbf_coeffs)
    print 'Finished calculating lbfs at ' + str(time_utils.getTime())
    np.savez(lbf_fn,
             lbf=lbf,
             lbf_dot=lbf_dot,
             lbf_dot_dot=lbf_dot_dot,
             time=time)

# calculate MRT rates
evals, evecs = utils.sorted_eig(hamiltonian)

exciton_reorg_energies = np.array([
    os.exciton_reorg_energy(exciton, site_reorg_energies) for exciton in evecs
])
# print evals - exciton_reorg_energies
# evals,evecs = utils.sort_evals_evecs(evals-exciton_reorg_energies, evecs)
# print evals

reorgs = np.array([total_site_reorg_energy, total_site_reorg_energy, total_site_reorg_energy,\
                   total_site_reorg_energy, total_site_reorg_energy, total_site_reorg_energy,\
                   1.5*total_site_reorg_energy])

MRT_rates2 = os.modified_redfield_rates_general_unordered(evals-exciton_reorg_energies, evecs,
                                                          np.array([lbf,lbf,lbf,lbf,lbf,lbf,1.5*lbf]), \
                                                          np.array([lbf_dot,lbf_dot,lbf_dot,lbf_dot,lbf_dot,lbf_dot,1.5*lbf_dot]), \
                                                          np.array([lbf_dot_dot,lbf_dot_dot,lbf_dot_dot,lbf_dot_dot,lbf_dot_dot,lbf_dot_dot,1.5*lbf_dot_dot]), \
                                                          reorgs,\
                                                          temperature, time)
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
        rates.append(os.modified_redfield_rates_general(evals, evecs, np.array([g_site, scaling*g_site]), np.array([g_site_dot,scaling*g_site_dot]), np.array([g_site_dot_dot,scaling*g_site_dot_dot]), np.array([reorg_energy,scaling*reorg_energy]), temperature, time)[0][0,1])
        #rates.append(os.MRT_rates(hamiltonian(delta_E, V), np.array([reorg_energy, reorg_energy]), cutoff_freq, temperature, None)[0,1])
    plt.subplot(1, coupling_values.size, i+1)
    rates_data.append(rates)
    plt.loglog(delta_E_values, np.array(rates)*utils.WAVENUMS_TO_INVERSE_PS, label=V)
       
    # plot extracted data from Ed's thesis
#     xdata, ydata = np.loadtxt('../../data/thieved_data'+str(i)+'.txt', delimiter=', ', unpack=True)
#     plt.loglog(xdata, ydata, color='red')
    #s = interp.UnivariateSpline(xdata, ydata, k=2, s=None)
    #plt.loglog(xdata, s(xdata), color='red')
       
    plt.xlabel(r'$\Delta E$ (cm$^{-1}$)')
    plt.ylabel(r'rate')
Пример #8
0
# basis { PEB_50/61C, DBV_A, DVB_B, PEB_82C, PEB_158C, PEB_50/61D, PEB_82D, PEB_158D }
site_energies = np.array([18532., 18008., 17973., 18040., 18711., 19574., 19050., 18960.]) # no reorganisation shift included

couplings = np.array([[0, 1., -37., 37., 23., 92., -16., 12.],
                      [0, 0, 4., -11., 33., -39., -46., 3.],
                      [0, 0, 0, 45., 3., 2., -11., 34.],
                      [0, 0, 0, 0, -7., -17., -3., 6.],
                      [0, 0, 0, 0, 0, 18., 7., 6.],
                      [0, 0, 0, 0, 0, 0, 40., 26.],
                      [0, 0, 0, 0, 0, 0, 0, 7.],
                      [0, 0, 0, 0, 0, 0, 0, 0]])

site_hamiltonian = np.diag(site_energies) + couplings + couplings.T

evals, evecs = utils.sorted_eig(site_hamiltonian)

site_reorg_shift = 110.
site_reorg_energies = np.zeros(site_energies.size)
site_reorg_energies.fill(site_reorg_shift)
shifted_site_hamiltonian = site_hamiltonian + np.diag(site_reorg_energies)

shifted_evals, shifted_evecs = utils.sorted_eig(shifted_site_hamiltonian)
exciton_reorg_energies = os.exciton_reorg_energy(shifted_evecs, site_reorg_energies)

print evals
print shifted_evals - exciton_reorg_energies
print exciton_reorg_energies
for i,el in enumerate(evecs.flatten()):
    print shifted_evecs.flatten()[i] + 0.0000001 > el > shifted_evecs.flatten()[i] - 0.0000001

Пример #9
0
for n in range(num_realisations):
    print 'Calculating realisation ' + str(n + 1) + ' at time ' + str(
        datetime.now().time())

    # calculate Hamiltonian for this realisation ie. add site_shifts to average site energies and construct Hamiltonian
    site_hamiltonian = np.diag(
        average_site_energies + total_site_reorg_energy + site_shifts[n]
    ) + couplings + couplings.T  # now including reorganisation shift
    evals, evecs = utils.sorted_eig(
        site_hamiltonian
    )  # make sure to return excitons in basis going from lowest to highest energy with sorted_eig
    site_reorg_energies = np.zeros(site_hamiltonian.shape[0])
    site_reorg_energies.fill(total_site_reorg_energy)
    exciton_reorg_energies = np.zeros(site_hamiltonian.shape[0])
    for i in range(site_hamiltonian.shape[0]):
        exciton_reorg_energies[i] = os.exciton_reorg_energy(
            evecs[i], site_reorg_energies)  # calculate exciton reorg energies
    evals = evals - exciton_reorg_energies  # shift exciton energies down by exciton reorg energies

    # calculate modified Redfield rates
    rates = os.MRT_rate_PE545_quick(evals, evecs, g_site, g_site_dot,
                                    g_site_dot_dot, total_site_reorg_energy,
                                    temperature, integration_time)
    # construct Liouvillian for system
    liouvillian = np.zeros((rates.shape[0], rates.shape[1]))
    for i, row in enumerate(rates.T):
        liouvillian[i, i] = -np.sum(row)
    liouvillian += rates

    # calculate time evolution starting from provided initial state in exciton basis
    init_dv = exciton_init_states[n]
    dv_history = te.liouvillian_time_evolution(init_dv, liouvillian, duration,
     lbf_dot = data['lbf_dot']
     lbf_dot_dot = data['lbf_dot_dot']
     time = data['time']
 except IOError:
     print 'Starting lbf calculations at ' + str(time_utils.getTime())
     lbf_coeffs = os.lbf_coeffs(site_drude_reorg_energy, cutoff_freq, temperature, single_mode_params, 100)
     lbf = os.site_lbf_ed(time, lbf_coeffs)
     lbf_dot = os.site_lbf_dot_ed(time, lbf_coeffs)
     lbf_dot_dot = os.site_lbf_dot_dot_ed(time, lbf_coeffs)
     print 'Finished calculating lbfs at ' + str(time_utils.getTime())
     np.savez(lbf_fn, lbf=lbf, lbf_dot=lbf_dot, lbf_dot_dot=lbf_dot_dot, time=time)
 
 # calculate MRT rates
 evals,evecs = utils.sorted_eig(hamiltonian[:6,:6])
 
 exciton_reorg_energies = np.array([os.exciton_reorg_energy(exciton, site_reorg_energies) for exciton in evecs])
 # print evals - exciton_reorg_energies
 # evals,evecs = utils.sort_evals_evecs(evals-exciton_reorg_energies, evecs)
 # print evals
 
 # MRT_rates2 = os.modified_redfield_rates_general_unordered(evals-exciton_reorg_energies, evecs, lbf, lbf_dot, lbf_dot_dot, total_site_reorg_energy, temperature, time)
 # 
 # liouvillian2 = MRT_rates2 - np.diag(np.sum(MRT_rates2, axis=0))
 # 
 # print evals
 # print MRT_rates2
 
 print evals - exciton_reorg_energies
 #MRT_rates,evals,evecs = os.modified_redfield_rates_general(evals-exciton_reorg_energies, evecs, lbf, lbf_dot, lbf_dot_dot, total_site_reorg_energy, temperature, time)
 MRT_rates = os.modified_redfield_rates_general(evals-exciton_reorg_energies, evecs, lbf, lbf_dot, lbf_dot_dot, total_site_reorg_energy, temperature, time)[0]
 print evals
total_site_reorg_energies = np.array(
    [total_site_reorg_energy, total_site_reorg_energy])
rates_data = []

print 'Calculating rates with high energy modes....'
for V in coupling_values:
    print 'Calculating rates for coupling ' + str(V)
    rates = []
    for i, delta_E in enumerate(delta_E_values):
        site_hamiltonian = hamiltonian(delta_E, V) + np.diag(
            total_site_reorg_energies
        )  # adjust site energies by reorganisation shift
        evals, evecs = utils.sorted_eig(site_hamiltonian)
        # calculate exciton reorganisation energies
        exciton_reorg_energies = np.array([
            os.exciton_reorg_energy(evecs[i], total_site_reorg_energies)
            for i in range(site_hamiltonian.shape[0])
        ])
        print exciton_reorg_energies
        evals = evals - exciton_reorg_energies  # adjust to bare exciton reorganisation energies
        MRT = os.modified_redfield_rates(evals, evecs, g_site, g_site_dot,
                                         g_site_dot_dot,
                                         total_site_reorg_energy, temperature,
                                         time)
        rates.append(MRT[0, 1])
    rates_data.append(rates)

#np.savez('../../data/modified_redfield_test_high_energy_modes_data.npz', delta_E_values=delta_E_values, coupling_values=coupling_values, rates=rates_data)
for i, rates in enumerate(rates_data):
    plt.subplot(1, 3, i + 1)
    plt.plot(delta_E_values, utils.WAVENUMS_TO_INVERSE_PS * np.array(rates))
liouvillians = np.zeros((num_realisations, average_site_CT_energies.size, average_site_CT_energies.size))

site_init_state = np.array([0.07, 0.14, 0.79, 0.4, 0.58, 0.56, 0, 0])
normalisation = np.sum(site_init_state)
    
for n in range(num_realisations):
    
    if n % 100 == 0:
        print "Calculating for realisation " + str(n)
    
    hamiltonian = np.diag(energy_samples.T[n]) + couplings + couplings.T
    
    site_hamiltonian = hamiltonian[:6,:6]
    
    evals, evecs = utils.sorted_eig(site_hamiltonian)
    exciton_reorg_energies = np.array([os.exciton_reorg_energy(exciton, site_reorg_energies) for exciton in evecs])
    
    '''
    # remove reorg energy and reorder evals/evecs from lowest to highest energy
    evals, evecs = utils.sort_evals_evecs(evals-exciton_reorg_energies, evecs)
    
    # calculate modified Redfield rates
    MRT_rates = os.modified_redfield_rates_general(evals, evecs, lbf, lbf_dot, lbf_dot_dot, total_site_reorg_energy, temperature, time)[0]
    
    
    # need to reorder exciton_reorg_energies too! easier to just recalculate with new evecs
    exciton_reorg_energies = np.array([os.exciton_reorg_energy(exciton, site_reorg_energies) for exciton in evecs])
    '''
    
    '''
    temporary to test that this reproduces the results for incorrect ordering of exciton levels