Exemplo n.º 1
0
def calc_2D_spectrum_3rd(q_func, g_func, h1_func, h2_func, h4_func, h5_func,
                         corr_func_freq_qm, dipole_mom, delay_time,
                         delay_index, E_min1, E_max1, E_min2, E_max2,
                         num_points_2D, mean):
    full_2D_spectrum = np.zeros((num_points_2D, num_points_2D, 3))
    counter1 = 0
    counter2 = 0
    step_length = ((E_max1 - E_min1) / num_points_2D)
    print('Compute rfunc')
    rfunc = calc_Rfuncs_tdelay(q_func, delay_time, delay_index)
    print('Compute rfunc 3rd')
    rfunc_3rd = calc_Rfuncs_3rd_tdelay(g_func, h1_func, h2_func, h4_func,
                                       h5_func, corr_func_freq_qm, delay_time,
                                       delay_index)
    print('DONE')
    print('DIMENSIONS of RFUNC and RFUNC_3rd:')
    print(rfunc.shape[0], rfunc_3rd.shape[0])
    while counter1 < num_points_2D:
        counter2 = 0
        omega1 = E_min1 + counter1 * step_length
        while counter2 < num_points_2D:
            omega2 = E_min2 + counter2 * step_length
            full_2D_integrant = twoD_spectrum_integrant_3rd(
                rfunc, rfunc_3rd, q_func, omega1 - mean, omega2 - mean,
                delay_time)
            full_2D_spectrum[counter1, counter2, 0] = omega1
            full_2D_spectrum[counter1, counter2, 1] = omega2
            full_2D_spectrum[counter1, counter2, 2] = (np.dot(
                dipole_mom, dipole_mom))**2.0 * cumul.simpson_integral_2D(
                    full_2D_integrant).real
            counter2 = counter2 + 1
        counter1 = counter1 + 1

    return full_2D_spectrum
Exemplo n.º 2
0
def calc_2DES_time_series_morse_list(morse_list, g2_solvent, E_min1, E_max1,
                                     E_min2, E_max2, num_points_2D, rootname,
                                     num_times, time_step):
    averaged_val = np.zeros((num_times, 2))
    # make sure chosen delay times break down into an integer number of timesteps in the response function
    step_length_t = (g2_solvent[1, 0] - g2_solvent[0, 0]).real
    eff_time_index_2DES = int(round(time_step / step_length_t))
    eff_time_step_2DES = eff_time_index_2DES * step_length_t

    current_delay = 0.0
    current_delay_index = 0
    counter = 0
    while counter < num_times:
        print(counter, current_delay)
        spectrum_2D = calc_2D_spectrum_exact_morse_list(
            morse_list, g2_solvent, current_delay, current_delay_index, E_min1,
            E_max1, E_min2, E_max2, num_points_2D)
        twoDES.print_2D_spectrum(rootname + '_2DES_' + str(counter) + '.dat',
                                 spectrum_2D, False)

        averaged_val[counter, 0] = current_delay
        averaged_val[counter, 1] = cumul.simpson_integral_2D(spectrum_2D)
        counter = counter + 1
        current_delay = current_delay + eff_time_step_2DES
        current_delay_index = current_delay_index + eff_time_index_2DES

    np.savetxt(rootname + '_Morse_averaged_spectrum.txt', averaged_val)
Exemplo n.º 3
0
def calc_2DES_time_series_batch(q_batch, dipole_batch, num_batches, E_min1,
                                E_max1, E_min2, E_max2, num_points_2D,
                                rootname, num_times, time_step, mean):
    averaged_val = np.zeros((num_times, 2))
    transient_abs = np.zeros((num_times, num_points_2D, 3))

    # make sure chosen delay times break down into an integer number of timesteps in the response function
    step_length_t = ((q_batch[0])[1, 0] - (q_batch[0])[0, 0]).real
    eff_time_index_2DES = int(round(time_step / step_length_t))
    eff_time_step_2DES = eff_time_index_2DES * step_length_t

    current_delay = 0.0
    current_delay_index = 0
    counter = 0
    while counter < num_times:
        print(counter, current_delay)
        spectrum_2D = np.zeros((num_points_2D, num_points_2D, 3))
        batch_count = 0
        while batch_count < num_batches:
            print('Processing batch number ' + str(batch_count + 1))
            spectrum_2D_temp = calc_2D_spectrum(q_batch[batch_count],
                                                dipole_batch[batch_count],
                                                current_delay,
                                                current_delay_index, E_min1,
                                                E_max1, E_min2, E_max2,
                                                num_points_2D, mean)
            if batch_count == 0:
                spectrum_2D = spectrum_2D + spectrum_2D_temp
            else:
                spectrum_2D[:, :,
                            2] = spectrum_2D[:, :, 2] + spectrum_2D_temp[:, :,
                                                                         2]
            batch_count = batch_count + 1
        spectrum_2D[:, :, 2] = spectrum_2D[:, :, 2] / (1.0 * num_batches)
        print_2D_spectrum(rootname + '_2DES_' + str(counter) + '.dat',
                          spectrum_2D, False)

        #compute transient absorption contribution here:
        transient_temp = transient_abs_from_2DES(spectrum_2D)
        transient_abs[counter, :, 0] = current_delay
        transient_abs[counter, :, 1] = transient_temp[:, 0]
        transient_abs[counter, :, 2] = transient_temp[:, 1]

        averaged_val[counter, 0] = current_delay
        averaged_val[counter, 1] = cumul.simpson_integral_2D(spectrum_2D)
        print(averaged_val[counter, 1])
        counter = counter + 1
        current_delay = current_delay + eff_time_step_2DES
        current_delay_index = current_delay_index + eff_time_index_2DES

    print_2D_spectrum(
        rootname + '_2nd_order_cumulant_transient_absorption_spec.txt',
        transient_abs, False)
    np.savetxt(rootname + '_2DES_2nd_order_cumulant_averaged_spectrum.txt',
               averaged_val)
Exemplo n.º 4
0
def compute_HT_term_3rd_order(corr_func_mu_U_U_freq,corr_func_U_U_mu_freq,corr_func_mu_U_mu_freq,mu_av,mu_renorm,mu_reorg,kBT,max_t,steps):
	Afunc=np.zeros((steps,2),dtype=np.complex_)
	step_length=max_t/steps
	for i in range(steps):
		t_current=i*step_length
		Afunc[i,0]=t_current
		integrant1=HT_integrant_U_U_mu(corr_func_U_U_mu_freq,mu_reorg,mu_renorm,mu_av,kBT,t_current)	
		integrant2=HT_integrant_mu_U_mu(corr_func_mu_U_mu_freq,mu_renorm,kBT,t_current)
		integrant3=HT_integrant_mu_U_U(corr_func_mu_U_U_freq,mu_reorg,mu_renorm,kBT,t_current)
		tot_integrant=integrant1
		tot_integrant[:,:,2]=tot_integrant[:,:,2]-1j*integrant2[:,:,2]+integrant3[:,:,2]
		Afunc[i,1]=cumulant.simpson_integral_2D(tot_integrant)


	Afunc[:,1]=Afunc[:,1]*mu_renorm**2.0
	return Afunc
Exemplo n.º 5
0
def calc_2DES_time_series_GBOM_3rd(q_func, g_func, h1_func, h2_func, h4_func,
                                   h5_func, corr_func, freqs_gs, Omega_sq,
                                   gamma, kbT, dipole_mom, E_min1, E_max1,
                                   E_min2, E_max2, num_points_2D, rootname,
                                   num_times, time_step, mean, is_cl, no_dusch,
                                   four_phonon_term):
    averaged_val = np.zeros((num_times, 2))
    transient_abs = np.zeros((num_times, num_points_2D, 3))

    # make sure chosen delay times break down into an integer number of timesteps in the response function
    step_length_t = (q_func[1, 0] - q_func[0, 0]).real
    eff_time_index_2DES = int(round(time_step / step_length_t))
    eff_time_step_2DES = eff_time_index_2DES * step_length_t

    current_delay = 0.0
    current_delay_index = 0
    counter = 0
    while counter < num_times:
        print(counter, current_delay)
        spectrum_2D = calc_2D_spectrum_GBOM_3rd(
            q_func, g_func, h1_func, h2_func, h4_func, h5_func, corr_func,
            freqs_gs, Omega_sq, gamma, kbT, dipole_mom, current_delay,
            current_delay_index, E_min1, E_max1, E_min2, E_max2, num_points_2D,
            mean, is_cl, no_dusch, four_phonon_term)
        print_2D_spectrum(rootname + '_2DES_' + str(counter) + '.dat',
                          spectrum_2D, False)

        #compute transient absorption contribution here:
        transient_temp = transient_abs_from_2DES(spectrum_2D)
        transient_abs[counter, :, 0] = current_delay
        transient_abs[counter, :, 1] = transient_temp[:, 0]
        transient_abs[counter, :, 2] = transient_temp[:, 1]

        averaged_val[counter, 0] = current_delay
        averaged_val[counter, 1] = cumul.simpson_integral_2D(spectrum_2D)

        counter = counter + 1
        current_delay = current_delay + eff_time_step_2DES
        current_delay_index = current_delay_index + eff_time_index_2DES

    print_2D_spectrum(
        rootname + '_3rd_order_cumulant_transient_absorption_spec.txt',
        transient_abs, False)
    np.savetxt(rootname + '2DES_3rd_order_cumulant_averaged_spectrum.txt',
               averaged_val)
Exemplo n.º 6
0
def calc_2D_spectrum(q_func, dipole_mom, delay_time, delay_index, E_min1,
                     E_max1, E_min2, E_max2, num_points_2D, mean):
    full_2D_spectrum = np.zeros((num_points_2D, num_points_2D, 3))
    step_length = ((E_max1 - E_min1) / num_points_2D)

    rfunc = calc_Rfuncs_tdelay(q_func, delay_time, delay_index)
    for counter1 in range(num_points_2D):
        omega1 = E_min1 + counter1 * step_length
        for counter2 in range(num_points_2D):
            omega2 = E_min2 + counter2 * step_length
            full_2D_integrant = twoD_spectrum_integrant(
                rfunc, q_func, omega1 - mean, omega2 - mean, delay_time)
            full_2D_spectrum[counter1, counter2, 0] = omega1
            full_2D_spectrum[counter1, counter2, 1] = omega2
            full_2D_spectrum[counter1, counter2, 2] = (np.dot(
                dipole_mom, dipole_mom))**2.0 * cumul.simpson_integral_2D(
                    full_2D_integrant).real

    return full_2D_spectrum
Exemplo n.º 7
0
def calc_2DES_time_series(q_func, dipole_mom, E_min1, E_max1, E_min2, E_max2,
                          num_points_2D, rootname, num_times, time_step, mean):
    averaged_val = np.zeros((num_times, 2))
    transient_abs = np.zeros((num_times, num_points_2D, 3))

    # make sure chosen delay times break down into an integer number of timesteps in the response function
    step_length_t = (q_func[1, 0] - q_func[0, 0]).real
    eff_time_index_2DES = int(round(time_step / step_length_t))
    eff_time_step_2DES = eff_time_index_2DES * step_length_t

    current_delay = 0.0
    current_delay_index = 0
    counter = 0
    while counter < num_times:
        print(counter, current_delay)
        spectrum_2D = calc_2D_spectrum(q_func, dipole_mom, current_delay,
                                       current_delay_index, E_min1, E_max1,
                                       E_min2, E_max2, num_points_2D, mean)
        print_2D_spectrum(rootname + '_2DES_' + str(counter) + '.dat',
                          spectrum_2D, False)

        #compute transient absorption contribution here:
        transient_temp = transient_abs_from_2DES(spectrum_2D)
        transient_abs[counter, :, 0] = current_delay
        transient_abs[counter, :, 1] = transient_temp[:, 0]
        transient_abs[counter, :, 2] = transient_temp[:, 1]

        averaged_val[counter, 0] = current_delay
        averaged_val[counter, 1] = cumul.simpson_integral_2D(spectrum_2D)
        #averaged_val[counter,1]=np.sum(spectrum_2D[:,:,2])/(spectrum_2D.shape[0]*2.0)
        print(averaged_val[counter, 1])
        counter = counter + 1
        current_delay = current_delay + eff_time_step_2DES
        current_delay_index = current_delay_index + eff_time_index_2DES

    print_2D_spectrum(
        rootname + '_2nd_order_cumulant_transient_absorption_spec.txt',
        transient_abs, False)
    np.savetxt(rootname + '_2DES_2nd_order_cumulant_averaged_spectrum.txt',
               averaged_val)
Exemplo n.º 8
0
def calc_2D_spectrum_GBOM_3rd(q_func, g_func, h1_func, h2_func, h4_func,
                              h5_func, corr_func, freqs_gs, Omega_sq, gamma,
                              kbT, dipole_mom, delay_time, delay_index, E_min1,
                              E_max1, E_min2, E_max2, num_points_2D, mean,
                              is_cl, no_dusch, four_phonon_term):
    full_2D_spectrum = np.zeros((num_points_2D, num_points_2D, 3))
    counter1 = 0
    counter2 = 0
    step_length = ((E_max1 - E_min1) / num_points_2D)
    print('Compute rfunc')
    rfunc = calc_Rfuncs_tdelay(q_func, delay_time, delay_index)
    print('Compute rfunc 3rd')
    rfunc_3rd = calc_Rfuncs_3rd_GBOM_tdelay(g_func, h1_func, h2_func, h4_func,
                                            h5_func, corr_func, freqs_gs,
                                            Omega_sq, gamma, kbT, delay_time,
                                            delay_index, is_cl, no_dusch,
                                            four_phonon_term)

    print('DONE')
    print('Dimensions RFunc and Rfunc 3rd')
    print(rfunc.shape[0], rfunc_3rd.shape[0])

    while counter1 < num_points_2D:
        counter2 = 0
        omega1 = E_min1 + counter1 * step_length
        while counter2 < num_points_2D:
            omega2 = E_min2 + counter2 * step_length
            full_2D_integrant = twoD_spectrum_integrant_3rd(
                rfunc, rfunc_3rd, q_func, omega1 - mean, omega2 - mean,
                delay_time)
            full_2D_spectrum[counter1, counter2, 0] = omega1
            full_2D_spectrum[counter1, counter2, 1] = omega2
            full_2D_spectrum[counter1, counter2, 2] = (np.dot(
                dipole_mom, dipole_mom))**2.0 * cumul.simpson_integral_2D(
                    full_2D_integrant).real
            counter2 = counter2 + 1
        counter1 = counter1 + 1

    return full_2D_spectrum
Exemplo n.º 9
0
def calc_2D_spectrum_exact_morse(gs_energies, ex_energies, overlap,
                                 boltzmann_fac, g2_solvent, delay_time,
                                 delay_index, E_min1, E_max1, E_min2, E_max2,
                                 num_points_2D):
    full_2D_spectrum = np.zeros((num_points_2D, num_points_2D, 3))
    step_length = ((E_max1 - E_min1) / num_points_2D)

    rfunc = total_Rfuncs_exact(gs_energies, ex_energies, overlap, g2_solvent,
                               delay_time, delay_index)

    for counter1 in range(num_points_2D):
        omega1 = E_min1 + counter1 * step_length
        for counter2 in range(num_points_2D):
            omega2 = E_min2 + counter2 * step_length
            full_2D_integrant = twoD_spectrum_integrant_morse(
                rfunc, omega1, omega2, delay_time)
            full_2D_spectrum[counter1, counter2, 0] = omega1
            full_2D_spectrum[counter1, counter2, 1] = omega2
            full_2D_spectrum[counter1, counter2,
                             2] = cumul.simpson_integral_2D(
                                 full_2D_integrant).real

    return full_2D_spectrum
Exemplo n.º 10
0
def calc_2D_spectrum_exact_morse_list(morse_list, g2_solvent, delay_time,
                                      delay_index, E_min1, E_max1, E_min2,
                                      E_max2, num_points_2D):
    full_2D_spectrum = np.zeros((num_points_2D, num_points_2D, 3))
    step_length = ((E_max1 - E_min1) / num_points_2D)
    num_steps = g2_solvent.shape[0]
    max_t = g2_solvent[num_steps - 1, 0]

    rfunc = total_Rfuncs_exact_list(morse_list, g2_solvent, delay_time,
                                    delay_index)
    for counter1 in range(num_points_2D):
        omega1 = E_min1 + counter1 * step_length
        for counter2 in range(num_points_2D):
            omega2 = E_min2 + counter2 * step_length
            full_2D_integrant = twoD_spectrum_integrant_morse(
                rfunc, omega1, omega2, delay_time)
            full_2D_spectrum[counter1, counter2, 0] = omega1
            full_2D_spectrum[counter1, counter2, 1] = omega2
            full_2D_spectrum[counter1, counter2,
                             2] = cumul.simpson_integral_2D(
                                 full_2D_integrant).real

    return full_2D_spectrum
Exemplo n.º 11
0
def calc_2D_spectrum_Eopt_av_cumul(q_func_list, dipole_list, delay_time,
                                   delay_index, E_min1, E_max1, E_min2, E_max2,
                                   num_points_2D, mean_fluct):
    full_2D_spectrum = np.zeros((num_points_2D, num_points_2D, 3))
    counter1 = 0
    counter2 = 0
    step_length = ((E_max1 - E_min1) / num_points_2D)
    # work out size of Rfuncs:
    temp_max_index = q_func_list[0].shape[0] - delay_index
    max_index = 0
    if (temp_max_index % 2) == 0:
        # even.
        max_index = temp_max_index / 2
    else:
        # odd
        max_index = (temp_max_index - 1) / 2

    print(delay_time, delay_index)
    print(E_min1, E_max1)
    # build rfunc list:
    exp_rfunc_av = np.zeros((max_index, max_index, 4), dtype=complex)
    for i in range(len(q_func_list)):
        rfuncs_temp = calc_Rfuncs_tdelay(q_func_list[i], delay_time,
                                         delay_index)
        exp_rfunc_av[:, :, 0] = rfuncs_temp[:, :, 0]
        exp_rfunc_av[:, :, 1] = rfuncs_temp[:, :, 1]
        exp_rfunc_av[:, :, 2] = exp_rfunc_av[:, :, 2] + (
            np.exp(rfuncs_temp[:, :, 2]) + np.exp(rfuncs_temp[:, :, 5]))
        exp_rfunc_av[:, :, 3] = exp_rfunc_av[:, :, 3] + (
            np.exp(rfuncs_temp[:, :, 3]) + np.exp(rfuncs_temp[:, :, 4]))

    # now divide by batch number
    exp_rfunc_av[:, :, 2] = exp_rfunc_av[:, :, 2] / (1.0 * len(q_func_list))
    exp_rfunc_av[:, :, 3] = exp_rfunc_av[:, :, 3] / (1.0 * len(q_func_list))

    # now use rfuncs_av to compute spectrum
    for i in range(len(q_func_list)):
        temp_spec = np.zeros(
            (full_2D_spectrum.shape[0], full_2D_spectrum.shape[1], 3))
        counter1 = 0
        while counter1 < num_points_2D:
            counter2 = 0
            omega1 = E_min1 + counter1 * step_length
            while counter2 < num_points_2D:
                omega2 = E_min2 + counter2 * step_length
                full_2D_integrant = twoD_spectrum_integrant_Eopt_av_cumulant(
                    exp_rfunc_av, q_func_list[i], omega1 - mean_fluct[i],
                    omega2 - mean_fluct[i], delay_time)
                temp_spec[counter1, counter2, 0] = omega1
                temp_spec[counter1, counter2, 1] = omega2
                temp_spec[counter1, counter2, 2] = (np.dot(
                    dipole_list[i], dipole_list[i]
                ))**2.0 * cumul.simpson_integral_2D(full_2D_integrant).real
                counter2 = counter2 + 1
            counter1 = counter1 + 1
        full_2D_spectrum[:, :, 0] = temp_spec[:, :, 0]
        full_2D_spectrum[:, :, 1] = temp_spec[:, :, 1]
        # write temp spec to file:
        full_2D_spectrum[:, :,
                         2] = full_2D_spectrum[:, :, 2] + temp_spec[:, :, 2]
    full_2D_spectrum[:, :,
                     2] = full_2D_spectrum[:, :, 2] / (1.0 * len(q_func_list))

    return full_2D_spectrum