Esempio n. 1
0
def cleanup_normalordered(result, deltas):
    t0 = time.clock()
    length = len(result)
    for t in result:
        t.contractDeltaFuncs_new()
    sqa.removeVirtOps_sf(result)
    sqa.termChop(result)
    sqa.combineTerms(result)
    result2 = []
    for t in result:
        result2 += sqa.contractCoreOps_sf(t)
    for t in result2:
        t.contractDeltaFuncs_new()
    sqa.termChop(result2)
    sqa.combineTerms(result2)
    result = []
    for r in result2:
        item1 = geraldCode.replaceRepeatIndicesWithDeltas(r, deltas)
        item2 = geraldCode.replaceSingleKdeltaWithDeltas(item1, deltas)
        result.append(geraldCode.replaceAllKdeltaWithDeltas(item2, deltas))
    print 'cleanup time: (', length, '->', len(result), ')', time.clock() - t0
    del result2
Esempio n. 2
0
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)
for t in extendedR:
    t.contractDeltaFuncs_new()
sqa.termChop(extendedR)
sqa.combineTerms(extendedR)
result = []
rdmDelta = [deltaC, deltaA, deltaV]
for r in extendedR:
    item1=geraldCode.replaceRepeatIndicesWithDeltas(r, rdmDelta)
    item2=geraldCode.replaceSingleKdeltaWithDeltas(item1, rdmDelta)
    result.append(geraldCode.replaceAllKdeltaWithDeltas(item2, rdmDelta))

# Write out the equation for A.p
print '//Number of terms : ', nbrEqs
print '  FEqInfo EqsRes[%i] = {\n'%(nbrEqs)
geraldCode.WriteCodeSimple(result, AllTensors, CommentKey)
print '\n  };'



Esempio n. 3
0
    t.contractDeltaFuncs_new()
sqa.removeVirtOps_sf(resultO)
sqa.termChop(resultO)
sqa.combineTerms(resultO)
extendedR=[]
for t in resultO:
    extendedR += sqa.contractCoreOps_sf(t)
for t in extendedR:
    t.contractDeltaFuncs_new()
sqa.termChop(extendedR)
sqa.combineTerms(extendedR)
resultO = []
rdmDelta = [deltaC, deltaA, deltaV]
#********this adds delta funcstion when we have repeat indices****************#
for r in extendedR:
    resultO.append(geraldCode.replaceSingleKdeltaWithDeltas(r, rdmDelta))


#print "\tFEqInfo "+EquationName+"[%i] = {\n"%(len(result))
print "\tFEqInfo Overlap[%i] = {\n"%(len(result))
geraldCode.WriteCode_lcc(resultO, AllTensors, ["Ci", "Cj", "Ap", "Aq"], "KLRS", CommentKey, "V", "b", "Overlap", 0.5)
print "\n\t};"

resultO = []
for r in extendedR:
    resultO.append(geraldCode.replaceAllKdeltaWithDeltas(r, rdmDelta))
#    print resultO[-1]
#geraldCode.WriteCode_lcc(resultO, AllTensors, [], "PQRS", CommentKey, "", "S1", "MakeS1")

print"        FEqInfo MakeS1[7] = {"
print"                {\"PQRS,PR,QS\", 4.0  , 3, {17,28,28}},           //S1[PQRS] += 4.0 delta[PR] delta[QS] delta[IK] delta[JL] []"