예제 #1
0
def main():
    nsite = 7
    nbath = 7

    kB = 0.69352  # in cm-1 / K
    hbar = 5308.8  # in cm-1 * fs

    # System Hamiltonian in cm-1
    ham_sys = np.array([[12410, -87.7, 5.5, -5.9, 6.7, -13.7, -9.9],
                        [-87.7, 12530, 30.8, 8.2, 0.7, 11.8, 4.3],
                        [5.5, 30.8, 12210, -53.5, -2.2, -9.6, 6.0],
                        [-5.9, 8.2, -53.5, 12320, -70.7, -17.0, -63.3],
                        [6.7, 0.7, -2.2, -70.7, 12480, 81.1, -1.3],
                        [-13.7, 11.8, -9.6, -17.0, 81.1, 12630, 39.7],
                        [-9.9, 4.3, 6.0, -63.3, -1.3, 39.7, 12440]])

    ham_sysbath = []
    for n in range(nbath):
        ham_sysbath_n = np.zeros((nsite, nsite))
        ham_sysbath_n[n, n] = 1.0
        ham_sysbath.append(ham_sysbath_n)

    K = 0
    for L in [1, 2, 4]:
        lamda = 35.0
        #tau = 50. # in fs
        tau = 166.  # in fs
        omega_c = 1.0 / tau
        for T in [300.]:
            kT = kB * T
            spec_densities = [['ohmic-lorentz', lamda, omega_c]] * nbath

            my_ham = ham.Hamiltonian(ham_sys,
                                     ham_sysbath,
                                     spec_densities,
                                     kT,
                                     hbar=hbar)
            my_heom = heom.HEOM(my_ham, L=L, K=K)

            for init in [6]:
                # Initial reduced density matrix of the system
                rho_0 = np.zeros((nsite, nsite))
                rho_0[init - 1, init - 1] = 1.0
                times, rhos_site = my_heom.propagate(rho_0, 0.0, 1000.0, 1.0)

                with open(
                        'pop_site_T-%.0f_init-%d_tau-%.0f_L-%d_K-%d.dat' %
                    (T, init, tau, L, K), 'w') as f:
                    for (time, rho_site) in zip(times, rhos_site):
                        f.write('%0.8f ' % (time))
                        for i in range(nsite):
                            f.write('%0.8f ' % (rho_site[i, i].real))
                        f.write('\n')
예제 #2
0
파일: driver.py 프로젝트: xuanleng/pyrho
def main():
    nsite = 2
    nbath = 2

    kB = 0.69352  # in cm-1 / K
    kT = kB * 300.0
    hbar = 5308.8  # in cm-1 * fs

    # System Hamiltonian
    ham_sys = np.array([[100.0, 100.0], [100.0, 0.0]])

    # System part of the the system-bath interaction
    # - a list of length 'nbath'
    # - currently assumes that each term has uncorrelated bath operators
    ham_sysbath = []
    ham_sysbath.append(np.array([[1.0, 0.0], [0.0, 0.0]]))
    ham_sysbath.append(np.array([[0.0, 0.0], [0.0, 1.0]]))

    # Initial reduced density matrix of the system
    rho_0 = np.array([[1.0, 0.0], [0.0, 0.0]])

    for lamda in [100. / 50, 100. / 5, 100., 500.]:
        for tau_c in [100., 500.]:
            omega_c = 1.0 / tau_c  # in 1/fs
            # Spectral densities - a list of length 'nbath'
            spec_densities = [['ohmic-lorentz', lamda, omega_c]] * nbath

            my_ham = ham.Hamiltonian(ham_sys,
                                     ham_sysbath,
                                     spec_densities,
                                     kT,
                                     hbar=hbar)

            for K in [0]:
                for L in [5, 9, 13]:
                    my_heom = heom.HEOM(my_ham, L=L, K=K)
                    times, rhos_site = my_heom.propagate(
                        rho_0, 0.0, 1000.0, 1.0)

                    with open(
                            'pop_site_tau-%0.1f_lam-%0.2f_L-%d_K-%d.dat' %
                        (tau_c, lamda, L, K), 'w') as f:
                        for (time, rho_site) in zip(times, rhos_site):
                            f.write('%0.8f %0.8f %0.8f\n' %
                                    (time, rho_site[0, 0].real,
                                     rho_site[1, 1].real))
예제 #3
0
def main():
    nsite = 2
    nbath = 1
    
    V = 0.5
    eps = 1 * V

    kT = V / 0.5 

    # System Hamiltonian
    ham_sys = np.array([[eps,   V ],
                        [ V,  -eps]])

    # System part of the the system-bath interaction
    # - a list of length 'nbath'
    # - currently assumes that each term has uncorrelated bath operators
    ham_sysbath = []
    ham_sysbath.append(np.array([[1.0, 0.0], 
                                 [0.0, -1.0]]))

    # Initial reduced density matrix of the system
    rho_0 = np.array([[1.0, 0.0],
                      [0.0, 0.0]])

    eta = 6 * V 
    omega_c = 2 * V
    lamda = eta * omega_c / (3.0 * 3.1416) * 2 
    # Spectral densities - a list of length 'nbath'
    spec_densities = [['cubic-exp', lamda, omega_c]]*nbath

    my_ham = ham.Hamiltonian(ham_sys, ham_sysbath, spec_densities, kT)

    for K in [0]:
        for L in [1,2]:
            my_heom = heom.HEOM(my_ham, L=L, K=K, L_truncation='TL')
            times, rhos_site = my_heom.propagate(rho_0, 0.0, 10.0/V, 0.01/V)

            with open('pop_site_lam-%0.2f_L-%d_K-%d.dat'%(lamda,L,K), 'w') as f:
                for (time, rho_site) in zip(times, rhos_site):
                    f.write('%0.8f %0.8f %0.8f\n'%(V*time, rho_site[0,0].real, 
                                                         rho_site[1,1].real))
예제 #4
0
def main():
    nbath = 2

    kB = 0.69352  # in cm-1 / K
    hbar = 5308.8  # in cm-1 * fs

    # System Hamiltonian
    # n = 0 is ground state

    # One-exciton Hamiltonian
    ham_sys_x = np.array([[-50., -100.], [-100., 50.]])
    # One-exciton sys-bath coupling
    nx = ham_sys_x.shape[0]
    ham_sysbath_x = []
    for b in range(nbath):
        ham_sysbath_b = np.zeros((nx, nx))
        for m in range(nx):
            ham_sysbath_b[m, m] = (m == b)
        ham_sysbath_x.append(ham_sysbath_b)
    # One-exciton dipole moments
    dipole_x = np.array([1., -0.2])

    # Important: expand the Hilbert space (convert to biexciton space)
    ham_sys, ham_sysbath, dipole = spec.convert_to_xx(ham_sys_x, ham_sysbath_x,
                                                      dipole_x)
    nsite = ham_sys.shape[0]

    lamda = 60.
    omega_c = 1. / 100.  # in 1/fs
    kT = kB * 77.

    spec_densities = [['ohmic-lorentz', lamda, omega_c]] * nbath

    my_ham = ham.Hamiltonian(ham_sys,
                             ham_sysbath,
                             spec_densities,
                             kT,
                             hbar=hbar)

    # Numerical propagation parameters
    t_final, dt = 500., 10.

    # Waiting time parameters
    T_init, T_final, dT = 0., 700., 100.

    rho_g = np.zeros((nsite, nsite))
    rho_g[0, 0] = 1.0

    for K in [1]:
        for L in [3]:
            my_method = heom.HEOM(my_ham, L=L, K=K)
            my_spec = spec.Spectroscopy(dipole, my_method)

            omegas, intensities = my_spec.absorption(-400., 400., 2., rho_g,
                                                     t_final, dt)

            with open(
                    'abs_HEOM_dt-%0.0f_tf-%0.0f_L-%d_K-%d.dat' %
                (dt, t_final, L, K), 'w') as f:
                for (omega, intensity) in zip(omegas, intensities):
                    f.write('%0.8f %0.8f\n' % (omega, intensity))

            omega1s, omega3s, t2s, spectra = my_spec.two_dimensional(
                -400., 400., 10., -400., 400., 10., T_init, T_final, dT, rho_g,
                t_final, dt)

            for t2, spectrum in zip(t2s, spectra):
                with open(
                        '2d_t2-%0.1f_HEOM_dt-%0.0f_tf-%0.0f_L-%d_K-%d.dat' %
                    (t2, dt, t_final, L, K), 'w') as f:
                    for w1 in range(len(omega1s)):
                        for w3 in range(len(omega3s)):
                            f.write(
                                '%0.8f %0.8f %0.8f\n' %
                                (omega1s[w1], omega3s[w3], spectrum[w3, w1]))
                        f.write('\n')
예제 #5
0
파일: driver.py 프로젝트: xuanleng/pyrho
def main():
    nsite = 3
    nbath = 2

    eps = 0.
    ham_sys = np.array([[0., 0., 0.], [0., eps, -1.], [0., -1., eps]])

    ham_sysbath = []
    for n in range(1, nsite):
        ham_sysbath_n = np.zeros((nsite, nsite))
        ham_sysbath_n[n, n] = 1.0
        ham_sysbath.append(ham_sysbath_n)

    rho_g = np.zeros((nsite, nsite))
    rho_g[0, 0] = 1.0

    dipole = np.array([[0., 1., 1.], [1., 0., 0.], [1., 0., 0.]])

    lamda = 1. / 2
    for omega_c in [0.1, 0.3, 1.0]:
        for beta in [1.0, 3.0]:
            kT = 1. / beta
            spec_densities = [['ohmic-lorentz', lamda, omega_c]] * nbath
            my_ham = ham.Hamiltonian(ham_sys, ham_sysbath, spec_densities, kT)

            for method in ['HEOM', 'TL', 'TNL']:
                emin, emax, de = -4 + eps, 4 + eps, 0.02
                t_final = 50.0
                dt = 0.05
                if method == 'HEOM':
                    # These are a bit underconverged; they are TNL(N=8) in the paper.
                    for L in [4]:
                        for K in [1]:
                            my_method = heom.HEOM(my_ham, L=L, K=K)
                            my_spec = spec.Spectroscopy(dipole, my_method)
                            omegas, intensities = my_spec.absorption(
                                emin, emax, de, rho_g, t_final, dt)

                            with open(
                                    'abs_omegac-%0.1f_beta-%0.1f_HEOM_L-%d_K-%d.dat'
                                    % (omega_c, beta, L, K), 'w') as f:
                                for (omega,
                                     intensity) in zip(omegas, intensities):
                                    f.write('%0.8f %0.8f\n' %
                                            (omega - eps, intensity))
                else:
                    if method == 'TL':
                        my_method = redfield.Redfield(my_ham, method='TCL2')
                    else:
                        my_method = redfield.Redfield(my_ham, method='TC2')
                        t_final = 100.0

                    my_spec = spec.Spectroscopy(dipole, my_method)
                    omegas, intensities = my_spec.absorption(
                        emin, emax, de, rho_g, t_final, dt)

                    with open(
                            'abs_omegac-%0.1f_beta-%0.1f_%s.dat' %
                        (omega_c, beta, method), 'w') as f:
                        for (omega, intensity) in zip(omegas, intensities):
                            f.write('%0.8f %0.8f\n' % (omega - eps, intensity))
예제 #6
0
파일: driver.py 프로젝트: xuanleng/pyrho
def main():
    nsys = 3
    nbath = 1

    kT = 1.0
    beta = 1.0 / kT
    hbar = 1.0

    K_list = [0]
    L_list = [2]
    single_harmonic = False
    # Propagate until equilibrium
    t_equil, dt = 2000., 0.1
    # Propagate to retrieve TCF
    T_init, T_final, dT = 0., 2000.0, 0.1
    e_min, e_max, de = -2., +2., 0.01  # in unit of energy, cm-1

    # Spectral densities - a list of length 'nbath'
    sd_type = 'custom'
    file_Jw = '../02_spectral_density/Data_fitted_Jw_parameters_updated_iteration03'
    N_lorentz = 3
    p_list, w_list, g_list = read_Jparameters(file_Jw, N_lorentz)
    customPara = [p_list, w_list, g_list]  # a 2d list
    spec_densities = [['custom', customPara]] * nbath

    File_Hs_DVR = '../01_DVR/Matrix_Hs'
    File_rho_0 = '../01_DVR/Matrix_rho_0'
    File_X_operator_DVR = '../01_DVR/Matrix_q_operator'

    # System Hamiltonian, should be in unit of cm-1
    ham_sys = read_2DMatrix(File_Hs_DVR, nsys)
    # position operator
    position = read_2DMatrix(File_X_operator_DVR, nsys)
    # System part of the the system-bath interaction
    # - a list of length 'nbath'
    # - currently assumes that each term has uncorrelated bath operators
    ham_sysbath = []
    ham_sysbath.append(position)

    # Initial reduced density matrix of the system
    rho_0 = read_2DMatrix(File_rho_0, nsys)

    my_ham = ham.Hamiltonian(ham_sys,
                             ham_sysbath,
                             spec_densities,
                             kT,
                             hbar=hbar)
    for K in K_list:
        for L in L_list:
            my_method = heom.HEOM(my_ham, L=L, K=K)
            my_equilTCF = equilTCF.EquilibriumTCF(position, my_method)

            # First step: Equilibrate Dynamics
            rho_hierarchy_equil, time1s, rhos_DVR = my_equilTCF.EquilibrateDynamics(
                rho_0, t_equil, dt)
            with open(
                    'pop_beta-%0.2f_dt-%0.2f_teqil-%0.0f_L-%d_K-%d_' %
                (beta, dt, t_equil, L, K) + sd_type + '_500.dat', 'w') as f:
                for (time, rho_DVR) in zip(time1s, rhos_DVR):
                    f.write('%0.8f ' % (time))
                    for i in range(nsys):
                        f.write('%0.8f ' % (rho_DVR[i, i].real))
                    f.write('\n')

            # Second step: Evaluate TCF
            if single_harmonic == True:
                spec_densities = [[sd_type, 0.0, omega_c]] * nbath
                my_ham = ham.Hamiltonian(ham_sys,
                                         ham_sysbath,
                                         spec_densities,
                                         kT,
                                         hbar=hbar)
                my_method = heom.HEOM(my_ham, L=L, K=K)
                my_equilTCF = equilTCF.EquilibriumTCF(position, my_method)
            time2s, Ct, Ct_damp, omegas, Cw, Cw_damp, Dw = my_equilTCF.EvaluateTCF(
                rho_hierarchy_equil, T_init, T_final, dT, e_min, e_max, de)

            with open(
                    'Ct_beta-%0.2f_teqil-%0.0f_dT-%0.3f_Tfinal-%0.0f_L-%d_K-%d.dat'
                    % (beta, t_equil, dT, T_final, L, K), 'w') as f1:
                for (t, intensity) in zip(time2s, Ct):
                    f1.write('%0.8f %0.8f %0.8f\n' %
                             (t, intensity.real, intensity.imag))
            with open(
                    'CtDamp_beta-%0.2f_teqil-%0.0f_dT-%0.3f_Tfinal-%0.0f_L-%d_K-%d.dat'
                    % (beta, t_equil, dT, T_final, L, K), 'w') as f2:
                for (t, intensity) in zip(time2s, Ct_damp):
                    f2.write('%0.8f %0.8f %0.8f\n' %
                             (t, intensity.real, intensity.imag))
            with open(
                    'Cw_beta-%0.2f_teqil-%0.0f_dT-%0.3f_Tfinal-%0.0f_L-%d_K-%d.dat'
                    % (beta, t_equil, dT, T_final, L, K), 'w') as f3:
                for (omega, intensity) in zip(omegas, Cw):
                    f3.write('%0.8f %0.8f\n' % (omega, intensity))
            with open(
                    'CwDamp_beta-%0.2f_teqil-%0.0f_dT-%0.3f_Tfinal-%0.0f_L-%d_K-%d.dat'
                    % (beta, t_equil, dT, T_final, L, K), 'w') as f3:
                for (omega, intensity) in zip(omegas, Cw_damp):
                    f3.write('%0.8f %0.8f\n' % (omega, intensity))
            with open(
                    'Dw_beta-%0.2f_teqil-%0.0f_dT-%0.3f_Tfinal-%0.0f_L-%d_K-%d.dat'
                    % (beta, t_equil, dT, T_final, L, K), 'w') as f5:
                for (omega, intensity) in zip(omegas, Dw):
                    f5.write('%0.8f %0.8f %0.8f\n' %
                             (omega, intensity.real, intensity.imag))