Ejemplo n.º 1
0
    def get_vev(self, h_tsr: Tensor):
        """Function to evaluate the expectation value of a normal
        ordered tensor 'h_tsr' with respect to the projected BCS
        ground state
            h_tsr = tensor whose VEV is to be evaluated
            Ntot = total number of orbitals available
        Note that here we follow the notation that Np = Number of Fermions and not number of pairs
        """
        ctan = self.cartan
        gam = IndexedBase(r'\gamma')

        def vev_of_term(term):
            """Return the VEV of a given term"""
            vecs = term.vecs
            t_amp = term.amp
            ind_list = []

            if len(vecs) == 0:
                return term
            elif all(v.base == ctan for v in vecs):
                for i in vecs:
                    if set(i.indices).issubset(set(ind_list)):
                        t_amp = t_amp * 2
                        # NOTE: This is only true when evaluating expectation over AGP,
                        # or any other seniority zero state
                    else:
                        ind_list.extend(list(i.indices))
            else:
                return []

            t_amp = t_amp * gam[ind_list]
            return [Term(sums=term.sums, amp=t_amp, vecs=())]

        return h_tsr.bind(vev_of_term)
Ejemplo n.º 2
0
    def _transl2uga(self, tensor: Tensor):
        """Translate a tensor object in terms of the fermion operators.

        This is an internal utility.  The resulting tensor has the internal
        AGP drudge object as its owner.
        """
        chk = tensor.bind(self._agp_dr._isAGP)

        # for t in trms:
        #     if ~self._agp_dr._isAGP(t):
        #         raise ValueError('Unexpected generator of the AGP Algebra',vec)

        return Tensor(self, tensor.subst_all(self._agp2uga_defs).terms)
Ejemplo n.º 3
0
    def _transl2agp(self, tensor: Tensor):
        """Translate a tensor object in terms of the fermion operators.

        This is an internal utility.  The resulting tensor has the internal
        AGP drudge object as its owner.
        """
        chk = tensor.bind(self._isUGA)

        # for t in trms:
        #     if ~_isUGA(t):
        #         raise ValueError('Unexpected generator of the Unitary Group',vec)

        return Tensor(self._agp_dr, tensor.subst_all(self._uga2agp_defs).terms)
Ejemplo n.º 4
0
 def extract_su2(self, expression: Tensor):
     """Bind function to map fermion strings to obvious SU2 (Pairing as well
     as spin-flip operators)
     """
     return expression.bind(self._extract_su2)
Ejemplo n.º 5
0
 def canon_indices(self, expression: Tensor):
     """Bind function to canonicalize free / external indices.
     """
     return expression.bind(
         functools.partial(_canonicalize_indices, spec=self._spec))