Пример #1
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
        '_uga_dr' drudge object as its owner.

        """
        return Tensor(self, tensor.subst_all(self._agp2uga_defs).terms)
Пример #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)
Пример #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)
Пример #4
0
    def spin_flip_to_fermi(self, tnsr: Tensor):
        """Substitute all the Spin flip operators with their respective fermionic
        strings"""

        gen_idx = self.all_orb_dumms[0]
        sp_def = self.define(
            SPIN_RAISE, gen_idx,
            cr[gen_idx, SpinOneHalf.UP] * an[gen_idx, SpinOneHalf.DOWN])
        sm_def = self.define(
            SPIN_LOWER, gen_idx,
            cr[gen_idx, SpinOneHalf.DOWN] * an[gen_idx, SpinOneHalf.UP])
        spin_defs = [sp_def, sm_def]

        return Tensor(self, tnsr.subst_all(spin_defs).terms)
Пример #5
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)
Пример #6
0
 def get_vev_agp(self,h_tsr: Tensor,):
     """Function to evaluate the expectation value of a normal
     ordered tensor 'h_tsr' with respect to the projected BCS
     or the AGP state. This can be done after translating the the
     unitary group terms into the AGP basis algebra.
         h_tsr = tensor whose VEV is to be evaluated
     """
     transled = self._transl2agp(h_tsr)
     transled = self._agp_dr.agp_simplify(transled,final_step=True)
     res = self._agp_dr.get_vev(transled)
     return Tensor(self, res.terms)
Пример #7
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)
Пример #8
0
 def canon_indices(self, expression: Tensor):
     """Bind function to canonicalize free / external indices.
     """
     return expression.bind(
         functools.partial(_canonicalize_indices, spec=self._spec))