def fermion_comb(particles): return factorial(SITES) / factorial(SITES - particles) / factorial(particles) DIMENSION = int(fermion_comb(num_up_ferms) * fermion_comb(num_up_ferms)) print(DIMENSION) LENGTH = int(b.np.sqrt(SITES)) #def hop(state, state_dict, next_states, build_hop): # return b.hop_lr_ob(state, state_dict, next_states, build_hop,1,[LENGTH,LENGTH]) def hop(state, state_dict, next_states, build_hop): return b.hop_nn_2d_ob(state, state_dict, next_states, build_hop, [LENGTH, LENGTH]) state_dict, [hop_mat] = b.make_matrices_and_states(initial_state, DIMENSION, hop) import pickle pickle.dump(state_dict, open("s16_FH2d_nn_statedict.p", "wb")) b.save_sparse_csr("l16_FH2d_nn_hop", hop_mat) int_mat = b.make_diag_ops(state_dict, lambda x: np.dot(x['up'], x['down'])) b.save_sparse_csr("l16_FH2d_nn_int", int_mat)
reflat = J_real.reshape(1, J_real.size) imflat = J_imag.reshape(1, J_imag.size) np.savetxt("flatJreal.CSV", reflat, delimiter=',') np.savetxt("flatJimag.CSV", imflat, delimiter=',') # datadir ='/projectnb/twambl/170207_1_s16f4/' # J_real = np.loadtxt(datadir+"flatJreal.CSV",delimiter=',') # J_imag = np.loadtxt(datadir+"flatJimag.CSV",delimiter=',') # J_coup = (J_real + 1j*J_imag).reshape(SITES,SITES,SITES,SITES) #print(J_coup) def SYKint(state, state_dict, next_states, build_mat): return b.SYK_model(state, state_dict, next_states, build_mat, J_coup) funcs = [SYKint] #funcs = [SYKint] + [b.correlation(i,j) for i in range(SITES) for j in range(SITES)] state_dict, mats = b.make_matrices_and_states(initial_state, DIMENSION, *funcs) import pickle pickle.dump(state_dict, open("s" + str(SITES) + "SYK_statedict.p", "wb")) b.save_sparse_csr("s" + str(SITES) + "_SYK_mat", mats[0]) # for i in range(SITES): # for j in range(SITES): # b.save_sparse_csr("s"+str(SITES)+"_corr"+str(i)+str(j),mats[SITES*i+j+1])
data_dir = "/projectnb/twambl/170525_1_s18f9_makemats/" SITES = 18 state_dict = pickle.load( open(data_dir + "s" + str(SITES) + "SYK_statedict.p", "rb")) sigma = 1 rands = np.random.normal(0, sigma, (SITES, SITES)) T_coup = (rands + np.transpose(rands, (1, 0))) / np.sqrt(2) T_flat = T_coup.reshape(1, T_coup.size) np.savetxt("flatTcoup.CSV", T_flat, delimiter=',') def pert_ham_wconst(state, state_dict, next_states, build_mat): return b.quad_pert_ham(state, state_dict, next_states, build_mat, T_coup) #funcs = [pert_ham_wconst] #funcs = [SYKint] + [b.correlation(i,j) for i in range(SITES) for j in range(SITES)] mat = b.make_matrices_from_states(state_dict, pert_ham_wconst) #import pickle #pickle.dump( state_dict, open( "s"+str(SITES)+"SYK_statedict.p", "wb" ) ) b.save_sparse_csr("s" + str(SITES) + "_pert_mat", mat) # for i in range(SITES): # for j in range(SITES): # b.save_sparse_csr("s"+str(SITES)+"_corr"+str(i)+str(j),mats[SITES*i+j+1])
initial_fermion_down = initial_fermion_up[:] initial_state = b.State({ 'up': initial_fermion_up, 'down': initial_fermion_down }) print(str(initial_state)) from math import factorial def fermion_comb(particles): return factorial(LENGTH) / factorial(LENGTH - particles) / factorial(particles) DIMENSION = int(fermion_comb(num_up_ferms) * fermion_comb(num_up_ferms)) print(DIMENSION) state_dict, [hop_mat] = b.make_matrices_and_states(initial_state, DIMENSION, b.hop_lr_a1_ob) import pickle pickle.dump(state_dict, open("s15_FH_lrt_statedict.p", "wb")) b.save_sparse_csr("l15_FH_lrt_hop", hop_mat) int_mat = b.make_diag_ops(state_dict, lambda x: np.dot(x['up'], x['down'])) b.save_sparse_csr("l15_FH_lrt_int", int_mat)