def Admiss(State, vertices, K): # Check the coupling rules if (qdfs.prod([ qdfs.Delt(State[vertices[nn][0]], State[vertices[nn][1]], State[vertices[nn][2]], K) for nn in xrange(len(vertices)) ])): return True else: return False
def Bfacesparalel(subs, Face, outedges, InFace, OutFace, K): # method checks for out-edges before calculating ME Edges = 6 # ATTENTION: just works with 6-faced hexagon return [(qdfs.DT(K)**(-2) * sum([ qdfs.vi(mm, K)**2 * qdfs.prod([ qdfs.FS(StateN[InFace[Face][(nn + 1) % Edges]], StateN[OutFace[Face][nn]], StateN[InFace[Face][nn]], StateJ[InFace[Face][nn]], mm, StateJ[InFace[Face][ (nn + 1) % Edges]], K) for nn in xrange(Edges) ]) for mm in xrange(K + 1) ])) for StateN in subs for StateJ in subs]
def Admissmemo(statenum): State = TJ[statenum] if (qdfs.prod([ qdfs.Delt(State[vertices[nn][0]], State[vertices[nn][1]], State[vertices[nn][2]], Ktilde) for nn in xrange(len(vertices)) ])): return True else: return False
def Bface_half_paralel(subs, Face, outedges, InFace, OutFace, K): if onlyintegers: m = 2 # Notation of twice the spin to work only with integers else: m = 1 # Notation of twice the spin to work only with integers # method checks for out-edges before calculating ME Edges = 6 # ATTENTION: just works with 6-faced hexagon return [(1 / (qdfs.vi(m, K)**2) * qdfs.prod([ qdfs.FS( StateN[InFace[Face][(nn + 1) % Edges]], StateN[OutFace[Face][nn]], StateN[InFace[Face][nn]], StateJ[InFace[Face][nn]], m, StateJ[InFace[Face][(nn + 1) % Edges]], K) for nn in xrange(Edges) ])) for StateN in subs for StateJ in subs]
def Bface(StateN, StateJ, Face, K): if [StateN[nn] for nn in outedges[Face] ] == [StateJ[nn] for nn in outedges[Face]]: return (qdfs.DT(K)**(-2) * sum([ qdfs.vi(mm, K)**2 * qdfs.prod([ qdfs.FS(StateN[InFace[Face][(nn + 1) % Edges]], StateN[ OutFace[Face][nn]], StateN[InFace[Face][nn]], StateJ[InFace[Face][nn]], mm, StateJ[InFace[Face][(nn + 1) % Edges]], K) for nn in xrange(Edges) ]) for mm in xrange(K + 1) ])) else: return 0
def Bfacetildes(statenumN, statenumJ, Face, K): # method checks for out-edges before calculating ME if Admissmemo(statenumN) and Admissmemo(statenumJ): StateN, StateJ = TJ[statenumN], TJ[statenumJ] return (qdfs.DT(K)**(-2) * sum([ qdfs.vi(mm, K)**2 * qdfs.prod([ qdfs.FS(StateN[InFace[Face][(nn + 1) % Edges]], StateN[OutFace[Face][nn]], StateN[InFace[Face][nn]], StateJ[InFace[Face][nn]], mm, StateJ[InFace[Face][ (nn + 1) % Edges]], K) for nn in xrange(Edges) ]) for mm in xrange(K + 1) ])) else: return 0
def Bface_half(StateN, StateJ, Face, K): if onlyintegers: m = 2 # Notation of twice the spin to work only with integers else: m = 1 # Notation of twice the spin to work only with integers if [StateN[nn] for nn in outedges[Face] ] == [StateJ[nn] for nn in outedges[Face]]: return (1 / (qdfs.vi(m, K)**2) * qdfs.prod([ qdfs.FS(StateN[InFace[Face][(nn + 1) % Edges]], StateN[OutFace[Face][nn]], StateN[InFace[Face][nn]], StateJ[InFace[Face][nn]], m, StateJ[InFace[Face][(nn + 1) % Edges]], K) for nn in xrange(Edges) ])) else: return 0
def Bfacetilde(statenumN, statenumJ, Face, K): if Admissmemo(statenumN) and Admissmemo(statenumJ): StateN, StateJ = TJ[statenumN], TJ[statenumJ] if [StateN[nn] for nn in outedges[Face] ] == [StateJ[nn] for nn in outedges[Face]]: return (qdfs.DT(K)**(-2) * sum([ qdfs.vi(mm, K)**2 * qdfs.prod([ qdfs.FS(StateN[InFace[Face][ (nn + 1) % Edges]], StateN[OutFace[Face][nn]], StateN[InFace[Face][nn]], StateJ[InFace[Face][nn]], mm, StateJ[InFace[Face][(nn + 1) % Edges]], K) for nn in xrange(Edges) ]) for mm in xrange(K + 1) ])) else: return 0 else: return 0