def test_index_permutations_with_dummies():
    a, b, c, d = symbols('a b c d')
    p, q, r, s = symbols('p q r s', cls=Dummy)
    f, g = map(Function, 'fg')
    P = PermutationOperator

    # No dummy substitution necessary
    expr = f(a, b, p, q) - f(b, a, p, q)
    assert simplify_index_permutations(
        expr, [P(a, b)]) == P(a, b)*f(a, b, p, q)

    # Cases where dummy substitution is needed
    expected = P(a, b)*substitute_dummies(f(a, b, p, q))

    expr = f(a, b, p, q) - f(b, a, q, p)
    result = simplify_index_permutations(expr, [P(a, b)])
    assert expected == substitute_dummies(result)

    expr = f(a, b, q, p) - f(b, a, p, q)
    result = simplify_index_permutations(expr, [P(a, b)])
    assert expected == substitute_dummies(result)

    # A case where nothing can be done
    expr = f(a, b, q, p) - g(b, a, p, q)
    result = simplify_index_permutations(expr, [P(a, b)])
    assert expr == result
Beispiel #2
0
def test_PermutationOperator():
    p, q, r, s = symbols("p,q,r,s")
    f, g, h, i = map(Function, "fghi")
    P = PermutationOperator
    assert P(p, q).get_permuted(f(p) * g(q)) == -f(q) * g(p)
    assert P(p, q).get_permuted(f(p, q)) == -f(q, p)
    assert P(p, q).get_permuted(f(p)) == f(p)
    expr = f(p) * g(q) * h(r) * i(s) - f(q) * g(p) * h(r) * i(s) - f(p) * g(q) * h(s) * i(r) + f(q) * g(p) * h(s) * i(r)
    perms = [P(p, q), P(r, s)]
    assert simplify_index_permutations(expr, perms) == P(p, q) * P(r, s) * f(p) * g(q) * h(r) * i(s)
Beispiel #3
0
def test_PermutationOperator():
    p,q,r,s = symbols('pqrs')
    f,g,h,i = map(Function, 'fghi')
    P = PermutationOperator
    assert (P(p,q).get_permuted(f(p)*g(q)) ==
            -f(q)*g(p))
    expr = (f(p)*g(q)*h(r)*i(s)
        - f(q)*g(p)*h(r)*i(s)
        - f(p)*g(q)*h(s)*i(r)
        + f(q)*g(p)*h(s)*i(r))
    perms = [P(p,q),P(r,s)]
    assert (simplify_index_permutations(expr,perms) ==
        P(p,q)*P(r,s)*f(p)*g(q)*h(r)*i(s))
Beispiel #4
0
def main():
    print()
    print("Calculates the Coupled-Cluster energy- and amplitude equations")
    print("See 'An Introduction to Coupled Cluster Theory' by")
    print("T. Daniel Crawford and Henry F. Schaefer III")
    print("http://www.ccc.uga.edu/lec_top/cc/html/review.html")
    print()

    # setup hamiltonian
    p, q, r, s = symbols('p,q,r,s', cls=Dummy)
    f = AntiSymmetricTensor('f', (p,), (q,))
    pr = NO((Fd(p)*F(q)))
    v = AntiSymmetricTensor('v', (p, q), (r, s))
    pqsr = NO(Fd(p)*Fd(q)*F(s)*F(r))

    H = f*pr + Rational(1, 4)*v*pqsr
    print("Using the hamiltonian:", latex(H))

    print("Calculating 4 nested commutators")
    C = Commutator

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 1...")
    comm1 = wicks(C(H, T))
    comm1 = evaluate_deltas(comm1)
    comm1 = substitute_dummies(comm1)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 2...")
    comm2 = wicks(C(comm1, T))
    comm2 = evaluate_deltas(comm2)
    comm2 = substitute_dummies(comm2)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 3...")
    comm3 = wicks(C(comm2, T))
    comm3 = evaluate_deltas(comm3)
    comm3 = substitute_dummies(comm3)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 4...")
    comm4 = wicks(C(comm3, T))
    comm4 = evaluate_deltas(comm4)
    comm4 = substitute_dummies(comm4)

    print("construct Hausdoff expansion...")
    eq = H + comm1 + comm2/2 + comm3/6 + comm4/24
    eq = eq.expand()
    eq = evaluate_deltas(eq)
    eq = substitute_dummies(eq, new_indices=True,
            pretty_indices=pretty_dummies_dict)
    print("*********************")
    print()

    print("extracting CC equations from full Hbar")
    i, j, k, l = symbols('i,j,k,l', below_fermi=True)
    a, b, c, d = symbols('a,b,c,d', above_fermi=True)
    print()
    print("CC Energy:")
    print(latex(wicks(eq, simplify_dummies=True,
        keep_only_fully_contracted=True)))
    print()
    print("CC T1:")
    eqT1 = wicks(NO(Fd(i)*F(a))*eq, simplify_kronecker_deltas=True, keep_only_fully_contracted=True)
    eqT1 = substitute_dummies(eqT1)
    print(latex(eqT1))
    print()
    print("CC T2:")
    eqT2 = wicks(NO(Fd(i)*Fd(j)*F(b)*F(a))*eq, simplify_dummies=True, keep_only_fully_contracted=True, simplify_kronecker_deltas=True)
    P = PermutationOperator
    eqT2 = simplify_index_permutations(eqT2, [P(a, b), P(i, j)])
    print(latex(eqT2))
Beispiel #5
0
T = T1+ T2
print "comm4..."
comm4 = wicks(C(comm3,T),simplify_dummies=True, simplify_kronecker_deltas=True)

print "construct Hausdoff expansion..."
eq = H + comm1+comm2/2+comm3/6+comm4/24
eq = eq.expand()
eq = evaluate_deltas(eq)
eq = substitute_dummies(eq, new_indices=True, reverse_order=False)
print "*********************"
print

print "extracting CC equations from full Hbar"
i,j,k,l = symbols('ijkl',below_fermi=True)
a,b,c,d = symbols('abcd',above_fermi=True)
print
print "CC Energy:"
print latex(wicks(eq, simplify_dummies=True,
    keep_only_fully_contracted=True))
print
print "CC T1:"
eqT1 = wicks(NO(Fd(i)*F(a))*eq, simplify_kronecker_deltas=True, keep_only_fully_contracted=True)
eqT1 = substitute_dummies(eqT1,reverse_order=False)
print latex(eqT1)
print
print "CC T2:"
eqT2 = wicks(NO(Fd(i)*Fd(j)*F(b)*F(a))*eq,simplify_dummies=True, keep_only_fully_contracted=True, simplify_kronecker_deltas=True)
P = PermutationOperator
eqT2 = simplify_index_permutations(eqT2,[P(a,b),P(i,j)])
print latex(eqT2)
Beispiel #6
0
def main():
    print
    print "Calculates the Coupled-Cluster energy- and amplitude equations"
    print "See 'An Introduction to Coupled Cluster Theory' by"
    print "T. Daniel Crawford and Henry F. Schaefer III"
    print "http://www.ccc.uga.edu/lec_top/cc/html/review.html"
    print

    # setup hamiltonian
    p, q, r, s = symbols('p,q,r,s', cls=Dummy)
    f = AntiSymmetricTensor('f', (p, ), (q, ))
    pr = NO((Fd(p) * F(q)))
    v = AntiSymmetricTensor('v', (p, q), (r, s))
    pqsr = NO(Fd(p) * Fd(q) * F(s) * F(r))

    H = f * pr + Rational(1, 4) * v * pqsr
    print "Using the hamiltonian:", latex(H)

    print "Calculating 4 nested commutators"
    C = Commutator

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "commutator 1..."
    comm1 = wicks(C(H, T))
    comm1 = evaluate_deltas(comm1)
    comm1 = substitute_dummies(comm1)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "commutator 2..."
    comm2 = wicks(C(comm1, T))
    comm2 = evaluate_deltas(comm2)
    comm2 = substitute_dummies(comm2)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "commutator 3..."
    comm3 = wicks(C(comm2, T))
    comm3 = evaluate_deltas(comm3)
    comm3 = substitute_dummies(comm3)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "commutator 4..."
    comm4 = wicks(C(comm3, T))
    comm4 = evaluate_deltas(comm4)
    comm4 = substitute_dummies(comm4)

    print "construct Hausdoff expansion..."
    eq = H + comm1 + comm2 / 2 + comm3 / 6 + comm4 / 24
    eq = eq.expand()
    eq = evaluate_deltas(eq)
    eq = substitute_dummies(eq,
                            new_indices=True,
                            pretty_indices=pretty_dummies_dict)
    print "*********************"
    print

    print "extracting CC equations from full Hbar"
    i, j, k, l = symbols('i,j,k,l', below_fermi=True)
    a, b, c, d = symbols('a,b,c,d', above_fermi=True)
    print
    print "CC Energy:"
    print latex(
        wicks(eq, simplify_dummies=True, keep_only_fully_contracted=True))
    print
    print "CC T1:"
    eqT1 = wicks(NO(Fd(i) * F(a)) * eq,
                 simplify_kronecker_deltas=True,
                 keep_only_fully_contracted=True)
    eqT1 = substitute_dummies(eqT1)
    print latex(eqT1)
    print
    print "CC T2:"
    eqT2 = wicks(NO(Fd(i) * Fd(j) * F(b) * F(a)) * eq,
                 simplify_dummies=True,
                 keep_only_fully_contracted=True,
                 simplify_kronecker_deltas=True)
    P = PermutationOperator
    eqT2 = simplify_index_permutations(eqT2, [P(a, b), P(i, j)])
    print latex(eqT2)
Beispiel #7
0
def TPDM(L, R, flavor):

    display(
        Markdown(
            rf""" Computing TPDM for {flavor} (skipping summation for dummy variables)"""
        ))

    i, j, k, l = symbols('i,j,k,l', below_fermi=True)
    a, b, c, d = symbols('a,b,c,d', above_fermi=True)

    oooo = Fd(i) * Fd(j) * F(l) * F(k)
    cc = BCH.level(oooo, "SD")
    g_oooo = evaluate_deltas(wicks(L * cc * R,
                                   keep_only_fully_contracted=True))
    PermutList = [PermutationOperator(i,j),PermutationOperator(i,k), \
               PermutationOperator(i,l),PermutationOperator(j,k), \
               PermutationOperator(j,l),PermutationOperator(k,l)]
    g_oooo = simplify_index_permutations(g_oooo, PermutList)
    index_rule = {'below': 'mnop', 'above': 'abcde'}
    g_oooo = substitute_dummies(g_oooo,
                                new_indices=True,
                                pretty_indices=index_rule)
    gamma = Symbol('\gamma_{ijkl}')
    final_eq = Eq(gamma, g_oooo)
    display(final_eq)

    ooov = Fd(i) * Fd(j) * F(a) * F(k)
    cc = BCH.level(ooov, "SD")
    g_ooov = evaluate_deltas(wicks(L * cc * R,
                                   keep_only_fully_contracted=True))
    PermutList = [PermutationOperator(i,j),PermutationOperator(i,k), \
               PermutationOperator(j,k)]
    g_ooov = simplify_index_permutations(g_ooov, PermutList)
    index_rule = {'below': 'lmnop', 'above': 'bcdef'}
    g_ooov = substitute_dummies(g_ooov,
                                new_indices=True,
                                pretty_indices=index_rule)
    gamma = Symbol('\gamma_{ijka}')
    final_eq = Eq(gamma, g_oo)
    display(final_eq)

    ooov = Fd(i) * Fd(a) * F(k) * F(j)
    cc = BCH.level(ooov, "SD")
    g_ovoo = evaluate_deltas(wicks(L * cc * R,
                                   keep_only_fully_contracted=True))
    PermutList = [PermutationOperator(i,j),PermutationOperator(i,k), \
               PermutationOperator(j,k)]
    g_ovoo = simplify_index_permutations(g_ovoo, PermutList)
    index_rule = {'below': 'lmnop', 'above': 'bcdef'}
    g_ovoo = substitute_dummies(g_ovoo,
                                new_indices=True,
                                pretty_indices=index_rule)
    gamma = Symbol('\gamma_{iajk}')
    final_eq = Eq(gamma, g_ovoo)
    display(final_eq)

    ovov = Fd(i) * Fd(a) * F(b) * F(j)
    cc = BCH.level(ovov, "SD")
    g_ovov = evaluate_deltas(wicks(L * cc * R,
                                   keep_only_fully_contracted=True))
    PermutList = [PermutationOperator(i, j), PermutationOperator(a, b)]
    g_ovov = simplify_index_permutations(g_ovov, PermutList)
    index_rule = {'below': 'klmno', 'above': 'cdef'}
    g_ovov = substitute_dummies(g_ovov,
                                new_indices=True,
                                pretty_indices=index_rule)
    gamma = Symbol('\gamma_{iajb}')
    final_eq = Eq(gamma, g_ovov)
    display(final_eq)

    ovvv = Fd(i) * Fd(a) * F(c) * F(b)
    cc = BCH.level(ovvv, "SD")
    g_ovvv = evaluate_deltas(wicks(L * cc * R,
                                   keep_only_fully_contracted=True))
    PermutList = [PermutationOperator(a,b),PermutationOperator(a,c), \
               PermutationOperator(b,c)]
    g_ovvv = simplify_index_permutations(g_ovvv, PermutList)
    index_rule = {'below': 'jklmn', 'above': 'defg'}
    g_ovvv = substitute_dummies(g_ovvv,
                                new_indices=True,
                                pretty_indices=index_rule)
    gamma = Symbol('\gamma_{iabc}')
    final_eq = Eq(gamma, g_ovvv)
    display(final_eq)

    oovv = Fd(i) * Fd(j) * F(b) * F(a)
    cc = BCH.level(oovv, "SD")
    g_oovv = evaluate_deltas(wicks(L * cc * R,
                                   keep_only_fully_contracted=True))
    PermutList = [PermutationOperator(i, j), PermutationOperator(a, b)]
    g_oovv = simplify_index_permutations(g_oovv, PermutList)
    index_rule = {'below': 'klmn', 'above': 'cdefg'}
    g_oovv = substitute_dummies(g_oovv,
                                new_indices=True,
                                pretty_indices=index_rule)
    gamma = Symbol('\gamma_{ijab}')
    final_eq = Eq(gamma, g_oovv)
    display(final_eq)
Beispiel #8
0
def LVECTORS(L0, L1, L2, flavor):
    display(
        Markdown(
            rf""" Computing left sigma amplitudes for {flavor} (skipping summation for dummy variables)"""
        ))

    p, q, r, s = symbols('p,q,r,s', cls=Dummy)
    f = AntiSymmetricTensor('f', (p, ), (q, ))
    pr = NO((Fd(p) * F(q)))
    v = AntiSymmetricTensor('v', (p, q), (r, s))
    pqsr = NO(Fd(p) * Fd(q) * F(s) * F(r))
    ham = f * pr + Rational(1, 4) * v * pqsr

    cc = BCH.level(ham, "SD")
    E_cc = evaluate_deltas(wicks(cc, keep_only_fully_contracted=True))

    i, j, k = symbols('i,j,k', below_fermi=True)
    a, b, c = symbols('a,b,c', above_fermi=True)

    if flavor == "IP":
        sig11 = evaluate_deltas(
            wicks(L1 * (cc - E_cc) * F(i), keep_only_fully_contracted=True))
        index_rule = {'below': 'jklmno', 'above': 'abcdefg'}
        sig11 = substitute_dummies(sig11,
                                   new_indices=True,
                                   pretty_indices=index_rule)
    if flavor == "EA":
        sig11 = evaluate_deltas(
            wicks(L1 * (cc - E_cc) * Fd(a), keep_only_fully_contracted=True))
        index_rule = {'below': 'ijklmno', 'above': 'bcdefg'}
        sig11 = substitute_dummies(sig11,
                                   new_indices=True,
                                   pretty_indices=index_rule)
    if flavor == "DIP":
        PermutList = [PermutationOperator(i, j)]
        sig11 = evaluate_deltas(
            wicks(L1 * (cc - E_cc) * F(j) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'klmno', 'above': 'abcdefg'}
        sig11 = substitute_dummies(sig11,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig11 = simplify_index_permutations(sig11, PermutList)
    if flavor == "DEA":
        PermutList = [PermutationOperator(a, b)]
        sig11 = evaluate_deltas(
            wicks(L1 * (cc - E_cc) * Fd(a) * Fd(b),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'ijklmno', 'above': 'cdefg'}
        sig11 = substitute_dummies(sig11,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig11 = simplify_index_permutations(sig11, PermutList)

    sigma_11 = Symbol('(L_{1}(\overline{H}_{SS}-E_{cc}))')
    final_eq = Eq(sigma_11, sig11)
    display(final_eq)

    if flavor == "IP":
        PermutList = [PermutationOperator(i, j)]
        sig12 = evaluate_deltas(
            wicks((L2 * cc) * F(i), keep_only_fully_contracted=True))
        index_rule = {'below': 'jklmno', 'above': 'abcdefg'}
        sig12 = substitute_dummies(sig12,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig12 = simplify_index_permutations(sig12, PermutList)
    if flavor == "EA":
        PermutList = [PermutationOperator(a, b)]
        sig12 = evaluate_deltas(
            wicks((L2 * cc) * Fd(a), keep_only_fully_contracted=True))
        index_rule = {'below': 'ijklmno', 'above': 'bcdefg'}
        sig12 = substitute_dummies(sig12,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig12 = simplify_index_permutations(sig12, PermutList)
    if flavor == "DIP":
        PermutList = [
            PermutationOperator(i, j),
            PermutationOperator(j, k),
            PermutationOperator(i, k)
        ]
        sig12 = evaluate_deltas(
            wicks(L2 * cc * F(j) * F(i), keep_only_fully_contracted=True))
        index_rule = {'below': 'klmno', 'above': 'abcdefg'}
        sig12 = substitute_dummies(sig12,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig12 = simplify_index_permutations(sig12, PermutList)
    if flavor == "DEA":
        PermutList = [
            PermutationOperator(a, b),
            PermutationOperator(b, c),
            PermutationOperator(a, c)
        ]
        sig12 = evaluate_deltas(
            wicks((L2 * cc) * Fd(a) * Fd(b), keep_only_fully_contracted=True))
        index_rule = {'below': 'ijklmno', 'above': 'cdefg'}
        sig12 = substitute_dummies(sig12,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig12 = simplify_index_permutations(sig12, PermutList)

    sigma_12 = Symbol('(L_{2}\overline{H}_{DS})')
    final_eq = Eq(sigma_12, sig12)
    display(final_eq)

    if flavor == "IP":
        sig21 = evaluate_deltas(
            wicks((L1 * cc) * Fd(a) * F(j) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'klmno', 'above': 'bcdefgh'}
        sig21 = substitute_dummies(sig21,
                                   new_indices=True,
                                   pretty_indices=index_rule)
    if flavor == "EA":
        sig21 = evaluate_deltas(
            wicks((L1 * cc) * Fd(a) * Fd(b) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'jklmno', 'above': 'cdefgh'}
        sig21 = substitute_dummies(sig21,
                                   new_indices=True,
                                   pretty_indices=index_rule)
    if flavor == "DIP":
        PermutList = [PermutationOperator(i, j)]
        sig21 = evaluate_deltas(
            wicks(L1 * cc * Fd(a) * F(k) * F(j) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'lmno', 'above': 'bcdefgh'}
        sig21 = substitute_dummies(sig21,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig21 = simplify_index_permutations(sig21, PermutList)
    if flavor == "DEA":
        PermutList = [PermutationOperator(a, b)]
        sig21 = evaluate_deltas(
            wicks((L1 * cc) * Fd(a) * Fd(b) * Fd(c) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'jklmno', 'above': 'defgh'}
        sig21 = substitute_dummies(sig21,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig21 = simplify_index_permutations(sig21, PermutList)

    sigma_21 = Symbol('(L_{1}\overline{H}_{SD})')
    final_eq = Eq(sigma_21, sig21)
    display(final_eq)

    if flavor == "IP":
        PermutList = [PermutationOperator(i, j)]
        sig22 = evaluate_deltas(
            wicks(L2 * (cc - E_cc) * Fd(a) * F(j) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'klmno', 'above': 'bcdefgh'}
        sig22 = substitute_dummies(sig22,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig22 = simplify_index_permutations(sig22, PermutList)
    if flavor == "EA":
        PermutList = [PermutationOperator(a, b)]
        sig22 = evaluate_deltas(
            wicks(L2 * (cc - E_cc) * Fd(a) * Fd(b) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'jklmno', 'above': 'cdefgh'}
        sig22 = substitute_dummies(sig22,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig22 = simplify_index_permutations(sig22, PermutList)
    if flavor == "DIP":
        PermutList = [
            PermutationOperator(i, j),
            PermutationOperator(j, k),
            PermutationOperator(i, k)
        ]
        sig22 = evaluate_deltas(
            wicks(L2 * (cc - E_cc) * Fd(a) * F(k) * F(j) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'lmno', 'above': 'bcdefgh'}
        sig22 = substitute_dummies(sig22,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig22 = simplify_index_permutations(sig22, PermutList)
    if flavor == "DEA":
        PermutList = [
            PermutationOperator(a, b),
            PermutationOperator(b, c),
            PermutationOperator(a, c)
        ]
        sig22 = evaluate_deltas(
            wicks(L2 * (cc - E_cc) * Fd(a) * Fd(b) * Fd(c) * F(i),
                  keep_only_fully_contracted=True))
        index_rule = {'below': 'jklmno', 'above': 'defgh'}
        sig22 = substitute_dummies(sig22,
                                   new_indices=True,
                                   pretty_indices=index_rule)
        sig22 = simplify_index_permutations(sig22, PermutList)

    sigma_22 = Symbol('(L_{2}(\overline{H}_{DD}-E_{cc}))')
    final_eq = Eq(sigma_22, sig22)
    display(final_eq)
def main():
    print
    print "Calculates the Coupled-Cluster energy- and amplitude equations"
    print "See 'An Introduction to Coupled Cluster Theory' by"
    print "T. Daniel Crawford and Henry F. Schaefer III"
    print "http://www.ccc.uga.edu/lec_top/cc/html/review.html"
    print

    # setup hamiltonian
    p, q, r, s = symbols("pqrs", dummy=True)
    f = AntiSymmetricTensor("f", (p,), (q,))
    pr = NO((Fd(p) * F(q)))
    v = AntiSymmetricTensor("v", (p, q), (r, s))
    pqsr = NO(Fd(p) * Fd(q) * F(s) * F(r))

    H = f * pr

    # Uncomment the next line to use a 2-body hamiltonian:
    # H=f*pr + Number(1,4)*v*pqsr

    print "Using the hamiltonian:", latex(H)

    print "Calculating nested commutators"
    C = Commutator

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "comm1..."
    comm1 = wicks(C(H, T), simplify_dummies=True, simplify_kronecker_deltas=True)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "comm2..."
    comm2 = wicks(C(comm1, T), simplify_dummies=True, simplify_kronecker_deltas=True)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "comm3..."
    comm3 = wicks(C(comm2, T), simplify_dummies=True, simplify_kronecker_deltas=True)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print "comm4..."
    comm4 = wicks(C(comm3, T), simplify_dummies=True, simplify_kronecker_deltas=True)

    print "construct Hausdoff expansion..."
    eq = H + comm1 + comm2 / 2 + comm3 / 6 + comm4 / 24
    eq = eq.expand()
    eq = evaluate_deltas(eq)
    eq = substitute_dummies(eq, new_indices=True, reverse_order=False, pretty_indices=pretty_dummies_dict)
    print "*********************"
    print

    print "extracting CC equations from full Hbar"
    i, j, k, l = symbols("ijkl", below_fermi=True)
    a, b, c, d = symbols("abcd", above_fermi=True)
    print
    print "CC Energy:"
    print latex(wicks(eq, simplify_dummies=True, keep_only_fully_contracted=True))
    print
    print "CC T1:"
    eqT1 = wicks(NO(Fd(i) * F(a)) * eq, simplify_kronecker_deltas=True, keep_only_fully_contracted=True)
    eqT1 = substitute_dummies(eqT1, reverse_order=False)
    print latex(eqT1)
    print
    print "CC T2:"
    eqT2 = wicks(
        NO(Fd(i) * Fd(j) * F(b) * F(a)) * eq,
        simplify_dummies=True,
        keep_only_fully_contracted=True,
        simplify_kronecker_deltas=True,
    )
    P = PermutationOperator
    eqT2 = simplify_index_permutations(eqT2, [P(a, b), P(i, j)])
    print latex(eqT2)
Beispiel #10
0
i, j, k, l = symbols('i,j,k,l', below_fermi=True)
a, b, c, d = symbols('a,b,c,d', above_fermi=True)

print("Compute CCD energy and amplitude equations term by term")
#BCH: HN + [HN,T] + 0.5*[[HN,T],T] + 1/6 * [[[HN,T],T],T] + 1/24 * [[[[HN,T],T],T],T]

print("zero-order term")
print("<Phi|HN|Phi> = ",
      latex(wicks(HN, simplify_dummies=True, keep_only_fully_contracted=True)))
eqT2 = wicks(NO(Fd(i) * Fd(j) * F(b) * F(a)) * HN,
             simplify_dummies=True,
             keep_only_fully_contracted=True,
             simplify_kronecker_deltas=True)
P = PermutationOperator
eqT2 = simplify_index_permutations(eqT2, [P(a, b), P(i, j)])
print("<Phi|HN|Phi_ij^ab = ", latex(eqT2))
print()

C = Commutator
T1, T2 = get_CC_operators()
T = T2

print("[HN,T]-term")
comm1 = wicks(C(HN, T))
comm1 = evaluate_deltas(comm1)
comm1 = substitute_dummies(comm1,
                           new_indices=True,
                           pretty_indices=pretty_dummies_dict)
print(
    "<Phi|[HN,T]|Phi> = ",
Beispiel #11
0
def main():
    print()
    print("Calculates the Coupled-Cluster energy- and amplitude equations")
    print("See 'An Introduction to Coupled Cluster Theory' by")
    print("T. Daniel Crawford and Henry F. Schaefer III")
    print(
        "Reference to a Lecture Series: http://vergil.chemistry.gatech.edu/notes/sahan-cc-2010.pdf"
    )
    print()

    # setup hamiltonian
    p, q, r, s = symbols("p,q,r,s", cls=Dummy)
    f = AntiSymmetricTensor("f", (p,), (q,))
    pr = NO((Fd(p) * F(q)))
    v = AntiSymmetricTensor("v", (p, q), (r, s))
    pqsr = NO(Fd(p) * Fd(q) * F(s) * F(r))

    H = f * pr + Rational(1, 4) * v * pqsr
    print("Using the hamiltonian:", latex(H))

    print("Calculating 4 nested commutators")
    C = Commutator

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 1...")
    comm1 = wicks(C(H, T))
    comm1 = evaluate_deltas(comm1)
    comm1 = substitute_dummies(comm1)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 2...")
    comm2 = wicks(C(comm1, T))
    comm2 = evaluate_deltas(comm2)
    comm2 = substitute_dummies(comm2)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 3...")
    comm3 = wicks(C(comm2, T))
    comm3 = evaluate_deltas(comm3)
    comm3 = substitute_dummies(comm3)

    T1, T2 = get_CC_operators()
    T = T1 + T2
    print("commutator 4...")
    comm4 = wicks(C(comm3, T))
    comm4 = evaluate_deltas(comm4)
    comm4 = substitute_dummies(comm4)

    print("construct Hausdorff expansion...")
    eq = H + comm1 + comm2 / 2 + comm3 / 6 + comm4 / 24
    eq = eq.expand()
    eq = evaluate_deltas(eq)
    eq = substitute_dummies(eq, new_indices=True, pretty_indices=pretty_dummies_dict)
    print("*********************")
    print()

    print("extracting CC equations from full Hbar")
    i, j, k, l = symbols("i,j,k,l", below_fermi=True)
    a, b, c, d = symbols("a,b,c,d", above_fermi=True)
    print()
    print("CC Energy:")
    print(latex(wicks(eq, simplify_dummies=True, keep_only_fully_contracted=True)))
    print()
    print("CC T1:")
    eqT1 = wicks(
        NO(Fd(i) * F(a)) * eq,
        simplify_kronecker_deltas=True,
        keep_only_fully_contracted=True,
    )
    eqT1 = substitute_dummies(eqT1)
    print(latex(eqT1))
    print()
    print("CC T2:")
    eqT2 = wicks(
        NO(Fd(i) * Fd(j) * F(b) * F(a)) * eq,
        simplify_dummies=True,
        keep_only_fully_contracted=True,
        simplify_kronecker_deltas=True,
    )
    P = PermutationOperator
    eqT2 = simplify_index_permutations(eqT2, [P(a, b), P(i, j)])
    print(latex(eqT2))