Beispiel #1
0
 def __call__(self, energy, flag=None):
     if self.data_path is not None and flag is not None:
         nid = int(flag[2:])
         nid += self.nid_plus
         flag = str(flag[:2]) + str(nid)
         fd = file(self.data_path[self.direction] + '/' +
                   self.direction + '/' + flag, 'r')
         data = cPickle.load(fd)
         return data
     else:
         if self.energy is None or abs(energy - self.energy) > self.tol:
             self.energy = energy
             z = energy - self.bias         
             tau_ij = z * self.hsd_ij.S[self.pk].recover() - \
                                  self.hsd_ij.H[self.s][self.pk].recover()
             tau_ji = z * dagger(self.hsd_ij.S[self.pk].recover()) - \
                          dagger(self.hsd_ij.H[self.s][self.pk].recover())
             ginv = self.get_sgfinv(energy)
             a_ij = dot(ginv, tau_ij)
             mat = dot(tau_ji, a_ij)
             #if self.rotation_mat is not None:
             #    mat = np.dot(self.rotation_mat, mat)
             #    mat = np.dot(mat, self.rotation_mat.T)
             self.sigma = Banded_Sparse_Matrix(complex, mat,
                                         self.hsd_ii.S[self.pk].band_index)
         return self.sigma
Beispiel #2
0
 def get_sgfinv(self, energy):
     """The inverse of the retarded surface Green function"""
     z = energy - self.bias 
     v_00 = Banded_Sparse_Matrix(complex,
                                  None,
                                  self.hsd_ii.S[self.pk].band_index)
     
     v_00.reset_from_others(self.hsd_ii.S[self.pk],
                             self.hsd_ii.H[self.s][self.pk],
                             z, -1.0)
     
     v_11 = copy.deepcopy(v_00)
     
     v_10 = z * self.hsd_ij.S[self.pk].recover()- \
                                  self.hsd_ij.H[self.s][self.pk].recover()
     v_01 = z * dagger(self.hsd_ij.S[self.pk].recover()) - \
                           dagger(self.hsd_ij.H[self.s][self.pk].recover())
     delta = self.conv + 1
     while delta > self.conv:
         inv_v_11 = v_11.inv()
         a = dot(inv_v_11, v_01)
         b = dot(inv_v_11, v_10)
         v_01_dot_b = dot(v_01, b)
         v_00.reset_minus(v_01_dot_b, full=True)
         v_11.reset_minus(dot(v_10, a), full=True)
         v_11.reset_minus(v_01_dot_b, full=True)
         v_01 = -dot(v_01, a)
         v_10 = -dot(v_10, b)
         delta = np.abs(v_01).max()
     return v_00.inv()
Beispiel #3
0
    def get_left_channels(self, tp, energy, s, k):
        # to get the left scattering channel from lead to scattering region
        sigma = self.calculate_sigma(tp, s, k, energy)
        g_s_ii = self.calculate_green_function_of_k_point(tp, s, k, energy,
                                                          sigma, full=True)
        nb = g_s_ii.shape[-1]
        dtype = g_s_ii.dtype
        lambda_l_ii = np.zeros([nb, nb], dtype)
        lambda_r_ii = np.zeros([nb, nb], dtype)
        ind = get_matrix_index(tp.hsd.S[0].ll_index[0][-1])
        lambda_l_ii[ind.T, ind] = 1.j * (sigma[0].recover() -
                                                  sigma[0].recover().T.conj())
        ind = get_matrix_index(tp.hsd.S[0].ll_index[1][-1])        
        lambda_r_ii[ind.T, ind] = 1.j * (sigma[1].recover() -
                                                  sigma[1].recover().T.conj())
        s_mm = tp.hsd.S[k].recover()
        s_s_i, s_s_ii = np.linalg.eig(s_mm)
        s_s_i = np.abs(s_s_i)
        s_s_sqrt_i = np.sqrt(s_s_i) # sqrt of eigenvalues  
        s_s_sqrt_ii = np.dot(s_s_ii * s_s_sqrt_i, dagger(s_s_ii))
        s_s_isqrt_ii = np.dot(s_s_ii / s_s_sqrt_i, dagger(s_s_ii))

        lambdab_r_ii = np.dot(np.dot(s_s_isqrt_ii, lambda_r_ii),s_s_isqrt_ii)
        a_l_ii = np.dot(np.dot(g_s_ii, lambda_l_ii), dagger(g_s_ii))
        ab_l_ii = np.dot(np.dot(s_s_sqrt_ii, a_l_ii), s_s_sqrt_ii)
        lambda_i, u_ii = np.linalg.eig(ab_l_ii)
        ut_ii = np.sqrt(lambda_i / (2.0 * np.pi)) * u_ii
        m_ii = 2 * np.pi * np.dot(np.dot(dagger(ut_ii), lambdab_r_ii),ut_ii)
        T_i,c_in = np.linalg.eig(m_ii)
        T_i = np.abs(T_i)
        channels = np.argsort(-T_i)
        c_in = np.take(c_in, channels, axis=1)
        T_n = np.take(T_i, channels)
        v_in = np.dot(np.dot(s_s_isqrt_ii, ut_ii), c_in)
        return T_n, v_in
Beispiel #4
0
    def get_sgfinv(self, energy):
        """The inverse of the retarded surface Green function"""
        z = energy - self.bias
        v_00 = Banded_Sparse_Matrix(complex, None,
                                    self.hsd_ii.S[self.pk].band_index)

        v_00.reset_from_others(self.hsd_ii.S[self.pk],
                               self.hsd_ii.H[self.s][self.pk], z, -1.0)

        v_11 = copy.deepcopy(v_00)

        v_10 = z * self.hsd_ij.S[self.pk].recover()- \
                                     self.hsd_ij.H[self.s][self.pk].recover()
        v_01 = z * dagger(self.hsd_ij.S[self.pk].recover()) - \
                              dagger(self.hsd_ij.H[self.s][self.pk].recover())
        delta = self.conv + 1
        while delta > self.conv:
            inv_v_11 = v_11.inv()
            a = dot(inv_v_11, v_01)
            b = dot(inv_v_11, v_10)
            v_01_dot_b = dot(v_01, b)
            v_00.reset_minus(v_01_dot_b, full=True)
            v_11.reset_minus(dot(v_10, a), full=True)
            v_11.reset_minus(v_01_dot_b, full=True)
            v_01 = -dot(v_01, a)
            v_10 = -dot(v_10, b)
            delta = np.abs(v_01).max()
        return v_00.inv()
Beispiel #5
0
 def __call__(self, energy, flag=None):
     if self.data_path is not None and flag is not None:
         nid = int(flag[2:])
         nid += self.nid_plus
         flag = str(flag[:2]) + str(nid)
         fd = file(
             self.data_path[self.direction] + '/' + self.direction + '/' +
             flag, 'r')
         data = cPickle.load(fd)
         return data
     else:
         if self.energy is None or abs(energy - self.energy) > self.tol:
             self.energy = energy
             z = energy - self.bias
             tau_ij = z * self.hsd_ij.S[self.pk].recover() - \
                                  self.hsd_ij.H[self.s][self.pk].recover()
             tau_ji = z * dagger(self.hsd_ij.S[self.pk].recover()) - \
                          dagger(self.hsd_ij.H[self.s][self.pk].recover())
             ginv = self.get_sgfinv(energy)
             a_ij = dot(ginv, tau_ij)
             mat = dot(tau_ji, a_ij)
             #if self.rotation_mat is not None:
             #    mat = np.dot(self.rotation_mat, mat)
             #    mat = np.dot(mat, self.rotation_mat.T)
             self.sigma = Banded_Sparse_Matrix(
                 complex, mat, self.hsd_ii.S[self.pk].band_index)
         return self.sigma
Beispiel #6
0
    def get_left_channels(self, tp, energy, s, k):
        # to get the left scattering channel from lead to scattering region
        sigma = self.calculate_sigma(tp, s, k, energy)
        g_s_ii = self.calculate_green_function_of_k_point(tp,
                                                          s,
                                                          k,
                                                          energy,
                                                          sigma,
                                                          full=True)
        nb = g_s_ii.shape[-1]
        dtype = g_s_ii.dtype
        lambda_l_ii = np.zeros([nb, nb], dtype)
        lambda_r_ii = np.zeros([nb, nb], dtype)
        ind = get_matrix_index(tp.hsd.S[0].ll_index[0][-1])
        lambda_l_ii[ind.T, ind] = 1.j * (sigma[0].recover() -
                                         sigma[0].recover().T.conj())
        ind = get_matrix_index(tp.hsd.S[0].ll_index[1][-1])
        lambda_r_ii[ind.T, ind] = 1.j * (sigma[1].recover() -
                                         sigma[1].recover().T.conj())
        s_mm = tp.hsd.S[k].recover()
        s_s_i, s_s_ii = np.linalg.eig(s_mm)
        s_s_i = np.abs(s_s_i)
        s_s_sqrt_i = np.sqrt(s_s_i)  # sqrt of eigenvalues
        s_s_sqrt_ii = np.dot(s_s_ii * s_s_sqrt_i, dagger(s_s_ii))
        s_s_isqrt_ii = np.dot(s_s_ii / s_s_sqrt_i, dagger(s_s_ii))

        lambdab_r_ii = np.dot(np.dot(s_s_isqrt_ii, lambda_r_ii), s_s_isqrt_ii)
        a_l_ii = np.dot(np.dot(g_s_ii, lambda_l_ii), dagger(g_s_ii))
        ab_l_ii = np.dot(np.dot(s_s_sqrt_ii, a_l_ii), s_s_sqrt_ii)
        lambda_i, u_ii = np.linalg.eig(ab_l_ii)
        ut_ii = np.sqrt(lambda_i / (2.0 * np.pi)) * u_ii
        m_ii = 2 * np.pi * np.dot(np.dot(dagger(ut_ii), lambdab_r_ii), ut_ii)
        T_i, c_in = np.linalg.eig(m_ii)
        T_i = np.abs(T_i)
        channels = np.argsort(-T_i)
        c_in = np.take(c_in, channels, axis=1)
        T_n = np.take(T_i, channels)
        v_in = np.dot(np.dot(s_s_isqrt_ii, ut_ii), c_in)
        return T_n, v_in
Beispiel #7
0
 def get_lambda(self, energy):
     sigma = self(energy)
     sigma_mm = sigma.recover()
     return 1.j * (sigma_mm - dagger(sigma_mm))
Beispiel #8
0
 def get_lambda(self, energy):
     sigma = self(energy)
     sigma_mm = sigma.recover()
     return 1.j * (sigma_mm - dagger(sigma_mm))