Ejemplo n.º 1
0
W_ops_bra_1= [ sqa.sfExOp([a[5], a[6], a[7], i[6]]) ] 

t_ts_bra_2 = [ sqa.tensor('t2', [i[4], i[7], a[4], a[5]], t_sym) ]
t_ops_bra_2= [ sqa.sfExOp([a[4], a[5], i[4], i[7]]) ] 
W_ts_bra_2 = [ sqa.tensor('W', [i[5], i[6], i[7], a[6]], W_sym) ]
W_ops_bra_2= [ sqa.sfExOp([i[7], a[6], i[5], i[6]]) ] 

terms = []
#Op1   = t_ts_ket_1 + t_ops_ket_1 + W_ts_ket_1 + W_ops_ket_1 + W_ts_bra_1 + W_ops_bra_1 + t_ts_bra_1 + t_ops_bra_1
#terms.append( sqa.term( 1.0, [], Op1) )
#Op2 = t_ts_ket_2 + t_ops_ket_2 + W_ts_ket_2 + W_ops_ket_2 + W_ts_bra_1 + W_ops_bra_1 + t_ts_bra_1 + t_ops_bra_1
#terms.append( sqa.term( 1.0, [], Op2) )
#Op3 = t_ts_ket_1 + t_ops_ket_1 + W_ts_ket_1 + W_ops_ket_1 + W_ts_bra_2 + W_ops_bra_2 + t_ts_bra_2 + t_ops_bra_2
#terms.append( sqa.term( 1.0, [], Op3) )
Op4 = t_ts_ket_2 + t_ops_ket_2 + W_ts_ket_2 + W_ops_ket_2 + W_ts_bra_2 + W_ops_bra_2 + t_ts_bra_2 + t_ops_bra_2
terms.append( sqa.term( 1.0, [], Op4) )

print "pure"
for t in terms:
    print t
print ""

print "normal order form"
Nterms = []
for t in terms:
    Nterm = sqa.normalOrder( t )
    for tn in Nterm:
        print tn
    Nterms += Nterm
print ""
Ejemplo n.º 2
0
    [gimme('ac'), gimme('ac')],  # ccaa
    [gimme('vc'), gimme('aa')],  # vaca
    [gimme('ac'), gimme('va')],  # avca
    [gimme('va'), gimme('aa')],  # vaaa
    [gimme('ac'), gimme('aa')]
]  # caaa

# Construct |Psi_1> and <Psi_1|
psi1_right = []
psi1_left = []
for i in range(9):
    basis1 = sqa.sfExOp(basis[i][0])
    basis2 = sqa.sfExOp(basis[i][1])
    unique = unique_tensor(reorga_two_to_one(basis1, basis2))
    tensor = sqa.tensor('D' + class_names[i], unique, [])  #symm(unique)) #NO!
    psi1_right.append(sqa.term(1.0, [''], [tensor, basis1, basis2]))

    basis1 = sqa.sfExOp([basis[i][1][t] for t in [1, 0]])
    basis2 = sqa.sfExOp([basis[i][0][t] for t in [1, 0]])
    unique = unique_tensor(reorga_two_to_one(basis1, basis2))
    tensor = sqa.tensor('D' + class_names[i], unique, [])  #symm(unique)) #NO!
    psi1_left.append(sqa.term(1.0, [''], [tensor, basis1, basis2]))

# (LOG if want to debug)
if print_log:
    print '//'
    print '// With the unique tensors found, |Psi1> is:'
    for right_term in psi1_right:
        print '// d_{:5} E_{:2} E_{:2}        Class:{:6} OccPattern:{:9}'.format(\
                              code(indices_of_Tensor(right_term)[0]),\
                              code(indices_of_ExOp(right_term)[0]),\
Ejemplo n.º 3
0
import secondQuantizationAlgebra as sqa
from tools_for_sqa import *
from tools_for_pt  import *
sqa.options.verbose = False

# Make H0
H=h0('MRLCC',df=True)

# Define Omu
list1=gimme('caav')
list2=[list1[i] for i in [3,0]]
list3=[list1[i] for i in [1,2]]
pvec1  = sqa.tensor('p1', list1, symm(list1))
OmuA   = sqa.term(1.0, [''],  [pvec1,  sqa.sfExOp(list2), sqa.sfExOp(list3)])
list2=[list1[i] for i in [1,0]]
list3=[list1[i] for i in [3,2]]
pvec2  = sqa.tensor('p2', list1, symm(list1))
OmuB   = sqa.term(1.0, [''],  [pvec2,  sqa.sfExOp(list2), sqa.sfExOp(list3)])

# Define Onu
list1=gimme('caav')
list2=[list1[i] for i in [2,1]]
list3=[list1[i] for i in [0,3]]
Apvec1 = sqa.tensor('Ap1', list1, symm(list1))
OnuA   = sqa.term(1.0, [''],  [Apvec1, sqa.sfExOp(list2), sqa.sfExOp(list3)])
list2=[list1[i] for i in [2,3]]
list3=[list1[i] for i in [0,1]]
Apvec2 = sqa.tensor('Ap2', list1, symm(list1))
OnuB   = sqa.term(1.0, [''],  [Apvec2, sqa.sfExOp(list2), sqa.sfExOp(list3)])

# Define the normal-ordered A matrix:
Ejemplo n.º 4
0
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)

# Define tensors
K_C = sqa.tensor('int1c', [i1, i2], [hsym])
K_A = sqa.tensor('int1a', [x1, x2], [hsym])
K_V = sqa.tensor('int1v', [a1, a2], [hsym])
V_Al = sqa.tensor('int2Laa', [L, x1, x3], [])
V_Ar = sqa.tensor('int2Laa', [L, x2, x4], [])
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define Hamilonian terms
T_C = sqa.term(1.0, [''], [K_C, sqa.sfExOp([i1, i2])])
T_A = sqa.term(1.0, [''], [K_A, sqa.sfExOp([x1, x2])])
T_V = sqa.term(1.0, [''], [K_V, sqa.sfExOp([a1, a2])])
HD_A = sqa.term(0.5, [''], [V_Al, V_Ar, sqa.sfExOp([x1, x2, x3, x4])])

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
pvec = sqa.tensor('p', [i, p, q, r], [])
Apvec = sqa.tensor('Ap', [j, u, v, w], [])
Omu = sqa.term(1.0, [''], [pvec, sqa.sfExOp([q, i]), sqa.sfExOp([p, r])])
Onu = sqa.term(1.0, [''], [Apvec, sqa.sfExOp([w, u]), sqa.sfExOp([j, v])])
commutator = []
commutator += sqa.commutator(T_C, Omu)
commutator += sqa.commutator(T_A, Omu)
commutator += sqa.commutator(T_V, Omu)
commutator += sqa.commutator(HD_A, Omu)
Ejemplo n.º 5
0
       [gimme('vc'),gimme('va')],\
       [gimme('ac'),gimme('vc')],\
       [gimme('va'),gimme('va')],\
       [gimme('ac'),gimme('ac')],\
       [gimme('vc'),gimme('aa')],\
       [gimme('ac'),gimme('va')],\
       [gimme('va'),gimme('aa')],\
       [gimme('ac'),gimme('aa')]]
Psi1Right = []
Psi1Left = []
for i in range(9):
    basis1 = sqa.sfExOp(basis[i][0])
    basis2 = sqa.sfExOp(basis[i][1])
    tensor = sqa.tensor('D' + ClassNames[i],
                        unique_tensor(from_basis(basis1, basis2)), [])
    Psi1Right.append(sqa.term(1.0, [''], [tensor, basis1, basis2]))

    basis1 = sqa.sfExOp([basis[i][1][t] for t in [1, 0]])
    basis2 = sqa.sfExOp([basis[i][0][t] for t in [1, 0]])
    tensor = sqa.tensor('D' + ClassNames[i],
                        unique_tensor(from_basis(basis1, basis2)), [])
    Psi1Left.append(sqa.term(1.0, [''], [tensor, basis1, basis2]))

# PRINT OUT STUFF
print '//'
print '// With the unique tensors found, |Psi1> is:'
for el in Psi1Right:
    print '// d_{:5} E_{:2} E_{:2}        Class:{:6} OccPattern:{:9}'.format(\
                          code([i.indices for i in el.tensors if not isinstance(i,sqa.sfExOp)][0]),\
                          code([i.indices for i in el.tensors if     isinstance(i,sqa.sfExOp)][0]),\
                          code([i.indices for i in el.tensors if     isinstance(i,sqa.sfExOp)][1]),\
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|", E_ijab[0] , "|Psi>: R !!!!!"
print "@@@ SIGMA(Ai, Aj, Va, Vb) <--  H(Ai, Aj, Va, Vb;0) T(0)"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])
        
        term1 = sqa.term( 1.0, ["T0"], E_ijab + [h_pq] + E_pq)
        
        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)
                
        result += batch1

        sqa.combineTerms(result)
        sqa.termChop(result)                
Ejemplo n.º 7
0
a4  = sqa.index('Vf',  [tag_virtual], True)



#h0 one body term
hsym   = sqa.symmetry((1,0), 1)
Dsym_a = sqa.symmetry((2,1, 0,3), 1)
Dsym_b = sqa.symmetry((0,3, 2,1), 1)
Dsym_c = sqa.symmetry((1,0, 3,2), 1)
K_C = sqa.tensor('int1', [i1,i2], [hsym])
K_A = sqa.tensor('int1', [x1,x2], [hsym])
K_V = sqa.tensor('int1', [a1,a2], [hsym])
V_A = sqa.tensor('int2', [x1,x2, x3,x4], [Dsym_a, Dsym_b, Dsym_c])


HD_A   = sqa.term( 0.5, [""], [V_A,   sqa.sfExOp([x1,x2,x3,x4])] )
T_C    = sqa.term( 1.0, [""], [K_C,   sqa.sfExOp([i1,i2])] )
T_A    = sqa.term( 1.0, [""], [K_A,   sqa.sfExOp([x1,x2])] )
T_V    = sqa.term( 1.0, [""], [K_V,   sqa.sfExOp([a1,a2])] )


#first excitation
E_aiEbj  = sqa.term( 1.0, [""],  [sqa.sfExOp([a, i]) , sqa.sfExOp([b,q])])
E_aiEbj2 = sqa.term( 1.0, [""],  [sqa.sfExOp([r, d]) , sqa.sfExOp([j,c])])

commutator = []
commutator +=  sqa.commutator(HD_A, E_aiEbj)
commutator +=  sqa.commutator(T_C, E_aiEbj)
commutator +=  sqa.commutator(T_A, E_aiEbj)
commutator +=  sqa.commutator(T_V, E_aiEbj)
result = []
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|", E_cmlk[0], "|Psi>: R !!!!!"
print "@@@ SIGMA_0 <-- sum_{klcd} H(0; Vd, Vc, Al, Ak) T(Ak, Al, Vc, Vd)"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])

        term1 = sqa.term(1.0, [], [h_pq] + E_pq + T_klmc + E_cmlk)

        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)

        result += batch1

        sqa.combineTerms(result)
        sqa.termChop(result)
Ejemplo n.º 9
0
hsym = sqa.symmetry((1, 0), 1)
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)

# Define tensors
K_C = sqa.tensor('Wcc', [i1, i2], [hsym])
K_A = sqa.tensor('Waa', [x1, x2], [hsym])
K_V = sqa.tensor('Wvv', [a1, a2], [hsym])
V_A = sqa.tensor('Waaaa', [x1, x2, x3, x4], [Dsym_a, Dsym_b, Dsym_c])
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define Hamilonian terms
T_C = sqa.term(1.0, [''], [K_C, sqa.sfExOp([i1, i2])])
T_A = sqa.term(1.0, [''], [K_A, sqa.sfExOp([x1, x2])])
T_V = sqa.term(1.0, [''], [K_V, sqa.sfExOp([a1, a2])])
HD_A = sqa.term(0.5, [''], [V_A, sqa.sfExOp([x1, x2, x3, x4])])

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
pvec1 = sqa.tensor('p1', [i, p, q, a], [])
pvec2 = sqa.tensor('p2', [i, p, q, a], [])
Apvec1 = sqa.tensor('Ap1', [j, r, s, b], [])
Apvec2 = sqa.tensor('Ap2', [j, r, s, b], [])
OmuA = sqa.term(1.0, [''], [pvec1, sqa.sfExOp([a, i]), sqa.sfExOp([p, q])])
OmuB = sqa.term(1.0, [''], [pvec2, sqa.sfExOp([p, i]), sqa.sfExOp([a, q])])
OnuA = sqa.term(1.0, [''], [Apvec1, sqa.sfExOp([s, r]), sqa.sfExOp([j, b])])
OnuB = sqa.term(1.0, [''], [Apvec2, sqa.sfExOp([s, b]), sqa.sfExOp([j, r])])
commutator1 = []
Ejemplo n.º 10
0
a1 = sqa.index('Vg', [tag_virtual], True)
a2 = sqa.index('Vh', [tag_virtual], True)
a3 = sqa.index('Ve', [tag_virtual], True)
a4 = sqa.index('Vf', [tag_virtual], True)

#h0 one body term
hsym = sqa.symmetry((1, 0), 1)
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)
K_C = sqa.tensor('int1', [i1, i2], [hsym])
K_A = sqa.tensor('int1', [x1, x2], [hsym])
K_V = sqa.tensor('int1', [a1, a2], [hsym])
V_A = sqa.tensor('int2', [x1, x2, x3, x4], [Dsym_a, Dsym_b, Dsym_c])

HD_A = sqa.term(0.5, [""], [V_A, sqa.sfExOp([x1, x2, x3, x4])])
T_C = sqa.term(1.0, [""], [K_C, sqa.sfExOp([i1, i2])])
T_A = sqa.term(1.0, [""], [K_A, sqa.sfExOp([x1, x2])])
T_V = sqa.term(1.0, [""], [K_V, sqa.sfExOp([a1, a2])])

#first excitation
E_aiEbj = sqa.term(1.0, [""], [sqa.sfExOp([p, i]), sqa.sfExOp([a, j])])
E_aiEbj2 = sqa.term(1.0, [""], [sqa.sfExOp([l, b]), sqa.sfExOp([k, q])])

commutator = []
commutator += sqa.commutator(HD_A, E_aiEbj)
commutator += sqa.commutator(T_C, E_aiEbj)
commutator += sqa.commutator(T_A, E_aiEbj)
commutator += sqa.commutator(T_V, E_aiEbj)
result = []
ta = sqa.options.alpha_type
tb = sqa.options.beta_type
tc = sqa.options.core_type
tt = sqa.options.active_type
tv = sqa.options.virtual_type

# Define core indices
ac = [sqa.index('c%i' %i, [ta,tc], False) for i in range(10)]
bc = [sqa.index('c%i' %i, [tb,tc], False) for i in range(10)]

# Define active indices
at = [sqa.index('a%i' %i, [ta,tt], True) for i in range(10)]
bt = [sqa.index('a%i' %i, [tb,tt], True) for i in range(10)]

terms = []
terms.append(sqa.term(1.0, [], [sqa.creOp(ac[0]), sqa.desOp(ac[0])]))
terms.append(sqa.term(1.0, [], [sqa.creOp(ac[0]), sqa.creOp(ac[1]), sqa.desOp(ac[1])]))
terms.append(sqa.term(1.0, [], [sqa.creOp(at[0]), sqa.creOp(ac[0]), sqa.tensor('r0', [at[0], at[1]], []), sqa.creOp(ac[1]), \
                                sqa.desOp(ac[0]), sqa.desOp(at[1])]))
terms.append(sqa.term(1.0, [], [sqa.creOp(at[0]), sqa.creOp(ac[0]), sqa.creOp(ac[1]), \
                                sqa.desOp(ac[0]), sqa.desOp(at[1]), sqa.desOp(ac[1])]))
terms.append(sqa.term(1.0, [], [sqa.creOp(ac[0]), sqa.creOp(ac[1]), sqa.creOp(ac[0]), \
                                sqa.desOp(ac[0]), sqa.desOp(at[1]), sqa.desOp(ac[1])]))
terms.append(sqa.term(1.0, [], [sqa.creOp(at[0]), sqa.creOp(ac[1]), sqa.creOp(ac[0]), \
                                sqa.desOp(ac[1]), sqa.desOp(ac[0]), sqa.desOp(ac[1])]))

print ""
print "Testing removeCoreOpPairs function."
print ""
print "Core indices labeled with c."
print "Active indices labeled with a."
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|", E_ijab[0], "|Psi>: R !!!!!"
print "@@@ SIGMA(Ai, Aj, Va, Vb) <--  H(Ai, Aj, Va, Vb;0) T(0)"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])

        term1 = sqa.term(1.0, ["T0"], E_ijab + [h_pq] + E_pq)

        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)

        result += batch1

        sqa.combineTerms(result)
        sqa.termChop(result)
Ejemplo n.º 13
0
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)

# Define tensors
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define the normal-ordered overlap
Cin1a = sqa.tensor('V1', [i, q, a, p], [])
Cin1b = sqa.tensor('V2', [i, q, p, a], [])
Cout2a = sqa.tensor('b1', [j, s, b, r], [])
Cout2b = sqa.tensor('b2', [j, s, r, b], [])
if (withC):
    Op1a = sqa.term(1.0, [''], [Cin1a, sqa.sfExOp([a, i]), sqa.sfExOp([p, q])])
    Op1b = sqa.term(1.0, [''], [Cin1b, sqa.sfExOp([p, i]), sqa.sfExOp([a, q])])
    Op2a = sqa.term(1.0, [''],
                    [Cout2a, sqa.sfExOp([s, r]),
                     sqa.sfExOp([j, b])])
    Op2b = sqa.term(1.0, [''],
                    [Cout2b, sqa.sfExOp([s, b]),
                     sqa.sfExOp([j, r])])
else:
    Op1a = sqa.term(1.0, [''], [sqa.sfExOp([a, i]), sqa.sfExOp([p, q])])
    Op1b = sqa.term(1.0, [''], [sqa.sfExOp([p, i]), sqa.sfExOp([a, q])])
    Op2a = sqa.term(1.0, [''], [sqa.sfExOp([s, r]), sqa.sfExOp([j, b])])
    Op2b = sqa.term(1.0, [''], [sqa.sfExOp([s, b]), sqa.sfExOp([j, r])])
result = sqa.normalOrder(sqa.multiplyTerms(Op2a, Op1a))
result += sqa.normalOrder(sqa.multiplyTerms(Op2b, Op1a))
result += sqa.normalOrder(sqa.multiplyTerms(Op2a, Op1b))
Ejemplo n.º 14
0
Dsym_a = sqa.symmetry((2,1, 0,3), 1)
Dsym_b = sqa.symmetry((0,3, 2,1), 1)
Dsym_c = sqa.symmetry((1,0, 3,2), 1)

# Define tensors
K_C    = sqa.tensor('int1c', [i1,i2], [hsym])
K_A    = sqa.tensor('int1a', [x1,x2], [hsym])
K_V    = sqa.tensor('int1v', [a1,a2], [hsym])
V_Al   = sqa.tensor('int2Laa', [L,x1,x3], [])
V_Ar   = sqa.tensor('int2Laa', [L,x2,x4], [])
deltaC = sqa.tensor('deltac', [i1,i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1,x2], [hsym])
deltaV = sqa.tensor('deltav', [a1,a2], [hsym])

# Define Hamilonian terms
T_C    = sqa.term( 1.0, [''], [K_C,   sqa.sfExOp([i1,i2])] )
T_A    = sqa.term( 1.0, [''], [K_A,   sqa.sfExOp([x1,x2])] )
T_V    = sqa.term( 1.0, [''], [K_V,   sqa.sfExOp([a1,a2])] )
HD_A   = sqa.term( 0.5, [''], [V_Al,V_Ar,   sqa.sfExOp([x1,x2,x3,x4])] )

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
pvec  = sqa.tensor('p',  [a,b,i,q], [])
Apvec = sqa.tensor('Ap', [c,d,j,r], [])
Omu   = sqa.term( 1.0, [''],  [pvec,  sqa.sfExOp([a, i]) , sqa.sfExOp([b, q])])
Onu   = sqa.term( 1.0, [''],  [Apvec, sqa.sfExOp([r, d]) , sqa.sfExOp([j, c])])
commutator = []
commutator +=  sqa.commutator(T_C,    Omu)
commutator +=  sqa.commutator(T_A,    Omu)
commutator +=  sqa.commutator(T_V,    Omu)
commutator +=  sqa.commutator(HD_A,   Omu)
Ejemplo n.º 15
0
# Define symmetry classes
hsym = sqa.symmetry((1, 0), 1)
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)

# Define tensors
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define the normal-ordered overlap
Cin = sqa.tensor('V', [a, p, q, r], [])
Cout = sqa.tensor('b', [b, u, v, w], [])
if (withC):
    Op1 = sqa.term(1.0, [''], [Cin, sqa.sfExOp([a, q]), sqa.sfExOp([p, r])])
    Op2 = sqa.term(1.0, [''], [Cout, sqa.sfExOp([w, u]), sqa.sfExOp([v, b])])
else:
    Op1 = sqa.term(1.0, [''], [sqa.sfExOp([a, q]), sqa.sfExOp([p, r])])
    Op2 = sqa.term(1.0, [''], [sqa.sfExOp([w, u]), sqa.sfExOp([v, b])])
result = sqa.normalOrder(sqa.multiplyTerms(Op2, Op1))

# Simplify the result
for t in result:
    t.contractDeltaFuncs_new()
sqa.removeVirtOps_sf(result)
sqa.termChop(result)
sqa.combineTerms(result)
extendedR = []
for t in result:
    extendedR += sqa.contractCoreOps_sf(t)
Ejemplo n.º 16
0
import secondQuantizationAlgebra as sqa
from tools_for_sqa import *
from tools_for_pt import *
sqa.options.verbose = False

# Make H0
H = h0('NEVPT', df=True)

# Define Omu
list1 = gimme('vaaa')
list2 = [list1[i] for i in [0, 2]]
list3 = [list1[i] for i in [1, 3]]
pvec = sqa.tensor('p', list1, [])  #symm(list1))
Omu = sqa.term(1.0, [''], [pvec, sqa.sfExOp(list2), sqa.sfExOp(list3)])

# Define Onu
list1 = gimme('vaaa')
list2 = [list1[i] for i in [3, 1]]
list3 = [list1[i] for i in [2, 0]]
Apvec = sqa.tensor('Ap', list1, [])  #symm(list1))
Onu = sqa.term(1.0, [''], [Apvec, sqa.sfExOp(list2), sqa.sfExOp(list3)])

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
commutator = []
for Hterm in H:
    commutator += sqa.commutator(Hterm, Omu)
result = []
for t in commutator:
    result += sqa.normalOrder(sqa.multiplyTerms(Onu, t))
result = simplify_all(result, [deltaC, deltaA, deltaV], cumulantE4=True)
Ejemplo n.º 17
0
a1 = sqa.index('Vg', [tag_virtual], True)
a2 = sqa.index('Vh', [tag_virtual], True)
a3 = sqa.index('Ve', [tag_virtual], True)
a4 = sqa.index('Vf', [tag_virtual], True)

#h0 one body term
hsym = sqa.symmetry((1, 0), 1)
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)
K_C = sqa.tensor('int1', [i1, i2], [hsym])
K_A = sqa.tensor('int1', [x1, x2], [hsym])
K_V = sqa.tensor('int1', [a1, a2], [hsym])
V_A = sqa.tensor('int2', [x1, x2, x3, x4], [Dsym_a, Dsym_b, Dsym_c])

HD_A = sqa.term(0.5, [""], [V_A, sqa.sfExOp([x1, x2, x3, x4])])
T_C = sqa.term(1.0, [""], [K_C, sqa.sfExOp([i1, i2])])
T_A = sqa.term(1.0, [""], [K_A, sqa.sfExOp([x1, x2])])
T_V = sqa.term(1.0, [""], [K_V, sqa.sfExOp([a1, a2])])

#first excitation
E_aiEbj1a = sqa.term(1.0, [""], [sqa.sfExOp([a, i]), sqa.sfExOp([p, q])])
E_aiEbj1b = sqa.term(1.0, [""], [sqa.sfExOp([p, i]), sqa.sfExOp([a, q])])
E_aiEbj2a = sqa.term(1.0, [""], [sqa.sfExOp([s, r]), sqa.sfExOp([j, b])])
E_aiEbj2b = sqa.term(1.0, [""], [sqa.sfExOp([s, b]), sqa.sfExOp([j, r])])

commutator = []
commutator += sqa.commutator(HD_A, E_aiEbj1a)
commutator += sqa.commutator(T_C, E_aiEbj1a)
commutator += sqa.commutator(T_A, E_aiEbj1a)
commutator += sqa.commutator(T_V, E_aiEbj1a)
print ""
print "!!!!! The operator space is L: <Psi|", E_ijka[0],", ",E_bnml[0], "|Psi>: R !!!!!"
print "@@@ SIGMA(Ai, Aj, Ak, Va) <-- H(Ai, Aj, Ak, Va; Vb, Am, Al, Ak) T(Ak, Al, Am, Vb)"
print ""

result = []
# One-body part ....
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])
        
        term1 = sqa.term( 1.0, [], E_ijka + [h_pq] + E_pq + E_bnml)
        
        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)
                
        result += batch1

        term2 = sqa.term(-1.0, [], E_ijka + E_bnml + [h_pq] + E_pq)
    
Ejemplo n.º 19
0
# Define symmetry classes
hsym   = sqa.symmetry((1,0), 1)
Dsym_a = sqa.symmetry((2,1, 0,3), 1)
Dsym_b = sqa.symmetry((0,3, 2,1), 1)
Dsym_c = sqa.symmetry((1,0, 3,2), 1)

# Define tensors
deltaC = sqa.tensor('deltac', [i1,i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1,x2], [hsym])
deltaV = sqa.tensor('deltav', [a1,a2], [hsym])

# Define the normal-ordered overlap
Cin  = sqa.tensor('V', [a,b,i,q], [])
Cout = sqa.tensor('b', [c,d,j,r], [])
if (withC):
  Op1 = sqa.term( 1.0, [''],  [Cin,  sqa.sfExOp([a, i]) , sqa.sfExOp([b, q])])
  Op2 = sqa.term( 1.0, [''],  [Cout, sqa.sfExOp([r, d]) , sqa.sfExOp([j, c])])
else:
  Op1 = sqa.term( 1.0, [''],  [sqa.sfExOp([a, i]) , sqa.sfExOp([b, q])])
  Op2 = sqa.term( 1.0, [''],  [sqa.sfExOp([r, d]) , sqa.sfExOp([j, c])])
result = sqa.normalOrder(sqa.multiplyTerms(Op2, Op1))

# Simplify the result
for t in result:
    t.contractDeltaFuncs_new()
sqa.removeVirtOps_sf(result)
sqa.termChop(result)
sqa.combineTerms(result)
extendedR=[]
for t in result:
    extendedR += sqa.contractCoreOps_sf(t)
Ejemplo n.º 20
0
import secondQuantizationAlgebra as sqa
import geraldCode
import mussardCode

sqa.options.verbose = False

# Define needed indexes as being core,active,virtual
tag_core = sqa.options.core_type
tag_active = sqa.options.active_type
tag_virtual = sqa.options.virtual_type

x1 = sqa.index('Ax1', [tag_active], True)
x2 = sqa.index('Ax2', [tag_active], True)
x3 = sqa.index('Ax3', [tag_active], True)
x4 = sqa.index('Ax4', [tag_active], True)
x5 = sqa.index('Ax5', [tag_active], True)
x6 = sqa.index('Ax6', [tag_active], True)
x7 = sqa.index('Ax7', [tag_active], True)
x8 = sqa.index('Ax8', [tag_active], True)

result = sqa.normalOrder(
    sqa.term(1.0, [''], [sqa.sfExOp([x1, x2, x3, x4, x5, x6, x7, x8])]))
result += sqa.normalOrder(
    sqa.term(1.0, [''], [sqa.sfExOp([x1, x2, x3, x6, x7, x8])]))
result += sqa.normalOrder(sqa.term(1.0, [''], [sqa.sfExOp([x1, x2, x7, x8])]))
result += sqa.normalOrder(sqa.term(1.0, [''], [sqa.sfExOp([x1, x8])]))
for t in result:
    print t
print "Evaluation of the IC-MRCI Hamiltonian elements"
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|", E_iajb[0], E_dlck[0], "|Psi>: R !!!!!"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])
        
        term1 = sqa.term( 1.0, [], E_iajb + [h_pq] + E_pq + E_dlck)
        
        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)
                
        result += batch1

        sqa.combineTerms(result)
        sqa.termChop(result)                
Ejemplo n.º 22
0
K_V = sqa.tensor('int1v', [a1, a2], [hsym])
V_A = sqa.tensor('int2a', [x1, x2, x3, x4], [Dsym_a, Dsym_b, Dsym_c])
V_C = sqa.tensor('int2c', [i1, i2, i3, i4], [Dsym_a, Dsym_b, Dsym_c])
V_V = sqa.tensor('int2v', [a1, a2, a3, a4], [Dsym_a, Dsym_b, Dsym_c])
V_CA1 = sqa.tensor('int2ca1', [i1, x1, i2, x2], [Dsym_a, Dsym_b])
V_CA2 = sqa.tensor('int2ca2', [i1, x1, x2, i2], [])
V_CV1 = sqa.tensor('int2cv1', [i1, a1, i2, a2], [Dsym_a, Dsym_b])
V_CV2 = sqa.tensor('int2cv2', [i1, a1, a2, i2], [])
V_AV1 = sqa.tensor('int2av1', [x1, a1, x2, a2], [Dsym_a, Dsym_b])
V_AV2 = sqa.tensor('int2av2', [x1, a1, a2, x2], [])
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define Hamilonian terms
T_C = sqa.term(1.0, [''], [K_C, sqa.sfExOp([i1, i2])])
T_A = sqa.term(1.0, [''], [K_A, sqa.sfExOp([x1, x2])])
T_V = sqa.term(1.0, [''], [K_V, sqa.sfExOp([a1, a2])])
HD_A = sqa.term(0.5, [''], [V_A, sqa.sfExOp([x1, x2, x3, x4])])
HD_C = sqa.term(0.5, [''], [V_C, sqa.sfExOp([i1, i2, i3, i4])])
HD_V = sqa.term(0.5, [''], [V_V, sqa.sfExOp([a1, a2, a3, a4])])
HD_CA1 = sqa.term(1.0, [''], [V_CA1, sqa.sfExOp([i1, x1, i2, x2])])
HD_CA2 = sqa.term(1.0, [''], [V_CA2, sqa.sfExOp([i1, x1, x2, i2])])
HD_CV1 = sqa.term(1.0, [''], [V_CV1, sqa.sfExOp([i1, a1, i2, a2])])
HD_CV2 = sqa.term(1.0, [''], [V_CV2, sqa.sfExOp([i1, a1, a2, i2])])
HD_AV1 = sqa.term(1.0, [''], [V_AV1, sqa.sfExOp([x1, a1, x2, a2])])
HD_AV2 = sqa.term(1.0, [''], [V_AV2, sqa.sfExOp([x1, a1, a2, x2])])

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
pvec1 = sqa.tensor('p1', [i, p, q, a], [])
Ejemplo n.º 23
0
            listnu = indExOp_Psi1[nu][4:8]

            if is_non_zero(code(listnu) + code_rearrange(listtau)):

                # H
                if indExOp_H4[tau][-1] == 'other' or indExOp_H4[tau][
                        -1] == 'h0':
                    name = 'WO' + indTens_H4[tau][-1]
                elif indExOp_H4[tau][-1] == 'heff4':
                    name = 'WE' + indTens_H4[tau][-1]
                else:
                    name = 'WC' + indTens_H4[tau][-1]
                Wtau = sqa.tensor(name, indTens_H4[tau][:4],
                                  symm(indTens_H4[tau][:4]))
                Vtau = sqa.term(factor[code(listtau)] * 0.5, [''],
                                [Wtau, sqa.sfExOp(listtau)])

                # <Psi1|
                bnu = sqa.tensor('b' + indTens_Psi1[nu][-1],
                                 indTens_Psi1[nu][4:8],
                                 symm(indTens_Psi1[nu][4:8]))
                Onu = sqa.term(
                    1.0, [''],
                    [bnu, sqa.sfExOp(listnu[:2]),
                     sqa.sfExOp(listnu[2:4])])
                #Onu    = sqa.term( 1.0, [''],  [bnu, sqa.sfExOp([listnu[i] for i in [0,2,3,1]])])

                # Define the normal-ordered:   W_nu = <O^T_nu V_tau> W_tau
                term = sqa.multiplyTerms(Onu, Vtau)
                #print term
                result = sqa.normalOrder(term)
Ejemplo n.º 24
0
print "!!!!! The operator space is L: <Psi|", E_ijka[0], ", ", E_bnml[
    0], "|Psi>: R !!!!!"
print "@@@ SIGMA(Ai, Aj, Ak, Va) <-- H(Ai, Aj, Ak, Va; Vb, Am, Al, Ak) T(Ak, Al, Am, Vb)"
print ""

result = []
# One-body part ....
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])

        term1 = sqa.term(1.0, [], E_ijka + [h_pq] + E_pq + E_bnml)

        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)

        result += batch1

        term2 = sqa.term(-1.0, [], E_ijka + E_bnml + [h_pq] + E_pq)
Ejemplo n.º 25
0
# Define symmetry classes
hsym = sqa.symmetry((1, 0), 1)
Dsym_a = sqa.symmetry((2, 1, 0, 3), 1)
Dsym_b = sqa.symmetry((0, 3, 2, 1), 1)
Dsym_c = sqa.symmetry((1, 0, 3, 2), 1)

# Define tensors
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define the normal-ordered overlap
Cin = sqa.tensor('V', [a, b, i, j], [Dsym_c])
Cout = sqa.tensor('b', [c, d, l, k], [Dsym_c])
if (withC):
    Op1 = sqa.term(1.0, [''], [Cin, sqa.sfExOp([a, i]), sqa.sfExOp([b, j])])
    Op2 = sqa.term(1.0, [''], [Cout, sqa.sfExOp([k, d]), sqa.sfExOp([l, c])])
else:
    Op1 = sqa.term(1.0, [''], [sqa.sfExOp([a, i]), sqa.sfExOp([b, j])])
    Op2 = sqa.term(1.0, [''], [sqa.sfExOp([k, d]), sqa.sfExOp([l, c])])
result = sqa.normalOrder(sqa.multiplyTerms(Op2, Op1))

# Simplify the result
for t in result:
    t.contractDeltaFuncs_new()
sqa.removeVirtOps_sf(result)
sqa.termChop(result)
sqa.combineTerms(result)
extendedR = []
for t in result:
    extendedR += sqa.contractCoreOps_sf(t)
Ejemplo n.º 26
0
           "A",  "A", "H"]

pDomains  = "\tint f(int i) {\n"
pDomains += "\t\treturn 2*i;\n"
pDomains += "\t}\n"
pDomains += "\tFDomainDecl DomainDecls[1] = {\n"
pDomains += "\t\t{\"A\", \"a\", f}\n"
pDomains += "\t};"
CommentKey = {}
print "namespace MRLCC_CAAV {\n"
for tc in list(zip(AllTensors, CommentTensors)):
    CommentKey[tc[0]] = tc[1]

geraldCode.writeTensors(AllTensors, CommentKey, Domains, Usage)

HD_C   = sqa.term( 0.5, [""], [V_C,   sqa.sfExOp([i1,i2,i3,i4])] )
HD_A   = sqa.term( 0.5, [""], [V_A,   sqa.sfExOp([x1,x2,x3,x4])] )
HD_V   = sqa.term( 0.5, [""], [V_V,   sqa.sfExOp([a1,a2,a3,a4])] )

HD_CA1 = sqa.term( 1.0, [""], [V_CA1, sqa.sfExOp([i1,x1,i2,x2])] )
HD_CA2 = sqa.term( 1.0, [""], [V_CA2, sqa.sfExOp([i1,x1,x2,i2])] )

HD_CV1 = sqa.term( 1.0, [""], [V_CV1, sqa.sfExOp([i1,a1,i2,a2])] )
HD_CV2 = sqa.term( 1.0, [""], [V_CV2, sqa.sfExOp([i1,a1,a2,i2])] )

HD_AV1 = sqa.term( 1.0, [""], [V_AV1, sqa.sfExOp([x1,a1,x2,a2])] )
HD_AV2 = sqa.term( 1.0, [""], [V_AV2, sqa.sfExOp([x1,a1,a2,x2])] )

T_C    = sqa.term( 1.0, [""], [K_C,   sqa.sfExOp([i1,i2])] )
T_A    = sqa.term( 1.0, [""], [K_A,   sqa.sfExOp([x1,x2])] )
T_V    = sqa.term( 1.0, [""], [K_V,   sqa.sfExOp([a1,a2])] )
Ejemplo n.º 27
0
sqa.options.verbose = False
# definitions
tg_core    = sqa.options.core_type
tg_active  = sqa.options.active_type
tg_virtual = sqa.options.virtual_type

a1 = sqa.index('a1', [tg_active], False)
b1 = sqa.index('b1', [tg_active], False)
a2 = sqa.index('a2', [tg_active], False)
b2 = sqa.index('b2', [tg_active], False)
a3 = sqa.index('a3', [tg_active], False)
b3 = sqa.index('b3', [tg_active], False)
a4 = sqa.index('a4', [tg_active], False)
b4 = sqa.index('b4', [tg_active], False)

a = sqa.index('a', [tg_active], True)

result = []
term = sqa.term(1.0, [], [sqa.sfExOp([a1,b1])] + [sqa.sfExOp([a2,b2])] + [sqa.sfExOp([a3,b3])])
result += sqa.normalOrder(term)

for t in result:
    t.contractDeltaFuncs()

sqa.combineTerms(result)

print "results"
for t in result:
    print t
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|", E_ijab[0], E_dclk[0], "|Psi>: R !!!!!"
print "@@@ SIGMA(Ai, Aj, Va, Vb) <-- sum_{klcd} H(Ai, Aj, Va, Vb; Vd, Vc, Al, Ak) T(Ak, Al, Vc, Vd)"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
  for tag_h1_q in [tag_active, tag_virtual]:

    p = sqa.index('p', [tag_h1_p], True)
    q = sqa.index('q', [tag_h1_q], True)
    E_pq = [sqa.sfExOp([p, q])]
    h_pq = sqa.tensor('h', [p, q], [hsym])
        
    term1 = sqa.term( 1.0, [], E_ijab + [h_pq] + E_pq + T_dclk + E_dclk)
        
    batch1 = sqa.normalOrder(term1)

    sqa.removeVirtOps_sf(batch1)

    for t in batch1:
      t.contractDeltaFuncs_new()

    sqa.combineTerms(batch1)
    sqa.termChop(batch1)
                
    result += batch1

    sqa.combineTerms(result)
    sqa.termChop(result)                
Ejemplo n.º 29
0
V_AV1l = sqa.tensor('int2Laa', [L,x1,x2], [])
V_AV1r = sqa.tensor('int2Lvv', [L,a1,a2], [])
V_AV2l = sqa.tensor('int2Lav', [L,x1,a2], [])
V_AV2r = sqa.tensor('int2Lva', [L,a1,x2], [])
V_Cl   = sqa.tensor('int2Lcc', [L,i1,i3], [])
V_Cr   = sqa.tensor('int2Lcc', [L,i2,i4], [])
V_Al   = sqa.tensor('int2Laa', [L,x1,x3], [])
V_Ar   = sqa.tensor('int2Laa', [L,x2,x4], [])
V_Vl   = sqa.tensor('int2Lvv', [L,a1,a3], [])
V_Vr   = sqa.tensor('int2Lvv', [L,a2,a4], [])
deltaC = sqa.tensor('deltac', [i1,i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1,x2], [hsym])
deltaV = sqa.tensor('deltav', [a1,a2], [hsym])

# Define Hamilonian terms
T_C    = sqa.term( 1.0, [''], [K_C,   sqa.sfExOp([i1,i2])] )
T_A    = sqa.term( 1.0, [''], [K_A,   sqa.sfExOp([x1,x2])] )
T_V    = sqa.term( 1.0, [''], [K_V,   sqa.sfExOp([a1,a2])] )
HD_C   = sqa.term( 0.5, [''], [V_Cl,V_Cr,   sqa.sfExOp([i1,i2,i3,i4])] )
HD_A   = sqa.term( 0.5, [''], [V_Al,V_Ar,   sqa.sfExOp([x1,x2,x3,x4])] )
HD_V   = sqa.term( 0.5, [''], [V_Vl,V_Vr,   sqa.sfExOp([a1,a2,a3,a4])] )
HD_CA1 = sqa.term( 1.0, [''], [V_CA1l,V_CA1r, sqa.sfExOp([i1,x1,i2,x2])] )
HD_CA2 = sqa.term( 1.0, [''], [V_CA2l,V_CA2r, sqa.sfExOp([i1,x1,x2,i2])] )
HD_CV1 = sqa.term( 1.0, [''], [V_CV1l,V_CV1r, sqa.sfExOp([i1,a1,i2,a2])] )
HD_CV2 = sqa.term( 1.0, [''], [V_CV2l,V_CV2r, sqa.sfExOp([i1,a1,a2,i2])] )
HD_AV1 = sqa.term( 1.0, [''], [V_AV1l,V_AV1r, sqa.sfExOp([x1,a1,x2,a2])] )
HD_AV2 = sqa.term( 1.0, [''], [V_AV2l,V_AV2r, sqa.sfExOp([x1,a1,a2,x2])] )

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
pvec  = sqa.tensor('p',  [a,b,p,q], [Dsym_c])
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|",  E_cmlk[0], "|Psi>: R !!!!!"
print "@@@ SIGMA_0 <-- sum_{klcd} H(0; Vd, Vc, Al, Ak) T(Ak, Al, Vc, Vd)"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])
        
        term1 = sqa.term( 1.0, [], [h_pq] + E_pq + T_klmc + E_cmlk)
        
        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)
                
        result += batch1

        sqa.combineTerms(result)
        sqa.termChop(result)                
Ejemplo n.º 31
0
       [gimme('va'),gimme('va')],\
       [gimme('ac'),gimme('ac')],\
       [gimme('vc'),gimme('aa')],\
       [gimme('ac'),gimme('va')],\
       [gimme('va'),gimme('aa')],\
       [gimme('ac'),gimme('aa')]]
Psi1Right = []
Psi1Left = []
for i in range(9):
    basis1 = sqa.sfExOp(basis[i][0])
    basis2 = sqa.sfExOp(basis[i][1])
    tensor = sqa.tensor('D' + names[i],
                        unique_tensor(from_basis(basis1, basis2)), [])
    print '1:',code(unique_tensor (from_basis(basis1,basis2))),\
               code(unique_tensor_old(from_basis(basis1,basis2)))
    Psi1Right.append(sqa.term(1.0, [''], [tensor, basis1, basis2]))

    basis1 = sqa.sfExOp([basis[i][1][t] for t in [1, 0]])
    basis2 = sqa.sfExOp([basis[i][0][t] for t in [1, 0]])
    tensor = sqa.tensor('D' + names[i],
                        unique_tensor(from_basis(basis1, basis2)), [])
    print '1:',code(unique_tensor (from_basis(basis1,basis2))),\
               code(unique_tensor_old(from_basis(basis1,basis2)))
    Psi1Left.append(sqa.term(1.0, [''], [tensor, basis1, basis2]))

# H -----------------------------------------------------------------------------------------------
#   H = t E2 + w E4
#   where for "E4":
#    - the indexes of "E4" run through all possible unique 4-tuples
#        (this is done by sorted the first two indexes)
#      UPDATE: it now runs through all possible 4-tuples
Ejemplo n.º 32
0
         "A", "A", "A", "H", "D", "D", "D", "A"]

pDomains  = "\tint f(int i) {\n"
pDomains += "\t\treturn 2*i;\n"
pDomains += "\t}\n"
pDomains += "\tFDomainDecl DomainDecls[1] = {\n"
pDomains += "\t\t{\"A\", \"a\", f}\n"
pDomains += "\t};"
CommentKey = {}
print "namespace MRLCC_CCVV {\n"
for tc in list(zip(AllTensors, CommentTensors)):
    CommentKey[tc[0]] = tc[1]

geraldCode.writeTensors(AllTensors, CommentKey, Domains, Usage)

HD_C   = sqa.term( 0.5, [""], [V_C,   sqa.sfExOp([i1,i2,i3,i4])] )
HD_A   = sqa.term( 0.5, [""], [V_A,   sqa.sfExOp([x1,x2,x3,x4])] )
HD_V   = sqa.term( 0.5, [""], [V_V,   sqa.sfExOp([a1,a2,a3,a4])] )

HD_CA1 = sqa.term( 1.0, [""], [V_CA1, sqa.sfExOp([i1,x1,i2,x2])] )
HD_CA2 = sqa.term( 1.0, [""], [V_CA2, sqa.sfExOp([i1,x1,x2,i2])] )

HD_CV1 = sqa.term( 1.0, [""], [V_CV1, sqa.sfExOp([i1,a1,i2,a2])] )
HD_CV2 = sqa.term( 1.0, [""], [V_CV2, sqa.sfExOp([i1,a1,a2,i2])] )

HD_AV1 = sqa.term( 1.0, [""], [V_AV1, sqa.sfExOp([x1,a1,x2,a2])] )
HD_AV2 = sqa.term( 1.0, [""], [V_AV2, sqa.sfExOp([x1,a1,a2,x2])] )

T_C    = sqa.term( 1.0, [""], [K_C,   sqa.sfExOp([i1,i2])] )
T_A    = sqa.term( 1.0, [""], [K_A,   sqa.sfExOp([x1,x2])] )
T_V    = sqa.term( 1.0, [""], [K_V,   sqa.sfExOp([a1,a2])] )
Ejemplo n.º 33
0
# Define non-dummy indices
fixedInd = []
for i in range(20):
    fixedInd.append(sqa.index('j%i' % i, [], False))

# Test 1: Normal ordering of a(j1) a(j2) a+(j3) a+(j4)
print ""
print "Starting test 1"
print ""
startTime = time.time()
test1_tensors = []
test1_tensors.append(sqa.desOp(fixedInd[1]))
test1_tensors.append(sqa.desOp(fixedInd[2]))
test1_tensors.append(sqa.creOp(fixedInd[3]))
test1_tensors.append(sqa.creOp(fixedInd[4]))
test1_term = sqa.term(1.0, [], test1_tensors)
test1_output = sqa.normalOrder(test1_term)
sqa.combineTerms(test1_output)
test1_string_output = ''
for t in test1_output:
    test1_string_output += str(t) + '\n'
test1_correct_answer = " (  -1.00000) kdelta(j1,j3) kdelta(j2,j4) \n" + \
                       " (   1.00000) kdelta(j1,j4) kdelta(j2,j3) \n" + \
                       " (   1.00000) kdelta(j1,j3) cre(j4) des(j2) \n" + \
                       " (  -1.00000) kdelta(j1,j4) cre(j3) des(j2) \n" + \
                       " (  -1.00000) kdelta(j2,j3) cre(j4) des(j1) \n" + \
                       " (   1.00000) kdelta(j2,j4) cre(j3) des(j1) \n" + \
                       " (   1.00000) cre(j3) cre(j4) des(j1) des(j2) \n"
print "Test 1 output:"
print test1_string_output
if test1_string_output == test1_correct_answer:
Ejemplo n.º 34
0
K_V = sqa.tensor('Wvv', [a1, a2], [hsym])
V_A = sqa.tensor('Waaaa', [x1, x2, x3, x4], [Dsym_a, Dsym_b, Dsym_c])
V_C = sqa.tensor('Wcccc', [i1, i2, i3, i4], [Dsym_a, Dsym_b, Dsym_c])
V_V = sqa.tensor('Wvvvv', [a1, a2, a3, a4], [Dsym_a, Dsym_b, Dsym_c])
V_CA1 = sqa.tensor('Wcaca', [i1, x1, i2, x2], [Dsym_a, Dsym_b])
V_CA2 = sqa.tensor('Wcaac', [i1, x1, x2, i2], [])
V_CV1 = sqa.tensor('Wcvcv', [i1, a1, i2, a2], [Dsym_a, Dsym_b])
V_CV2 = sqa.tensor('Wcvvc', [i1, a1, a2, i2], [])
V_AV1 = sqa.tensor('Wavav', [x1, a1, x2, a2], [Dsym_a, Dsym_b])
V_AV2 = sqa.tensor('Wavva', [x1, a1, a2, x2], [])
deltaC = sqa.tensor('deltac', [i1, i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1, x2], [hsym])
deltaV = sqa.tensor('deltav', [a1, a2], [hsym])

# Define Hamilonian terms
T_C = sqa.term(1.0, [''], [K_C, sqa.sfExOp([i1, i2])])
T_A = sqa.term(1.0, [''], [K_A, sqa.sfExOp([x1, x2])])
T_V = sqa.term(1.0, [''], [K_V, sqa.sfExOp([a1, a2])])
HD_A = sqa.term(0.5, [''], [V_A, sqa.sfExOp([x1, x2, x3, x4])])
HD_C = sqa.term(0.5, [''], [V_C, sqa.sfExOp([i1, i2, i3, i4])])
HD_V = sqa.term(0.5, [''], [V_V, sqa.sfExOp([a1, a2, a3, a4])])
HD_CA1 = sqa.term(1.0, [''], [V_CA1, sqa.sfExOp([i1, x1, i2, x2])])
HD_CA2 = sqa.term(1.0, [''], [V_CA2, sqa.sfExOp([i1, x1, x2, i2])])
HD_CV1 = sqa.term(1.0, [''], [V_CV1, sqa.sfExOp([i1, a1, i2, a2])])
HD_CV2 = sqa.term(1.0, [''], [V_CV2, sqa.sfExOp([i1, a1, a2, i2])])
HD_AV1 = sqa.term(1.0, [''], [V_AV1, sqa.sfExOp([x1, a1, x2, a2])])
HD_AV2 = sqa.term(1.0, [''], [V_AV2, sqa.sfExOp([x1, a1, a2, x2])])

# Define the normal-ordered A matrix:
# Apvec_nu = < O^T_nu [H,O_mu] >.pvec_mu
pvec = sqa.tensor('p', [i, p, q, r], [])
Ejemplo n.º 35
0
sqa.options.verbose = False
# definitions
tg_core = sqa.options.core_type
tg_active = sqa.options.active_type
tg_virtual = sqa.options.virtual_type

a1 = sqa.index('a1', [tg_active], False)
b1 = sqa.index('b1', [tg_active], False)
a2 = sqa.index('a2', [tg_active], False)
b2 = sqa.index('b2', [tg_active], False)
a3 = sqa.index('a3', [tg_active], False)
b3 = sqa.index('b3', [tg_active], False)
a4 = sqa.index('a4', [tg_active], False)
b4 = sqa.index('b4', [tg_active], False)

a = sqa.index('a', [tg_active], True)

result = []
term = sqa.term(1.0, [], [sqa.sfExOp([a1, b1])] + [sqa.sfExOp([a2, b2])] +
                [sqa.sfExOp([a3, b3])])
result += sqa.normalOrder(term)

for t in result:
    t.contractDeltaFuncs()

sqa.combineTerms(result)

print "results"
for t in result:
    print t
Ejemplo n.º 36
0
# Define symmetry classes
hsym   = sqa.symmetry((1,0), 1)
Dsym_a = sqa.symmetry((2,1, 0,3), 1)
Dsym_b = sqa.symmetry((0,3, 2,1), 1)
Dsym_c = sqa.symmetry((1,0, 3,2), 1)

# Define tensors
deltaC = sqa.tensor('deltac', [i1,i2], [hsym])
deltaA = sqa.tensor('deltaa', [x1,x2], [hsym])
deltaV = sqa.tensor('deltav', [a1,a2], [hsym])

# Define the normal-ordered overlap
Cin  = sqa.tensor('V', [i,j,p,a], [])
Cout = sqa.tensor('b', [k,l,q,b], [])
if (withC):
  Op1 = sqa.term( 1.0, [''],  [Cin,  sqa.sfExOp([p, i]) , sqa.sfExOp([a, j])])
  Op2 = sqa.term( 1.0, [''],  [Cout, sqa.sfExOp([l, b]) , sqa.sfExOp([k, q])])
else:
  Op1 = sqa.term( 1.0, [''],  [sqa.sfExOp([p, i]) , sqa.sfExOp([a, j])])
  Op2 = sqa.term( 1.0, [''],  [sqa.sfExOp([l, b]) , sqa.sfExOp([k, q])])
result = sqa.normalOrder(sqa.multiplyTerms(Op2, Op1))

# Simplify the result
for t in result:
    t.contractDeltaFuncs_new()
sqa.removeVirtOps_sf(result)
sqa.termChop(result)
sqa.combineTerms(result)
extendedR=[]
for t in result:
    extendedR += sqa.contractCoreOps_sf(t)
print "based on the spin-free generator"
print ""
print "!!!!! The operator space is L: <Psi|",  E_dclk[0], "|Psi>: R !!!!!"
print "@@@ SIGMA_0 <-- sum_{klcd} H(0; Vd, Vc, Al, Ak) T(Ak, Al, Vc, Vd)"
print ""

result = []
for tag_h1_p in [tag_active, tag_virtual]:
    for tag_h1_q in [tag_active, tag_virtual]:

        p = sqa.index('p', [tag_h1_p], True)
        q = sqa.index('q', [tag_h1_q], True)
        E_pq = [sqa.sfExOp([p, q])]
        h_pq = sqa.tensor('h', [p, q], [hsym])
        
        term1 = sqa.term( 1.0, [], [h_pq] + E_pq + T_klcd + E_dclk)
        
        batch1 = sqa.normalOrder(term1)

        sqa.removeVirtOps_sf(batch1)

        for t in batch1:
            t.contractDeltaFuncs_new()

        sqa.combineTerms(batch1)
        sqa.termChop(batch1)
                
        result += batch1

        sqa.combineTerms(result)
        sqa.termChop(result)