Beispiel #1
0
    def test_connected(self):
        H1 = one_e("f", ["occ", "vir"], norder=True)
        H2 = two_e("I", ["occ", "vir"], norder=True)

        H = H1 + H2
        bra = braE2("occ", "vir", "occ", "vir")
        C0 = E0("c")
        C1 = E1("c", ["occ"], ["vir"])
        C2 = E2("c", ["occ"], ["vir"])
        ket = C0 + C1 + C2

        HC = H * ket
        S = bra * HC
        out = apply_wick(S)
        out.resolve()
        final = AExpression(Ex=out)
        out = [at.connected() for at in final.terms]
        ref = [True] * 19
        ref[0] = ref[1] = ref[2] = ref[3] = False
        self.assertTrue(ref == out)
Beispiel #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)
Beispiel #3
0
from wick.expression import AExpression
from wick.wick import apply_wick
from wick.convenience import one_e, two_e, braE1, ketE1, braE2, ketE2

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

# first derivative wrt X*
bra = braE1("occ", "vir")
S = bra * H
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
final.sort_tensors()
print("dE/dX* =")
print(final)

# first derivative wrt X
ket = ketE1("occ", "vir")
S = H * ket
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
final.sort_tensors()
final.transpose((1, 0))
print("dE/dX =")
print(final)

print("")
# second derivative wrt X*X*
Beispiel #4
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, commute
from wick.convenience import ketE1, ketE2, ketEip1, ketEea1
from wick.convenience import ketEea2, ketEip2, ketEdea1, ketEdip1
from wick.convenience import braE1, braEip1, braEea1
from wick.convenience import braEea2, braEip2, braEdea1, braEdip1

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

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

HT = commute(H, T)
HTT = commute(HT, T)
HTTT = commute(HTT, T)
HTTTT = commute(HTTT, T)

Hbar = H + HT + Fraction('1/2') * HTT + Fraction('1/6') * HTTT

# ov piece
ket = ketE1("occ", "vir")
S = Hbar * ket
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
final.sort_tensors()
Beispiel #5
0
from wick.expression import AExpression
from wick.wick import apply_wick
from wick.convenience import one_e, two_e, E1, braE1

H1 = one_e("f", ["occ", "vir"])
H2 = two_e("I", ["occ", "vir"])

H = H1 + H2
bra = braE1("occ", "vir")
ket = E1("c", ["occ"], ["vir"])

HC = H*ket
S = bra*HC
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
print(final)
Beispiel #6
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

index_key = {
    "occ": "ijklmno",
    "oa": "IJKLMNO",
    "va": "ABCDEFG",
    "vir": "abcdefg"
}

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

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

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

S = bra * H
out = apply_wick(S)
out.resolve()
final = AExpression(Ex=out)
print("Constant:")
print(final)