def RG(L): if L == 1: return DT, 1 Tleft, Nleft = RG(L // 2) Tright, Nright = RG(L - L // 2) Tmerge, _, _, Nmerge = HOTRG_two.updat_pure(Tleft, Tright, 'y', dcut) return Tmerge, Nmerge
@lru_cache(None) def RG(L): if L == 1: return DT, 1 Tleft, Nleft = RG(L // 2) Tright, Nright = RG(L - L // 2) Tmerge, _, _, Nmerge = HOTRG_two.updat_pure(Tleft, Tright, 'y', dcut) return Tmerge, Nmerge Lnum = 10 Ls = [i for i in range(1, Lnum + 1)] for T in T_list: CL_list = np.zeros(Lnum) DT, IDT = HOTRG_two.Ising_square(T, bias=0) T0 = DT iT0 = IDT N_list = [] for i, L in enumerate(Ls): print(L) Ti, Ni = RG(L) TM = transfer_matrix(Ti) Y, Z = linalg.eigh(TM) # Y = np.abs(Y) lambda1, lambda2 = exclude_degenerate(Y) CL_list[i] = 1 / np.log(np.abs(lambda1 / lambda2)) correlation_length[T] = CL_list SAVE_dATA(correlation_length, Lnum, T_list, dcut, FILE + '/HOTRG_SingleColumn_' + str(dcut) + '.csv')
dir_path2 = Path(FILE2) if not dir_path.exists(): dir_path2.mkdir() # T_list = np.linspace(2.0,2.5,51) T_list = [Tc] EigVnums = dcut scaleFactors = np.zeros((len(T_list),1+trgstep)) for i,T in enumerate(T_list): eigenvalues = np.zeros((trgstep,EigVnums)) DT, IDT = HOTRG_two.Ising_square(T,bias=0) T0 = DT; iT0 = IDT; N_list = [1]; ti=0; FE_list = np.zeros(trgstep) for RG in range(trgstep): TM = transfer_matrix3( T0 ) Y, Z = linalg.eigh(TM) if len(Y) < EigVnums: totalEigs = len(Y) Num0 = EigVnums - totalEigs remains0 = [ 0 for i in range(Num0)] Ys = list(Y)[::-1] Ys = np.log(np.array(Ys))/ (2**RG) Ys = list(Ys) eigenvalues[RG,:] = np.array(Ys + remains0) else: Ys = Y[:-1*EigVnums-1:-1] Ys = np.log(Ys)/(2**RG)
dir_path = Path(FILE) if not dir_path.exists(): dir_path.mkdir() T_list = np.linspace(2.0,2.5,51) EigVnums = 4 for T in T_list: eigenvalues = np.zeros((trgstep+1,EigVnums)) DT, IDT = HOTRG_two.Ising_square(T,bias=0) T0 = DT; iT0 = IDT; N_list = []; ti=0; FE_list = np.zeros(trgstep) N1 = np.max(abs(T0)) T0 = T0/N1 N_list.append(N1) for RG in range(trgstep+1): TM = transfer_matrix2( T0 ) Y, Z = linalg.eigh( TM) eigenvalues[RG,:] = Y[:-1*EigVnums-1:-1] T1,UU,UUT,N1 = HOTRG_two.updat_pure( T0,T0,'y',dcut) iT1 = HOTRG_two.updat_impurity( iT0, T0,'y',dcut,UU,UUT,N1) N_list.append(N1) ## update along x-direction T2,UU,UUT,N1 = HOTRG_two.updat_pure( T1,T1,'x',dcut)
if L == 1: return DT, 1 Tleft, Nleft = RG(L // 2) Tright, Nright = RG(L - L // 2) Tmerge, _, _, Nmerge = HOTRG_two.updat_pure(Tleft, Tright, 'y', dcut) return Tmerge, Nmerge Lnum = 11 Ls = [i for i in range(1, Lnum + 1)] scaleFactors = np.zeros((len(T_list), Lnum)) for h in h_list: Normalization_map = {1: 0} CL_list = np.zeros(Lnum) eigenvalues = np.zeros((Lnum, EigVnums)) DT, IDT = HOTRG_two.Ising_square(Tc * 3, bias=0, h=h) T0 = DT iT0 = IDT N_list = [] for i, L in enumerate(Ls): Ti, Ni = RG(L) if L not in Normalization_map: Normalization_map[L] = [np.log(Ni)] TM = transfer_matrix(Ti) Y, Z = linalg.eigh(TM) if len(Y) < EigVnums:
N = 2 dcut = 16 T = 2. / np.log(1 + 2**0.5) FILE = './RG' + str(trgstep) step = 50 deltT = (2.0 / step) T_list = [1.0 + deltT * i for i in range(step + 1)] dir_path = Path(FILE) if not dir_path.exists(): dir_path.mkdir() for T in T_list: CorMatrix = np.zeros((2**trgstep * 2, 2**trgstep * 2)) DT, IDT = HOTRG_two.Ising_exact(2, 1 / T, 'float') To = DT Ti = IDT # try to initiate memo memo = HOTRG_two.creatMemo(trgstep, sites=[(0, 1)]) memo['denominator'].append(To) if (0, 0) in memo: memo[(0, 0)].append(To) for ele in memo: if ele != 'denominator' and ele != (0, 0): memo[ele].append(Ti) for ii in range(trgstep + 1): HasUpdated = set() To1, UU, UUT, N1 = HOTRG_two.updat_pure(memo['denominator'][-1], memo['denominator'][-1], 'y', dcut)
for dcut in [4, 8, 12, 16, 20, 24, 32, 40]: CmD = dict() ChD = dict() RD = dict() CmX = dict() ChX = dict() RX = dict() for T in T_list: CmD_list = np.zeros(trgstep + 1) ChD_list = np.zeros(trgstep + 1) CmX_list = np.zeros(trgstep + 1) ChX_list = np.zeros(trgstep + 1) DT, IDT = HOTRG_two.Ising_exact(2, 1 / T, 'float') Cm_D, Ch_D, Cm_X, Ch_X = HOTRG_two.Cmax_CHmax(DT, IDT, dcut) CmD_list[0] = Cm_D ChD_list[0] = Ch_D CmX_list[0] = Cm_X ChX_list[0] = Ch_X T0 = DT iT0 = IDT for ii in range(trgstep): ## update along y-direction T1, UU, UUT, N1 = HOTRG_two.updat_pure(T0, T0, 'y', dcut) iT1 = HOTRG_two.updat_impurity(iT0, T0, 'y', dcut, UU, UUT, N1)
if not dir_path.exists(): dir_path.mkdir() T_list = [ 1.0+ deltT*i for i in range(1,step+1) ] for dcut in [4,8,12,16,20,24,32,40]: M2_D = dict(); M4_D = dict(); for T in T_list: M2_list = np.zeros(trgstep); M4_list = np.zeros(trgstep) DT, IDT = HOTRG_two.Ising_exact(2,1/T,'float') S0 = DT; S1 = IDT ; S2 = DT; S3 = IDT ; S4 = DT; for ii in range(trgstep): S0,S1,S2,S3,S4 = HOTRG_two.M4_calculation (S0,S1,S2,S3,S4,dcut) dab = S0.shape[0]*S0.shape[1] norm = np.trace(np.reshape(S0,(dab,dab))) M2 = np.trace(np.reshape( S2,(dab,dab)))/norm M4 = np.trace(np.reshape( S4,(dab,dab)))/norm M2_list[ii] = M2; M4_list[ii] = M4 M2_D[T] = M2_list; M4_D[T] = M4_list
T_list = [1.0 + deltT * i for i in range(step + 1)] dir_path = Path(FILE) if not dir_path.exists(): dir_path.mkdir() for T in T_list: Cij_list = dict() for i in range((2**trgstep) * 2): Cj_list = np.zeros(2**trgstep * 2) # for j in range((2**trgstep)*2): for j in range((2**trgstep) * 2): DT, IDT = HOTRG_two.Ising_exact(2, 1 / T, 'float') To = DT Ti = IDT si = i sj = j Pi = Ti To0 = To if i == 0 and j == 0: Ti = To Pi = To for ii in range(trgstep): Lsi, si = divmod(si, 2)
dir_path = Path(FILE) if not dir_path.exists(): dir_path.mkdir() . for T in T_list: Cij_list = dict(); for i in range( (2**trgstep)*2): Cj_list = np.zeros(2**trgstep*2) # for j in range((2**trgstep)*2): for j in range(i,(2**trgstep)*2): DT, IDT = HOTRG_two.Ising_square(T) To = DT; Ti = IDT; si = i ; sj = j; Pi = Ti ; To0 = To if i==0 and j==0: Ti = To Pi = To for ii in range(trgstep): Lsi,si = divmod(si,2) Lsj,sj = divmod(sj,2) # ## update along y-direction
trgstep = 2 N = 2 step= 50 deltT = (4.0/step) dcut = T_list = [ 1+deltT*i for i in range(1,step+1) ] FE_D = dict() for T in T_list: DT, IDT = HOTRG_two.Ising_exact(2,1/T,'float') # DT, IDT = HOTRG_two.Ising_square (T) T0 = DT; iT0 = IDT; N_list = []; ti=0; FE_list = np.zeros(trgstep) for ii in range(trgstep): ## update along y-direction T1,UU,UUT,N1 = HOTRG_two.updat_pure( T0,T0,'y',dcut) iT1 = HOTRG_two.updat_impurity( iT0, T0,'y',dcut,UU,UUT,N1) N_list.append(N1) ## update along x-direction T2,UU,UUT,N1 = HOTRG_two.updat_pure( T1,T1,'x',dcut) iT2 = HOTRG_two.updat_impurity( iT1, T1,'x',dcut,UU,UUT,N1) N_list.append(N1)