Exemple #1
0
    def get_sigma_eig(self,wlist=None,interp='spline',kk_method='mac'):
        '''
        kk-relation to get (index1,index2) component of Sigma, we ignored pi factor here, for we will get U*FG^{-1}.

        For reference:
            * Initial version: J. Phys.: Condens. Matter 10.8365.
            * The matrix version: PRB 79.214518

        wlist:
            the frequency space.
        interp:
            interpolation method.

            * `spline`
            * `pchip`
        kk_method:
            method to calculate kk-relation(Appl. Spectrosc. 42.952).

            * `mac` -> using Maclaurin-method.
            * `fft` -> using Successive Double Fourier Transformation method.
        '''
        nband=self.nband
        print 'Interpolating A(w),B(w) to get self-energy Sigma(w).'
        t0=time.time()
        wl,Alist,Blist=self.data
        if not wlist is None:
            if interp=='pchip':
                interpolator=pchip_interpolate
            elif interp=='spline':
                interpolator=matrix_spline
            else:
                raise Exception('Undefined interpolation method @get_sigma.')
            Alist=interpolator(wl,Alist,wlist)
            Blist=interpolator(wl,Blist,wlist)
        else:
            wlist=wl
        Gilist=-pi*Alist
        Filist=-pi*Blist
        Gievals,Gievecs=eigh_sorted(Gilist)
        #Fievals,Fievecs=eig_sorted(Filist)
        if kk_method=='fft':
            Grevals=kk_fft(Gievals,'i2r',expand=1.5)
            Frlist=kk_fft(Filist,'i2r',expand=1.5)
        elif kk_method=='mac':
            Grevals=kk(Gievals,'i2r',wlist=wlist)
            Frlist=kk(Filist,'i2r',wlist=wlist)
        else:
            raise Exception('Undefined calculation method for kk-relation!')
        #Slist=self.U*array([(Br+1j*Bi).dot(inv(Ar+1j*Ai)) for Ar,Ai,Br,Bi in zip(Arlist,Alist,Brlist,Blist)])
        #Srlist=(swapaxes(Slist.conj(),1,2)+Slist)/2.
        #Silist=(swapaxes(Slist.conj(),1,2)-Slist)*(-1j/2.)
        Gevals=Grevals+1j*Gievals
        #Fevals=Frevals+1j*Fievals
        invG=eigen_combine(1./Gevals,Gievecs)
        F=Frlist+1j*Filist
        #why here is a minus sign?!
        S=-self.U*bcast_dot(F,invG)
        t1=time.time()
        print 'Elapse -> %s'%(t1-t0)
        return S,invG,F
Exemple #2
0
 def __canonical_move__(self,right,tol):
     '''
     Move l-index by one with specific direction.
     
     Parameters
     --------------
     right:
         Move l to right if True.
     tol:
         The tolerence for compression.
     '''
     nsite=self.nsite
     l=self.l
     hndim=self.hndim
     if (l>=nsite and right) or (l<=0 and not right):
         raise ValueError('Can not move to %s for l = %s with %s sites in total.'%('right' if right else 'left',l,nsite))
     if right:
         B0=self.BL.pop(0)
         B0=swapaxes(self.S[:,newaxis]*B0,0,1)
         M=reshape(B0,(-1,B0.shape[-1]))
         U,S,V=svd(M,full_matrices=False)
         kpmask=abs(S)>tol
         U,S,V=U[:,kpmask],S[kpmask],V[kpmask]
         self.AL.append(swapaxes(reshape(U,(-1,hndim,U.shape[1])),0,1))
         self.S=S
         if len(self.BL)>0:
             self.BL[0]=bcast_dot(V,self.BL[0])
         else:
             self.S*=V[0,0]
     else:
         A0=self.AL.pop(-1)
         A0=swapaxes(A0*self.S,0,1)
         M=reshape(A0,(A0.shape[0],-1))
         U,S,V=svd(M,full_matrices=False)
         kpmask=abs(S)>tol
         U,S,V=U[:,kpmask],S[kpmask],V[kpmask]
         self.BL.insert(0,swapaxes(reshape(V,(V.shape[0],hndim,-1)),0,1))
         self.S=S
         if len(self.AL)>0:
             self.AL[-1]=bcast_dot(self.AL[-1],U)
         else:
             self.S*=U[0,0]