示例#1
0
文件: driver.py 项目: xuanleng/pyrho
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]])

    # System part of the the system-bath interaction
    # - a list of length 'nbath'
    # - currently assumes that each term has uncorrelated bath operators
    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 )

    # Spectral densities - a list of length 'nbath'
    lamda = 35.0
    for [tau,T] in [[50.,77.], [50.,300.], [166.,300.]]:
    #for [tau,T] in [[50.,77.]]:
        omega_c = 1.0/tau # in 1/fs 
        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_ehrenfest = ehrenfest.Ehrenfest(my_ham, nmode=200, ntraj=500)

        #for init in [1]:
        for init in [1, 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, rhos_eig = my_ehrenfest.propagate(rho_0, 0.0, 1000.0, 0.5)

            with open('pop_site_tau-%.0f_T-%.0f_init-%d.dat'
                       %(tau,T,init), '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')

            with open('pop_eig_tau-%.0f_T-%.0f_init-%d.dat'
                       %(tau,T,init), 'w') as f:
                for (time, rho_eig) in zip(times, rhos_eig):
                    f.write('%0.8f '%(time))
                    for i in range(nsite):
                        f.write('%0.8f '%(rho_eig[i,i].real))
                    f.write('\n')
示例#2
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')
示例#3
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 method in ['Redfield', 'TCL2']:
                my_redfield = redfield.Redfield(my_ham, method=method)
                times, rhos_site, rhos_eig = my_redfield.propagate(
                    rho_0, 0.0, 1000.0, 1.0)

                with open(
                        'pop_site_%s_tau-%0.1f_lam-%0.2f.dat' %
                    (method, tau_c, lamda), 'w') as f:
                    for (time, rho_site,
                         rho_eig) in zip(times, rhos_site, rhos_eig):
                        f.write(
                            '%0.8f %0.8f %0.8f\n' %
                            (time, rho_site[0, 0].real, rho_site[1, 1].real))
示例#4
0
文件: driver.py 项目: xuanleng/pyrho
def main():
    nsite = 2
    nbath = 1

    # System Hamiltonian
    ham_sys = np.array([[1.0, 1.0], [1.0, -1.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, -1.0]]))

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

    for alpha in [0.1, 0.2, 0.4]:
        # Spectral densities - a list of length 'nbath'
        omega_c = 7.5
        lamda = alpha * omega_c / 2.0
        spec_densities = [['ohmic-exp', lamda, omega_c]] * nbath
        kT = 0.2

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

        for method in ['Redfield', 'TCL2', 'TC2']:
            if method == 'Redfield':
                is_secular = True
            else:
                is_secular = False
            my_redfield = redfield.Redfield(my_ham,
                                            method=method,
                                            is_secular=is_secular)
            times, rhos_site, rhos_eig = my_redfield.propagate(
                rho_0, 0.0, 14.0, 0.05)

            with open('pop_site_%s_alpha-%0.2f.dat' % (method, alpha),
                      'w') as f:
                for (time, rho_site, rho_eig) in zip(times, rhos_site,
                                                     rhos_eig):
                    f.write('%0.8f %0.8f %0.8f\n' %
                            (time, rho_site[0, 0].real, rho_site[1, 1].real))
示例#5
0
文件: driver.py 项目: xuanleng/pyrho
def main():
    nsite = 1 + 2
    nbath = 2

    eps = 0.

    # System Hamiltonian
    # n = 0 is ground state
    ham_sys = np.array([[0., 0., 0.], [0., eps, -1.], [0., -1., eps]])

    # System part of the the system-bath interaction
    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 operator connecting the ground state to the excited states
    dipole = np.array([[0., 1., 1.], [1., 0., 0.], [1., 0., 0.]])

    lamda = 0.5
    omega_c = 1.0
    beta = 3.0
    kT = 1. / beta
    spec_densities = [['ohmic-lorentz', lamda, omega_c]] * nbath

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

    my_redfield = redfield.Redfield(my_ham, method='Redfield', is_secular=True)
    dt = 0.05
    t_final = 50.0

    my_spec = spec.Spectroscopy(dipole, my_redfield)
    omegas, intensities = my_spec.absorption(-4. + eps, 4. + eps, 0.02, rho_g,
                                             0., t_final, dt)

    with open('abs_omegac-%0.1f_beta-%0.1f.dat' % (omega_c, beta), 'w') as f:
        for (omega, intensity) in zip(omegas, intensities):
            f.write('%0.8f %0.8f\n' % (omega - eps, intensity))
示例#6
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))
示例#7
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')
示例#8
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))
示例#9
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))
示例#10
0
def main():
    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

            #TODO(TCB): Make this cleaner. Write a Hamiltonian.copy() method?
            my_ham = ham.Hamiltonian(ham_sys,
                                     ham_sysbath,
                                     spec_densities,
                                     kT,
                                     hbar=hbar)
            my_ham_slow = ham.Hamiltonian(ham_sys,
                                          ham_sysbath,
                                          spec_densities,
                                          kT,
                                          hbar=hbar)
            my_ham_fast = ham.Hamiltonian(ham_sys,
                                          ham_sysbath,
                                          spec_densities,
                                          kT,
                                          hbar=hbar)

            ntraj = int(1e3)
            my_frozen = frozen.FrozenModes(my_ham_slow, nmode=300, ntraj=ntraj)
            times, rhos_site, rhos_eig = my_frozen.propagate(
                rho_0, 0.0, 1000.0, 1.0)
            my_redfield = redfield.Redfield(my_ham_fast, method='Redfield')

            my_hybrid = hybrid.Hybrid(my_ham,
                                      my_frozen,
                                      my_redfield,
                                      omega_split=None)
            times, rhos_site, rhos_eig = my_hybrid.propagate(
                rho_0, 0.0, 1000.0, 1.0)

            with open(
                    'pop_site_tau-%0.1f_lam-%0.2f_ntraj-%d.dat' %
                (tau_c, lamda, ntraj), 'w') as f:
                for (time, rho_site, rho_eig) in zip(times, rhos_site,
                                                     rhos_eig):
                    f.write('%0.8f %0.8f %0.8f\n' %
                            (time, rho_site[0, 0].real, rho_site[1, 1].real))