list_terms = [] list_terms1 = [] #list_terms.extend(comm(['V2'],['T1'],1.0)) #list_terms.extend(prod(['X2'],comm(['V2'],['T1'],0),1.0)) #list_terms.extend(prod(['X2'],comm(comm(['V2'],['T1'],0),['T11'],0),0.5)) #list_terms.extend(prod(['X2'],comm(comm(['V2'],['T1'],0),['D11'],0),-0.5)) #list_terms.extend(prod(['X2'],comm(comm(['V2'],['D1'],0),['T11'],0),-0.5)) #list_terms.extend(prod(['X2'],comm(comm(['V2'],['D1'],0),['D11'],0),0.5)) #driver(1.0/6.0,['X1','V2','T1','T12','T13']) list_terms = prod(['X1'], comm(comm(comm(['V2'], ['T1'], 0), ['T11'], 0), ['T12'], 0), 1.0 / 6.0) list_terms = full_con.full_terms(list_terms) print_terms.print_terms(list_terms, 'latex_output.txt') #testing to pick suitable operators and then projectingto X ''' list_terms=comm(comm(comm(['V2'],['T1'],0),['T11'],0),['T12'],1.0/6.0) print_terms.print_terms(list_terms,'latex_output.txt') list_terms1=pick.pick_test(list_terms,['a','b'],['i','j']) print_terms.print_terms(list_terms1,'latex_output.txt') list_terms=prod(['X1'],list_terms1,1.0) list_terms=full_con.full_terms(list_terms) print_terms.print_terms(list_terms,'latex_output.txt') '''
def driver(fc, list_char_op): #def driver(fc): #build operators #list_char_op=['D2','V2','Y2'] dict_ind = {} lou, dict_ind = lib.make_op.make_op(list_char_op, dict_ind) #Do contractions a = lou[0].st b = lou[0].co #lib.print_op.print_op(lou[0].st,lou[0].co) for i in range(1, len(lou)): a, b = multi_cont.multi_cont(a, lou[i].st, b, lou[i].co) #lib.print_op.print_op(lou[i].st,lou[i].co) #lib.print_op.print_op(a,b) #print '------' #a,b=multi_cont.multi_cont(a,lou[2].st, b, lou[2].co) #a,b=multi_cont.multi_cont(a,lou[3].st, b, lou[3].co) #fully contracted only a, b = lib.full_con.full_con(a, b) #lib.print_op.print_op(a,b) #Changing t,c to object terms.(bug 19Feb2020 comes into already int,c) list_terms = ct.change_terms1(a, b, fc, dict_ind, lou) #compress terms eliminating deltas for term in list_terms: term.compress() #print dict_ind #condition for atleast 1 contraction with H term.cond_cont(dict_ind) term.build_map_org() term.print_term() print 'list terms full con length', len(list_terms) #--- #for term in list_terms: #term.print_term() print '-------final below----' ''' #integral symmetry for i in range(len(list_terms)): for j in range(i+1, len(list_terms)): if list_terms[i].fac!=0 and list_terms[j].fac!=0: flo= list_terms[i].compare(list_terms[j]) if flo!=0: #print i,j,flo list_terms[i].fac=list_terms[i].fac+list_terms[j].fac * flo list_terms[j].fac=0.0 #for item in list_terms: #if item.fac!=0: #print 'yay' #dummy_check for i in range(len(list_terms)): for j in range(i+1,len(list_terms)): if list_terms[i].fac!=0 and list_terms[j].fac!=0: #print list_terms[i].fac, list_terms[j].fac list_terms[i].dummy_check(list_terms[j]) ''' #compare terms based on 5 levels of check all in cpre.compare() for i in range(len(list_terms)): for j in range(i + 1, len(list_terms)): if list_terms[i].fac != 0 and list_terms[j].fac != 0: #print "comparing inside drive -------:", i,j,list_terms[i].coeff_list, list_terms[j].coeff_list flo = cpre.compare(list_terms[i], list_terms[j]) if flo != 0: #print 'in result in the comparision',i,j,flo #print 'this should be 0 always = ',list_terms[i].fac+list_terms[j].fac*flo list_terms[ i].fac = list_terms[i].fac + list_terms[j].fac * flo list_terms[j].fac = 0.0 #print 'out result in the comparision',i,j,list_terms[i].coeff_list,list_terms[j].coeff_list,flo #muliply with the prefactor of the expression from the Housdoff Expression(No need to do this now) #for item in list_terms: # if item.fac!=0.0: # item.fac=item.fac*fc #print list_terms[i].fac, list_terms[j].fac #for term in list_terms: #if term.fac!=0: #print term.fac, term.sum_list, term.coeff_list #print terms properly pt.print_terms(list_terms, 'latex_output.txt')
from tests import ccsd_amplitude as ccsd from main_tools.commutator import comm from library import print_terms from library import full_con #the input of the commutator function is as follows : #if you want a commutator [V,T2]-> comm['op1'],['op2'],prefactor) #NOTE : prefactor should be 0 in case this is not the last of the nested prefactor (clearer in the next eexample) print 'case of [V,T2]' list_terms = comm(['V2'], ['T2'], 1) #The following function selects only the fully contracted terms from the above list_terms list_terms = full_con.full_terms(list_terms) print_terms.print_terms(list_terms) #Case of a nested commutator : #Note that the name of the operators of the same type are different #Like T1,T11,T12,T13 etc print 'case of [[V,T1],T1]' list_terms = comm(comm(['V2'], ['T1'], 0), ['T11'], 1.0) list_terms = full_con.full_terms(list_terms) print_terms.print_terms(list_terms) #Case of Deexcitation operators #Deexcitation operators can be defined by the letter D,everything else remain the same #Notice that we are not using the full_con function here, so it will print all terms, not just fully contracted. print 'case of [[V,D1],T1]' list_terms = comm(comm(['V2'], ['D1'], 0), ['T1'], 1.0) print_terms.print_terms(list_terms) #The code has other small things it can do but these are the basics.