Ejemplo n.º 1
0
    def measure(self,scale,dmmanagers,threadz=False,**kwargs):
        '''
        measure an operator(overload).

        scale:
            the EScale instance.
        tdmanager:
            the timeline manager, and instance TDManager.
        threadz:
            multi-threading over z.
        **kwargs:
            * FDM: wmin(-1),wmax(1),smearing_method(gaussian), b(0.5), tol(0 if zero temperature else 1e-12), nw(50)
            * RDM: smearing_method(log_gaussian), b(0.4)
        '''
        AL=[]
        ntask=(scale.nz-1)/SIZE+1
        for i in xrange(scale.nz):
            if threadz:
                if i/ntask==RANK:
                    print 'Measuring Sigma on core %s with Hamiltonian size %s.'%(RANK,dmmanagers[i].H.N)
                    w,A=self.get_expect(scale,dmmanagers[i],**kwargs)
                    AL.append(A)
            else:
                w,A=self.get_expect(scale,dmmanagers[i],**kwargs)
                AL.append(A)
        if threadz:
            AL=COMM.gather(AL,root=0)
            if RANK==0:
                AL=concatenate(AL,axis=0)
                w,A=w,mean(AL,axis=0)
            A=COMM.bcast(A,root=0)
            self.data=w,A
        else:
            self.data=w,mean(AL,axis=0)
Ejemplo n.º 2
0
    def measure(self, scale, dmmanagers, threadz=False, **kwargs):
        '''
        measure an operator(overload).

        scale:
            the EScale instance.
        tdmanager:
            the timeline manager, and instance TDManager.
        threadz:
            multi-threading over z.
        **kwargs:
            * FDM: wmin(-1),wmax(1),smearing_method(gaussian), b(0.5), tol(0 if zero temperature else 1e-12), nw(50)
            * RDM: smearing_method(log_gaussian), b(0.4)
        '''
        AL = []
        ntask = (scale.nz - 1) / SIZE + 1
        for i in xrange(scale.nz):
            if threadz:
                if i / ntask == RANK:
                    print 'Measuring Sigma on core %s with Hamiltonian size %s.' % (
                        RANK, dmmanagers[i].H.N)
                    w, A = self.get_expect(scale, dmmanagers[i], **kwargs)
                    AL.append(A)
            else:
                w, A = self.get_expect(scale, dmmanagers[i], **kwargs)
                AL.append(A)
        if threadz:
            AL = COMM.gather(AL, root=0)
            if RANK == 0:
                AL = concatenate(AL, axis=0)
                w, A = w, mean(AL, axis=0)
            A = COMM.bcast(A, root=0)
            self.data = w, A
        else:
            self.data = w, mean(AL, axis=0)
Ejemplo n.º 3
0
    def measure(self, scale, dmmanagers, threadz=False, **kwargs):
        '''
        measure an operator(overload).

        scale:
            the EScale instance.
        tdmanager:
            the timeline manager, and instance TDManager.
        threadz:
            multi-threading over z.
        **kwargs:
            * FDM: wmin(-1),wmax(1),smearing_method(gaussian), b(0.5), tol(0 if zero temperature else 1e-12), nw(50)
            * RDM: smearing_method(log_gaussian), b(0.4)
        '''
        AL = []
        BL = []
        ntask = (scale.nz - 1) / SIZE + 1
        for i in xrange(scale.nz):
            if threadz:
                if i / ntask == RANK:
                    print 'Measuring Sigma on core %s with Hamiltonian size %s.' % (
                        RANK, dmmanagers[i].H.N)
                    w, A, B = self.get_expect(scale, dmmanagers[i], **kwargs)
                    AL.append(A)
                    BL.append(B)
            else:
                w, A, B = self.get_expect(scale, dmmanagers[i], **kwargs)
                AL.append(A)
                BL.append(B)
        if threadz:
            AL = COMM.gather(AL, root=0)
            BL = COMM.gather(BL, root=0)
            if RANK == 0:
                AL = concatenate(AL, axis=0)
                BL = concatenate(BL, axis=0)
                w, A, B = w, mean(AL, axis=0), mean(BL, axis=0)
            A, B = COMM.bcast(A, root=0), COMM.bcast(B, root=0)
        else:
            A, B = mean(AL, axis=0), mean(BL, axis=0)
        print 'Fixing Occational Negative Eigenvalues of A.'
        aevals, aevecs = eigh(A)
        amin = aevals.min()
        if amin < 0:
            print 'Fixing Negative spectrum up to %s' % amin
            aevals[aevals < 0] = 0
        Alist = eigen_combine(aevals, aevecs)
        self.data = w, A, B
Ejemplo n.º 4
0
    def measure(self,scale,dmmanagers,threadz=False,**kwargs):
        '''
        measure an operator(overload).

        scale:
            the EScale instance.
        tdmanager:
            the timeline manager, and instance TDManager.
        threadz:
            multi-threading over z.
        **kwargs:
            * FDM: wmin(-1),wmax(1),smearing_method(gaussian), b(0.5), tol(0 if zero temperature else 1e-12), nw(50)
            * RDM: smearing_method(log_gaussian), b(0.4)
        '''
        AL=[];BL=[]
        ntask=(scale.nz-1)/SIZE+1
        for i in xrange(scale.nz):
            if threadz:
                if i/ntask==RANK:
                    print 'Measuring Sigma on core %s with Hamiltonian size %s.'%(RANK,dmmanagers[i].H.N)
                    w,A,B=self.get_expect(scale,dmmanagers[i],**kwargs)
                    AL.append(A)
                    BL.append(B)
            else:
                w,A,B=self.get_expect(scale,dmmanagers[i],**kwargs)
                AL.append(A)
                BL.append(B)
        if threadz:
            AL=COMM.gather(AL,root=0)
            BL=COMM.gather(BL,root=0)
            if RANK==0:
                AL=concatenate(AL,axis=0)
                BL=concatenate(BL,axis=0)
                w,A,B=w,mean(AL,axis=0),mean(BL,axis=0)
            A,B=COMM.bcast(A,root=0),COMM.bcast(B,root=0)
        else:
            A,B=mean(AL,axis=0),mean(BL,axis=0)
        print 'Fixing Occational Negative Eigenvalues of A.'
        aevals,aevecs=eigh(A)
        amin=aevals.min()
        if amin<0:
            print 'Fixing Negative spectrum up to %s'%amin
            aevals[aevals<0]=0
        Alist=eigen_combine(aevals,aevecs)
        self.data=w,A,B