def simplify_all(result, deltas, cumulantE4=False, cumulantE3=False): 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) for t in extendedR: t.contractDeltaFuncs_new() sqa.termChop(extendedR) sqa.combineTerms(extendedR) result = [] for r in extendedR: item1 = replaceRepeatIndicesWithDeltas(r, deltas) item2 = replaceSingleKdeltaWithDeltas(item1, deltas) result.append(replaceAllKdeltaWithDeltas(item2, deltas)) if (cumulantE4): x1 = sqa.index('Ax1', [sqa.options.active_type], True) x2 = sqa.index('Ax2', [sqa.options.active_type], True) x3 = sqa.index('Ax3', [sqa.options.active_type], True) x4 = sqa.index('Ax4', [sqa.options.active_type], True) x5 = sqa.index('Ax5', [sqa.options.active_type], True) x6 = sqa.index('Ax6', [sqa.options.active_type], True) sqa.decomp_4rdms_to_3rdms_sf(result, 'E4', sqa.sfExOp([x1, x2]), sqa.sfExOp([x1, x2, x3, x4]), sqa.sfExOp([x1, x2, x3, x4]), sqa.sfExOp([x1, x2, x3, x4]), sqa.sfExOp([x1, x2, x3, x4, x5, x6])) if (cumulantE3): x1 = sqa.index('Ax1', [sqa.options.active_type], True) x2 = sqa.index('Ax2', [sqa.options.active_type], True) x3 = sqa.index('Ax3', [sqa.options.active_type], True) x4 = sqa.index('Ax4', [sqa.options.active_type], True) sqa.decomp_3rdms_to_2rdms_sf(result, 'E3', sqa.sfExOp([x1, x2]), sqa.sfExOp([x1, x2, x3, x4])) return result
import secondQuantizationAlgebra as sqa sqa.options.verbose = False # definitions tag_core = sqa.options.core_type tag_active = sqa.options.active_type tag_virtual = sqa.options.virtual_type i = sqa.index('Ai', [tag_active], False) j = sqa.index('Aj', [tag_active], False) k = sqa.index('Ak', [tag_active], False) a = sqa.index('Va', [tag_virtual], False) 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) E_ijka = [sqa.sfExOp([i, j, k, a])] E_bnml = [sqa.sfExOp([a, k, j, i])] print "" print "Evaluation of the IC-MRCI Hamiltonian elements based on" print "the spin-free generator and the commutator technique" 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 ""
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
import secondQuantizationAlgebra as sqa 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:
Domains = [tensors[index][3] for index in selection] Usage = [tensors[index][4] for index in selection] CommentKey = {} for tc in list(zip(AllTensors, CommentTensors)): CommentKey[tc[0]] = tc[1] # Write out the tensors print 'namespace NEVPT_' + Class + ' {\n' geraldCode.writeTensors(AllTensors, CommentKey, Domains, Usage) # 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 p = sqa.index('Ap', [tag_active], True) #False)# q = sqa.index('Aq', [tag_active], True) #False)# r = sqa.index('Ar', [tag_active], True) #False)# s = sqa.index('As', [tag_active], True) #False)# a = sqa.index('Va', [tag_virtual], True) #False)# b = sqa.index('Vb', [tag_virtual], True) #False)# c = sqa.index('Vc', [tag_virtual], True) #False)# d = sqa.index('Vd', [tag_virtual], True) #False)# x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) a1 = sqa.index('Vg', [tag_virtual], True) a2 = sqa.index('Vh', [tag_virtual], True)
import secondQuantizationAlgebra as sqa sqa.options.verbose = False # definitions tag_core = sqa.options.core_type tag_active = sqa.options.active_type tag_virtual = sqa.options.virtual_type k = sqa.index('Ak', [tag_active], True) l = sqa.index('Al', [tag_active], True) m = sqa.index('Am', [tag_active], True) c = sqa.index('Vc', [tag_virtual], True) 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) Tsym = sqa.symmetry((0, 1, 2, 3), 1) E_cmlk = [sqa.sfExOp([c, m, l, k])] T_klmc = [sqa.tensor('T2', [k, l, m, c], [Tsym])] print "" print "Evaluation of the IC-MRCI Hamiltonian elements" 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 ""
import secondQuantizationAlgebra as sqa import writeCode import geraldCode sqa.options.verbose = False # definitions tag_core = sqa.options.core_type tag_active = sqa.options.active_type tag_virtual = sqa.options.virtual_type a = sqa.index('Va', [tag_virtual], True) b = sqa.index('Vb', [tag_virtual], True) c = sqa.index('Vc', [tag_virtual], True) d = sqa.index('Vd', [tag_virtual], True) i = sqa.index('Ci', [tag_core], True) j = sqa.index('Cj', [tag_core], True) k = sqa.index('Ck', [tag_core], True) l = sqa.index('Cl', [tag_core], True) p = sqa.index('Ap', [tag_active], True) q = sqa.index('Aq', [tag_active], True) r = sqa.index('Ar', [tag_active], True) s = sqa.index('As', [tag_active], True) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) x3 = sqa.index('Aw', [tag_active], True) x4 = sqa.index('Ax', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True)
import secondQuantizationAlgebra as sqa sqa.options.verbose = False # definitions tag_core = sqa.options.core_type tag_active = sqa.options.active_type tag_virtual = sqa.options.virtual_type k = sqa.index('Ak', [tag_active], True) l = sqa.index('Al', [tag_active], True) m = sqa.index('Am', [tag_active], True) c = sqa.index('Vc', [tag_virtual], True) 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) Tsym = sqa.symmetry((0,1, 2,3), 1) E_cmlk = [sqa.sfExOp([c, m, l, k])] T_klmc = [sqa.tensor('T2', [k, l, m, c], [Tsym])] print "" print "Evaluation of the IC-MRCI Hamiltonian elements" 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 ""
Domains= [tensors[index][3] for index in selection] Usage= [tensors[index][4] for index in selection] CommentKey = {} for tc in list(zip(AllTensors, CommentTensors)): CommentKey[tc[0]] = tc[1] # Write out the tensors print 'namespace NEVPT_'+Class+' {\n' geraldCode.writeTensors(AllTensors, CommentKey, Domains, Usage) # 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 i = sqa.index('Ci', [tag_core], withC) j = sqa.index('Cj', [tag_core], withC) q = sqa.index('Aq', [tag_active], withC) r = sqa.index('Ar', [tag_active], withC) a = sqa.index('Va', [tag_virtual], withC) b = sqa.index('Vb', [tag_virtual], withC) c = sqa.index('Vc', [tag_virtual], withC) d = sqa.index('Vd', [tag_virtual], withC) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) a1 = sqa.index('Vg', [tag_virtual], True) a2 = sqa.index('Vh', [tag_virtual], True)
Domains = [tensors[index][3] for index in selection] Usage = [tensors[index][4] for index in selection] CommentKey = {} for tc in list(zip(AllTensors, CommentTensors)): CommentKey[tc[0]] = tc[1] # Write out the tensors print 'namespace NEVPT_' + Class + ' {\n' geraldCode.writeTensors(AllTensors, CommentKey, Domains, Usage) # 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 p = sqa.index('Ap', [tag_active], withC) q = sqa.index('Aq', [tag_active], withC) r = sqa.index('Ar', [tag_active], withC) u = sqa.index('Au', [tag_active], withC) v = sqa.index('Av', [tag_active], withC) w = sqa.index('Aw', [tag_active], withC) a = sqa.index('Va', [tag_virtual], withC) b = sqa.index('Vb', [tag_virtual], withC) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) a1 = sqa.index('Vg', [tag_virtual], True) a2 = sqa.index('Vh', [tag_virtual], True)
# E. Neuscamman, T. Yanai, and G. K.-L. Chan. # J. Chem. Phys. 130, 124102 (2009) import secondQuantizationAlgebra as sqa # Define short names for type groups 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])]))
args = parser.parse_args() cumulantE4 = args.cumulantE4 commentE3 = args.commentE3 if cumulantE4 and commentE3: print "Cannot have both 'cumulantE4' and 'commentE3'!" exit() 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 tag_auxiliary = sqa.options.auxiliary_type i = sqa.index('Ci', [tag_core], True) j = sqa.index('Cj', [tag_core], True) k = sqa.index('Ck', [tag_core], True) l = sqa.index('Cl', [tag_core], True) p = sqa.index('Ap', [tag_active], True) q = sqa.index('Aq', [tag_active], True) r = sqa.index('Ar', [tag_active], True) s = sqa.index('As', [tag_active], True) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) x3 = sqa.index('Aw', [tag_active], True) x4 = sqa.index('Ax', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) i3 = sqa.index('Co', [tag_core], True)
def outputs(liste, filename): f = open(filename, 'w') for t in liste: f.write('%s \n' % t) f.close() print 'wrote: ', filename 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 ia1 = sqa.index('Ca1', [tag_core, ['alpha']], True) ia2 = sqa.index('Ca2', [tag_core, ['alpha']], True) ib1 = sqa.index('Cb1', [tag_core, ['beta']], True) ib2 = sqa.index('Cb2', [tag_core, ['beta']], True) #symmetry sym = sqa.symmetry((1, 0), 1) # tensor (name,indexes,symmetry) tensor = sqa.tensor('t1', [ia1, ia2, ib1, ib2], []) # delta (indexes) delta = sqa.kroneckerDelta([ia1, ia2]) # sfExOp (indexes) sf = sqa.sfExOp([ia1, ia2]) # creOp/desOp (index) cre1 = sqa.creOp(ia1)
import secondQuantizationAlgebra as sqa import writeCode sqa.options.verbose = False # definitions tag_core = sqa.options.core_type tag_active = sqa.options.active_type tag_virtual = sqa.options.virtual_type a = sqa.index('Va', [tag_virtual], False) b = sqa.index('Vb', [tag_virtual], False) c = sqa.index('Vc', [tag_virtual], False) d = sqa.index('Vd', [tag_virtual], False) i = sqa.index('Ci', [tag_core], False) j = sqa.index('Cj', [tag_core], False) k = sqa.index('Ck', [tag_core], False) l = sqa.index('Cl', [tag_core], False) q = sqa.index('Ap', [tag_active], False) r = sqa.index('Ar', [tag_active], False) u = sqa.index('Au', [tag_active], True) v = sqa.index('Av', [tag_active], True) w = sqa.index('Aw', [tag_active], True) x = sqa.index('Ax', [tag_active], True) m = sqa.index('Cm', [tag_core], True) n = sqa.index('Cn', [tag_core], True) o = sqa.index('Co', [tag_core], True) p = sqa.index('Cp', [tag_core], True) g = sqa.index('Vg', [tag_virtual], True) h = sqa.index('Vh', [tag_virtual], True)
import secondQuantizationAlgebra as sqa sqa.options.verbose = False # definitions tg_c = sqa.options.core_type tg_a = sqa.options.active_type tg_v = sqa.options.virtual_type tg_t = tg_c + tg_a + tg_v i = [sqa.index('i%i' %j, [tg_c], True) for j in range(8)] r = [sqa.index('r%i' %j, [tg_a], True) for j in range(8)] a = [sqa.index('a%i' %j, [tg_v], True) for j in range(8)] m = [sqa.index('m%i' %j, [tg_t], True) for j in range(8)] t_sym = [ sqa.symmetry((1,0,3,2),1) ] W_sym = [ sqa.symmetry((1,0,3,2),1), sqa.symmetry((0,3,2,1),1) ] t_ts_ket_1 = [ sqa.tensor('t2', [a[0], a[3], i[0], i[1]], t_sym) ] t_ops_ket_1= [ sqa.sfExOp([i[0], i[1], a[0], a[3]]) ] W_ts_ket_1 = [ sqa.tensor('W', [a[1], a[2], a[3], i[2]], W_sym) ] W_ops_ket_1= [ sqa.sfExOp([a[3], i[2], a[1], a[2]]) ] t_ts_ket_2 = [ sqa.tensor('t2', [a[0], a[1], i[0], i[3]], t_sym) ] t_ops_ket_2= [ sqa.sfExOp([i[0], i[3], a[0], a[1]]) ] W_ts_ket_2 = [ sqa.tensor('W', [i[3], a[2], i[1], i[2]], W_sym) ] W_ops_ket_2= [ sqa.sfExOp([i[1], i[2], i[3], a[2]]) ] t_ts_bra_1 = [ sqa.tensor('t2', [i[4], i[5], a[4], a[7]], t_sym) ] t_ops_bra_1= [ sqa.sfExOp([a[4], a[7], i[4], i[5]]) ] W_ts_bra_1 = [ sqa.tensor('W', [a[7], i[6], a[5], a[6]], W_sym) ] W_ops_bra_1= [ sqa.sfExOp([a[5], a[6], a[7], i[6]]) ]
import secondQuantizationAlgebra as sqa sqa.options.verbose = False # definitions tag_core = sqa.options.core_type tag_active = sqa.options.active_type tag_virtual = sqa.options.virtual_type i = sqa.index('Ai', [tag_active], False) j = sqa.index('Aj', [tag_active], False) a = sqa.index('Va', [tag_virtual], False) b = sqa.index('Vb', [tag_virtual], False) k = sqa.index('Ak', [tag_active], True) l = sqa.index('Al', [tag_active], True) c = sqa.index('Vc', [tag_virtual], True) d = sqa.index('Vd', [tag_virtual], True) 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) Tsym = sqa.symmetry((0,1, 2,3), 1) E_ijab = [sqa.sfExOp([i, j, a, b])] E_dclk = [sqa.sfExOp([d, c, l, k])] T_dclk = [sqa.tensor('T2', [k, l, c, d], [Tsym])] print ""
['E2', 'E2', 'aaaa', 'D'], ['E3', 'E3', 'aaaaaa', 'D'], ['E4', 'E4', 'aaaaaaaa', 'D'], ['deltac', 'delta', 'cc', 'D'], ['deltaa', 'delta', 'aa', 'D'], ['deltav', 'delta', 'ee', 'D'], ] # TENSORS ----------------------------------------------------------------------------------------- # 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 # For Onu and Omu i1 = sqa.index('Ci1', [tag_core], True) i2 = sqa.index('Ci2', [tag_core], True) i3 = sqa.index('Ci3', [tag_core], True) i4 = sqa.index('Ci4', [tag_core], True) i5 = sqa.index('Ci5', [tag_core], True) i6 = sqa.index('Ci6', [tag_core], True) i7 = sqa.index('Ci7', [tag_core], True) j1 = sqa.index('Cj1', [tag_core], True) j2 = sqa.index('Cj2', [tag_core], True) j3 = sqa.index('Cj3', [tag_core], True) j4 = sqa.index('Cj4', [tag_core], True) j5 = sqa.index('Cj5', [tag_core], True) j6 = sqa.index('Cj6', [tag_core], True) j7 = sqa.index('Cj7', [tag_core], True) k1 = sqa.index('Ck1', [tag_core], True) k2 = sqa.index('Ck2', [tag_core], True)
args = parser.parse_args() cumulantE4 = args.cumulantE4 commentE3 = args.commentE3 if cumulantE4 and commentE3: print "Cannot have both 'cumulantE4' and 'commentE3'!" exit() 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 tag_auxiliary = sqa.options.auxiliary_type i = sqa.index('Ci', [tag_core], True) j = sqa.index('Cj', [tag_core], True) q = sqa.index('Aq', [tag_active], True) r = sqa.index('Ar', [tag_active], True) a = sqa.index('Va', [tag_virtual], True) b = sqa.index('Vb', [tag_virtual], True) c = sqa.index('Vc', [tag_virtual], True) d = sqa.index('Vd', [tag_virtual], True) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) x3 = sqa.index('Aw', [tag_active], True) x4 = sqa.index('Ax', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) i3 = sqa.index('Co', [tag_core], True)
import secondQuantizationAlgebra as sqa 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
help='cumulantE4') args = parser.parse_args() cumulantE4 = args.cumulantE4 commentE3 = args.commentE3 if cumulantE4 and commentE3: print "Cannot have both 'cumulantE4' and 'commentE3'!" exit() 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 i = sqa.index('Ci', [tag_core], True) j = sqa.index('Cj', [tag_core], True) p = sqa.index('Ap', [tag_active], True) q = sqa.index('Aq', [tag_active], True) r = sqa.index('Ar', [tag_active], True) u = sqa.index('Au', [tag_active], True) v = sqa.index('Av', [tag_active], True) w = sqa.index('Aw', [tag_active], True) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) x3 = sqa.index('Aw', [tag_active], True) x4 = sqa.index('Ax', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) i3 = sqa.index('Co', [tag_core], True)
# Define Amplitude symmetries a1sym = [] a2sym_aaaa = [sqa.symmetry((1, 0, 2, 3), -1), sqa.symmetry((0, 1, 3, 2), -1)] a2sym_abab = [] a2sym_sf = [sqa.symmetry((1, 0, 3, 2), 1)] # Define integral symmetries h1sym = d1sym h2sym_aaaa = d2sym_aaaa h2sym_abab = d2sym_abab h2sym_sf = [sqa.symmetry((2, 3, 0, 1), 1), sqa.symmetry((1, 0, 3, 2), 1)] # Define dummy indices dummyInd = [] for i in range(20): dummyInd.append(sqa.index('i%i' % i, [], True)) # 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]))
Domains= [tensors[index][3] for index in selection] Usage= [tensors[index][4] for index in selection] CommentKey = {} for tc in list(zip(AllTensors, CommentTensors)): CommentKey[tc[0]] = tc[1] # Write out the tensors print 'namespace NEVPT_'+Class+' {\n' geraldCode.writeTensors(AllTensors, CommentKey, Domains, Usage) # 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 i = sqa.index('Ci', [tag_core], withC) j = sqa.index('Cj', [tag_core], withC) k = sqa.index('Ck', [tag_core], withC) l = sqa.index('Cl', [tag_core], withC) p = sqa.index('Ap', [tag_active], withC) q = sqa.index('Aq', [tag_active], withC) a = sqa.index('Va', [tag_virtual], withC) b = sqa.index('Vb', [tag_virtual], withC) x1 = sqa.index('Au', [tag_active], True) x2 = sqa.index('Av', [tag_active], True) i1 = sqa.index('Cm', [tag_core], True) i2 = sqa.index('Cn', [tag_core], True) a1 = sqa.index('Vg', [tag_virtual], True) a2 = sqa.index('Vh', [tag_virtual], True)
import secondQuantizationAlgebra as sqa tg_a = sqa.options.alpha_type tg_b = sqa.options.beta_type tg_c = sqa.options.core_type tg_v = sqa.options.virtual_type tg_h = sqa.options.core_type + sqa.options.virtual_type p0 = sqa.index('p0', [tg_h], True) p1 = sqa.index('p1', [tg_h], True) p2 = sqa.index('p2', [tg_h], True) p3 = sqa.index('p3', [tg_h], True) q0 = sqa.index('q0', [tg_v], True) q1 = sqa.index('q1', [tg_c], True) sym_h2abab = sqa.symmetry((2,3,0,1),1) h2abab = sqa.tensor('h2abab', [p0, p1, p2, p3], [sym_h2abab]) p0_c = sqa.creOp(p0) p1_c = sqa.creOp(p1) p2_d = sqa.desOp(p2) p3_d = sqa.desOp(p3) t1aa = sqa.tensor('t1aa', [q0, q1], []) q0_c = sqa.creOp(q0) q1_d = sqa.desOp(q1) term = sqa.term(1.0, [], [t1aa, q0_c, q1_d, h2abab, p0_c, p1_c, p3_d, p2_d]) print term print '' result = sqa.normalOrder(term) for t in result: print t print '' for t in result: t.contractDeltaFuncs()