lime/oqs.py
def _correlation_2p_1t(H, rho0, ops, c_ops, dt, Nt, method='lindblad', output='cor.dat'):
    """
    compute the time-translation invariant two-point correlation function in the
    density matrix formalism using quantum regression theorem

        <A(t)B> = Tr[ A U(t) (B rho0)  U^\dag(t)]

    input:
    ========
    H: 2d array
        full Hamiltonian

    rho0: initial density matrix

    ops: list of operators [A, B] for computing the correlation functions

    method: str
        dynamics method e.g. lindblad, redfield, heom

    args: dictionary of parameters for dynamics

    Returns
    ========
    the density matrix is stored in 'dm.dat'
    'cor.dat': the correlation function is stored
    """
    #nstates =  H.shape[-1] # number of states in the system

    # initialize the density matrix
    A, B = ops
    rho = B.dot(rho0)

    f = open(output, 'w')
    # f_dm = open('dm.dat', 'w')
    # fmt = '{} ' * (H.size + 1) + '\n' # format to store the density matrix

    # dynamics

    t = 0.0
    cor = np.zeros(Nt, dtype=complex)

    # sparse matrix
    H = csr_matrix(H)
    rho = csr_matrix(rho)

    A = csr_matrix(A)

    c_ops_sparse = [csr_matrix(c_op) for c_op in c_ops]

    if method == 'lindblad':

        for k in range(Nt):

            t += dt

            rho = rk4(rho, liouvillian, dt, H, c_ops_sparse)

            # cor = A.dot(rho).diagonal().sum()
            tmp = obs_dm(rho, A)
            cor[k] = tmp
            # store the reduced density matrix
            f.write('{} {} \n'.format(t, tmp))

            # f_dm.write(fmt.format(t, *np.ravel(rho)))

            # f_dm.write(fmt.format(t, *np.ravel(rho.toarray())))

    else:
        sys.exit('The method {} has not been implemented yet! Please \
                 try lindblad.'.format(method))

    f.close()
    # f_dm.close()

    return cor

    compute the time-translation invariant two-point correlation function in the
    density matrix formalism using quantum regression theorem

        <A(t)B> = Tr[ A U(t) (B rho0)  U^\dag(t)]

    input:
    ========
    H: 2d array
        full Hamiltonian

    rho0: initial density matrix

    ops: list of operators [A, B] for computing the correlation functions

    method: str
        dynamics method e.g. lindblad, redfield, heom

    args: dictionary of parameters for dynamics

    Returns
    ========
    the density matrix is stored in 'dm.dat'
    'cor.dat': the correlation function is stored
    
compute the time-translation invariant two-point correlation function in the
density matrix formalism using quantum regression theorem





2d array
full Hamiltonian

initial density matrix

list of operators [A, B] for computing the correlation functions



dictionary of parameters for dynamics

Returns

the density matrix is stored in 'dm.dat'
'cor.dat': the correlation function is stored
compute the time - translation invariant two - point correlation function in the density matrix formalism using quantum regression theorem 2d array full Hamiltonian initial density matrix list of operators [ A B ] for computing the correlation functions dictionary of parameters for dynamics Returns the density matrix is stored in ' dm . dat ' ' cor . dat ' : the correlation function is stored
def _correlation_2p_1t(H, rho0, ops, c_ops, dt, Nt, method='lindblad', output='cor.dat'):
    A, B = ops
    rho = B.dot(rho0)
    f = open(output, 'w')
    t = 0.0
    cor = np.zeros(Nt, dtype=complex)
    H = csr_matrix(H)
    rho = csr_matrix(rho)
    A = csr_matrix(A)
    c_ops_sparse = [csr_matrix(c_op) for c_op in c_ops]
    if method == 'lindblad':
        for k in range(Nt):
            t += dt
            rho = rk4(rho, liouvillian, dt, H, c_ops_sparse)
            tmp = obs_dm(rho, A)
            cor[k] = tmp
            f.write('{} {} \n'.format(t, tmp))
    else:
        sys.exit('The method {} has not been implemented yet! Please \
                 try lindblad.'.format(method))
    f.close()
    return cor
def _correlation_2p_1t ( H , rho0 , ops , c_ops , dt , Nt , method = 'lindblad' , output = 'cor.dat' ) : A , B = ops rho = B . dot ( rho0 ) f = open ( output , 'w' ) t = 0.0 cor = np . zeros ( Nt , dtype = complex ) H = csr_matrix ( H ) rho = csr_matrix ( rho ) A = csr_matrix ( A ) c_ops_sparse = [ csr_matrix ( c_op ) for c_op in c_ops ] if method == 'lindblad' : for k in range ( Nt ) : t += dt rho = rk4 ( rho , liouvillian , dt , H , c_ops_sparse ) tmp = obs_dm ( rho , A ) cor [ k ] = tmp f . write ( '{} {} \n' . format ( t , tmp ) ) else : sys . exit ( 'The method {} has not been implemented yet! Please \
                 try lindblad.' . format ( method ) ) f . close ( ) return cor
compute the time-translation invariant two-point correlation function in the
density matrix formalism using quantum regression theorem
compute the time - translation invariant two - point correlation function in the density matrix formalism using quantum regression theorem
"""
    compute the time-translation invariant two-point correlation function in the
    density matrix formalism using quantum regression theorem

        <A(t)B> = Tr[ A U(t) (B rho0)  U^\dag(t)]

    input:
    ========
    H: 2d array
        full Hamiltonian

    rho0: initial density matrix

    ops: list of operators [A, B] for computing the correlation functions

    method: str
        dynamics method e.g. lindblad, redfield, heom

    args: dictionary of parameters for dynamics

    Returns
    ========
    the density matrix is stored in 'dm.dat'
    'cor.dat': the correlation function is stored
    """ #nstates =  H.shape[-1] # number of states in the system # initialize the density matrix # f_dm = open('dm.dat', 'w') # fmt = '{} ' * (H.size + 1) + '\n' # format to store the density matrix # dynamics # sparse matrix # cor = A.dot(rho).diagonal().sum() # store the reduced density matrix # f_dm.write(fmt.format(t, *np.ravel(rho))) # f_dm.write(fmt.format(t, *np.ravel(rho.toarray()))) # f_dm.close()
H
rho0
ops
c_ops
dt
Nt
method
output