lime/oqs.py
def _redfield_old(nstates, rho0, c_ops, h0, Nt, dt,e_ops, env):
    """
    time propagation of the Redfield equation with second-order differencing
    input:
        nstate: total number of states
        h0: system Hamiltonian
        Nt: total number of time steps
        dt: tiem step
        c_ops: list of collapse operators
        e_ops: list of observable operators
        rho0: initial density matrix
    """
    t = 0.0

    print('Total number of states in the system = {}'.format(nstates))

    # initialize the density matrix
    rho = rho0

    # properties of the environment
    T = env.T
    cutfreq = env.cutfreq
    reorg = env.reorg

    #f = open(fname,'w')
    fmt = '{} '* (len(e_ops) + 1) + '\n'

    # construct system-bath operators in H_SB

    # short time approximation
    # Lambda = 0.5 * reorg * T * ((hop - Delta)/cutfreq**2 * sigmay + 1./cutfreq * sigmaz)

    # constuct the Lambda operators needed in Redfield equation
    l_ops = []
    for c_op in c_ops:
        l_ops.append(getLambda(nstates, h0, c_op, T, cutfreq, reorg))

    f_dm = open('den_mat.dat', 'w')
    f_obs = open('obs.dat', 'w')

    t = 0.0
    dt2 = dt/2.0

    # first-step
    rho_half = rho0 + func(rho0, h0, c_ops, l_ops) * dt2
    rho1 = rho0 + func(rho_half, h0, c_ops, l_ops) * dt

    rho_old = rho0
    rho = rho1

    for k in range(Nt):

        t += dt

        rho_new = rho_old + func(rho, h0, c_ops, l_ops) * 2. * dt

        # update rho_old
        rho_old = rho
        rho = rho_new

        # dipole-dipole auto-corrlation function
        #cor = np.trace(np.matmul(d, rho))

        # store the reduced density matrix
        f_dm.write('{} '* (nstates**2 + 1) + '\n'.format(t, *rho))

        # take a partial trace to obtain the rho_el
        obs = np.zeros(len(e_ops))
        for i, obs_op in enumerate(e_ops):
            obs[i] = observe(obs_op, rho)

        f_obs.write(fmt.format(t * au2fs, *obs))


    f_obs.close()
    f_dm.close()

    return rho

    time propagation of the Redfield equation with second-order differencing
    input:
        nstate: total number of states
        h0: system Hamiltonian
        Nt: total number of time steps
        dt: tiem step
        c_ops: list of collapse operators
        e_ops: list of observable operators
        rho0: initial density matrix
    
time propagation of the Redfield equation with second-order differencing
input:
nstate: total number of states
h0: system Hamiltonian
Nt: total number of time steps
dt: tiem step
c_ops: list of collapse operators
e_ops: list of observable operators
rho0: initial density matrix
time propagation of the Redfield equation with second - order differencing input : nstate : total number of states h0 : system Hamiltonian Nt : total number of time steps dt : tiem step c_ops : list of collapse operators e_ops : list of observable operators rho0 : initial density matrix
def _redfield_old(nstates, rho0, c_ops, h0, Nt, dt,e_ops, env):
    t = 0.0
    print('Total number of states in the system = {}'.format(nstates))
    rho = rho0
    T = env.T
    cutfreq = env.cutfreq
    reorg = env.reorg
    fmt = '{} '* (len(e_ops) + 1) + '\n'
    l_ops = []
    for c_op in c_ops:
        l_ops.append(getLambda(nstates, h0, c_op, T, cutfreq, reorg))
    f_dm = open('den_mat.dat', 'w')
    f_obs = open('obs.dat', 'w')
    t = 0.0
    dt2 = dt/2.0
    rho_half = rho0 + func(rho0, h0, c_ops, l_ops) * dt2
    rho1 = rho0 + func(rho_half, h0, c_ops, l_ops) * dt
    rho_old = rho0
    rho = rho1
    for k in range(Nt):
        t += dt
        rho_new = rho_old + func(rho, h0, c_ops, l_ops) * 2. * dt
        rho_old = rho
        rho = rho_new
        f_dm.write('{} '* (nstates**2 + 1) + '\n'.format(t, *rho))
        obs = np.zeros(len(e_ops))
        for i, obs_op in enumerate(e_ops):
            obs[i] = observe(obs_op, rho)
        f_obs.write(fmt.format(t * au2fs, *obs))
    f_obs.close()
    f_dm.close()
    return rho
def _redfield_old ( nstates , rho0 , c_ops , h0 , Nt , dt , e_ops , env ) : t = 0.0 print ( 'Total number of states in the system = {}' . format ( nstates ) ) rho = rho0 T = env . T cutfreq = env . cutfreq reorg = env . reorg fmt = '{} ' * ( len ( e_ops ) + 1 ) + '\n' l_ops = [ ] for c_op in c_ops : l_ops . append ( getLambda ( nstates , h0 , c_op , T , cutfreq , reorg ) ) f_dm = open ( 'den_mat.dat' , 'w' ) f_obs = open ( 'obs.dat' , 'w' ) t = 0.0 dt2 = dt / 2.0 rho_half = rho0 + func ( rho0 , h0 , c_ops , l_ops ) * dt2 rho1 = rho0 + func ( rho_half , h0 , c_ops , l_ops ) * dt rho_old = rho0 rho = rho1 for k in range ( Nt ) : t += dt rho_new = rho_old + func ( rho , h0 , c_ops , l_ops ) * 2. * dt rho_old = rho rho = rho_new f_dm . write ( '{} ' * ( nstates ** 2 + 1 ) + '\n' . format ( t , * rho ) ) obs = np . zeros ( len ( e_ops ) ) for i , obs_op in enumerate ( e_ops ) : obs [ i ] = observe ( obs_op , rho ) f_obs . write ( fmt . format ( t * au2fs , * obs ) ) f_obs . close ( ) f_dm . close ( ) return rho
time propagation of the Redfield equation with second-order differencing
input:
nstate: total number of states
h0: system Hamiltonian
Nt: total number of time steps
dt: tiem step
c_ops: list of collapse operators
e_ops: list of observable operators
rho0: initial density matrix
time propagation of the Redfield equation with second - order differencing input : nstate : total number of states h0 : system Hamiltonian Nt : total number of time steps dt : tiem step c_ops : list of collapse operators e_ops : list of observable operators rho0 : initial density matrix
"""
    time propagation of the Redfield equation with second-order differencing
    input:
        nstate: total number of states
        h0: system Hamiltonian
        Nt: total number of time steps
        dt: tiem step
        c_ops: list of collapse operators
        e_ops: list of observable operators
        rho0: initial density matrix
    """ # initialize the density matrix # properties of the environment #f = open(fname,'w') # construct system-bath operators in H_SB # short time approximation # Lambda = 0.5 * reorg * T * ((hop - Delta)/cutfreq**2 * sigmay + 1./cutfreq * sigmaz) # constuct the Lambda operators needed in Redfield equation # first-step # update rho_old # dipole-dipole auto-corrlation function #cor = np.trace(np.matmul(d, rho)) # store the reduced density matrix # take a partial trace to obtain the rho_el
nstates
rho0
c_ops
h0
Nt
dt
e_ops
env