Example #1
0
    def test_eps_l_noop(self):
        l1 = tc.eps_l_noop(self.l0, self.A1, self.B1)

        l1_ = self.E1_AB.conj().T.dot(self.l0.ravel()).reshape(
            self.D[1], self.D[1])

        self.assertTrue(sp.allclose(l1, l1_))
Example #2
0
 def test_eps_l_noop_inplace(self):
     l1 = sp.zeros_like(self.r1)
     l1_ = tc.eps_l_noop_inplace(self.l0, self.A1, self.B1, l1)
     
     self.assertTrue(l1 is l1_)
     
     l1__ = tc.eps_l_noop(self.l0, self.A1, self.B1)
     
     self.assertTrue(sp.allclose(l1, l1__))
Example #3
0
 def test_eps_l_noop_inplace(self):
     l1 = sp.zeros_like(self.r1)
     l1_ = tc.eps_l_noop_inplace(self.l0, self.A1, self.B1, l1)
     
     self.assertTrue(l1 is l1_)
     
     l1__ = tc.eps_l_noop(self.l0, self.A1, self.B1)
     
     self.assertTrue(sp.allclose(l1, l1__))
Example #4
0
 def test_eps_l_noop_eye(self):
     l1 = tc.eps_l_noop(self.eye0, self.A1, self.B1)
     
     l1_ = self.E1_AB.conj().T.dot(self.eye0.A.ravel()).reshape(self.D[1], self.D[1])
     
     self.assertTrue(sp.allclose(l1, l1_))
Example #5
0
def hamiltonian_elements(B1, B2, AL, AR, lL, rR, KL, KR, h_nn, d_max):
    B1_viol = rgf_violation(B1, AR, rR)
    B2_viol = rgf_violation(B2, AR, rR)
    if B1_viol > 1e-12:
        raise ValueError(
            "Gauge-fixing condition not satisfied for B1! Violation: {}".
            format(B1_viol))
    if B2_viol > 1e-12:
        raise ValueError(
            "Gauge-fixing condition not satisfied for B2! Violation: {}".
            format(B2_viol))

    print(mm.adot(lL, tm.eps_r_noop(rR, B1, B2)))

    matels = []
    if d_max >= 0:
        # <lL|(B1;B2)|KR>
        x = tm.eps_l_noop(lL, B1, B2)
        res1 = mm.adot(x, KR)

        # <KL|(B1;B2)|rR>
        x = tm.eps_l_noop(KL, B1, B2)
        res2 = mm.adot_noconj(x, rR)  # Do not conjugate KL contribution

        # <lL|h(AL,B1;AL,B2)|rR>
        x = tm.eps_r_op_2s_A(rR, AL, B1, AL, B2, h_nn)
        res3 = mm.adot(lL, x)

        # <lL|h(B1,AR;B2,AR)|rR>
        x = tm.eps_r_op_2s_A(rR, B1, AR, B2, AR, h_nn)
        res4 = mm.adot(lL, x)

        matels.append(res1 + res2 + res3 + res4)

    B1L = tm.eps_l_noop(lL, B1, AL)  # <lL|(B1;AL)
    B2_KR = tm.eps_r_noop(KR, AR, B2)  # (AR;B2)|KR>
    B2_KR += tm.eps_r_op_2s_A(rR, AR, AR, B2, AR,
                              h_nn)  # (AR;B2)|KR> + h(AR,AR;B2,AR)|rR>

    if d_max >= 1:
        res = mm.adot(
            B1L,
            B2_KR)  # <lL|(B1;AL) (AR;B2)|KR> + <lL|(B1;AL) h(AR,AR;B2,AR)|rR>

        x = tm.eps_r_op_2s_A(rR, B1, AR, AL, B2,
                             h_nn)  # <lL|h(B1,AR;AL,B2)|rR>
        res += mm.adot(lL, x)

        matels.append(res)

    B2_KR = tm.eps_r_noop(B2_KR, AR, AL)  # advance one site (d == 2)
    # (AR;AL)(AR;B2)|KR> + (AR;AL) h(AR,AR;B2,AR)|rR> + h(AR,AR;AL,B2)|rR>
    B2_KR += tm.eps_r_op_2s_A(rR, AR, AR, AL, B2, h_nn)

    for d in range(2, d_max + 1):
        x = B1L
        for _ in range(2, d):
            x = tm.eps_l_noop(x, AR, AL)  # (AR;AL)^(d-2)
        res = mm.adot(x, B2_KR)
        matels.append(res)

    return matels