Exemplo n.º 1
0
 def test_p2(self):
     H = two_p("w")
     bra = braP2("nm")
     S2 = P2("S2old", ["nm"])
     HT = commute(H, S2)
     HTT = commute(HT, S2)
     S = bra*(H + HT + 0.5*HTT)
     out = apply_wick(S)
     out.resolve()
     final = AExpression(Ex=out)
     out = str(final) + "\n"
     ref = get_ref("p2_test.out")
     self.assertTrue(ref == out)
Exemplo n.º 2
0
    def test_ccsd_T1(self):
        H1 = one_e("f", ["occ", "vir"], norder=True)
        H2 = two_e("I", ["occ", "vir"], norder=True)
        H = H1 + H2

        bra = braE1("occ", "vir")
        T1 = E1("t", ["occ"], ["vir"])
        T2 = E2("t", ["occ"], ["vir"])
        T = T1 + T2

        HT = commute(H, T)
        HTT = commute(HT, T)
        HTTT = commute(commute(commute(H2, T1), T1), T1)

        S = bra*(H + HT + Fraction('1/2')*HTT + Fraction('1/6')*HTTT)
        out = apply_wick(S)
        out.resolve()
        final = AExpression(Ex=out)
        out = str(final) + "\n"
        ref = get_ref("ccsd_T1.out")
        self.assertTrue(ref == out)
Exemplo n.º 3
0
from wick.convenience import one_e, two_e, E1, E2, braEip1, Eip1, Eip2, commute

H1 = one_e("f", ["occ", "vir"], norder=True)
H2 = two_e("I", ["occ", "vir"], norder=True)
H = H1 + H2

bra = braEip1("occ")
T1 = E1("t", ["occ"], ["vir"])
T2 = E2("t", ["occ"], ["vir"])

R1 = Eip1("r", ["occ"])
R2 = Eip2("r", ["occ"], ["vir"])

T = T1 + T2
R = R1 + R2
HT = commute(H, T)
HTT = commute(HT, T)
HTTT = commute(HTT, T)
HTTTT = commute(HTTT, T)
Hbar = H + HT + Fraction('1/2') * HTT

S0 = Hbar
E0 = apply_wick(S0)
E0.resolve()

Hbar += Fraction('1/6') * HTTT + Fraction('1/24') * HTTTT
S = bra * (Hbar - E0) * R

out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
Exemplo n.º 4
0
from fractions import Fraction
from wick.expression import AExpression
from wick.wick import apply_wick
from wick.convenience import one_e, E1, braE1, commute

H1 = one_e("f", ["occ", "vir"], norder=True)

bra = braE1("occ", "vir")
T1 = E1("t", ["occ"], ["vir"])

HT = commute(H1, T1)
HTT = commute(HT, T1)
S = bra*(H1 + HT + Fraction('1/2')*HTT)
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
print(final)
Exemplo n.º 5
0
from fractions import Fraction
from wick.expression import AExpression
from wick.wick import apply_wick
from wick.convenience import one_e, two_e, E1, E2, braE1, commute

H1 = one_e("f", ["occ", "vir"], norder=True)
H2 = two_e("I", ["occ", "vir"], norder=True)
H = H1 + H2

bra = braE1("occ", "vir")
T1 = E1("t", ["occ"], ["vir"])
T2 = E2("t", ["occ"], ["vir"])
T = T1 + T2

HT = commute(H, T)
HTT = commute(HT, T)
HTTT = commute(commute(commute(H2, T1), T1), T1)

S = bra * (H + HT + Fraction('1/2') * HTT + Fraction('1/6') * HTTT)
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
print(final)
Exemplo n.º 6
0
from wick.expression import AExpression
from wick.wick import apply_wick
from wick.convenience import two_p, P2, braP2, commute

H = two_p("w")
bra = braP2("nm")
S2 = P2("S2old", ["nm"])
HT = commute(H, S2)
HTT = commute(HT, S2)
S = bra * (H + HT + 0.5 * HTT)
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
print(final)
Exemplo n.º 7
0
j = Idx(1, "occ")
b = Idx(1, "vir")

T1 = E1("t", ["occ"], ["vir"])
T2 = E2("t", ["occ"], ["vir"])
T = T1 + T2

L1 = E1("L", ["vir"], ["occ"])
L2 = E2("L", ["vir"], ["occ"])
L = L1 + L2

# ov block
operators = [FOperator(a, True), FOperator(i, False)]
pvo = Expression([Term(1, [], [Tensor([i, a], "")], operators, [])])

PT = commute(pvo, T)
PTT = commute(PT, T)
mid = pvo + PT + Fraction('1/2') * PTT
full = L * mid
out = apply_wick(full)
out.resolve()
final = AExpression(Ex=out)
print("P_{ov} = ")
print(final)

# vv block
operators = [FOperator(a, True), FOperator(b, False)]
pvv = Expression([Term(1, [], [Tensor([b, a], "")], operators, [])])

PT = commute(pvv, T)
PTT = commute(PT, T)