def xx_2site(self): pxp = unlocking_System(np.arange(0, self.base), "open", self.base, 2) pxp.gen_basis() H = Hamiltonian(pxp) H.site_ops[1] = np.array([[0, 1], [1, 0]]) H.model = np.array([[1, 1]]) H.model_coef = np.array([[1]]) H.gen() H.sector.find_eig() return H
def pxp_3site(self, Nc): pxp = unlocking_System(np.arange(0, self.base), "open", self.base, 3) pxp.gen_basis() X = spin_Hamiltonian(pxp, "x").site_ops[1] H = Hamiltonian(pxp) H.site_ops[1] = X H.model = np.array([[0, 1, 0]]) H.model_coef = np.array([[1]]) H.gen() H.sector.find_eig() return H
def HpFromKey(key): Hp = Hamiltonian(pxp) Hp.site_ops[1] = np.array([[0, 0], [1, 0]]) Hp.site_ops[2] = np.array([[0, 1], [0, 0]]) model = [] for m in range(0, np.size(key, axis=0)): if key[m] == 1: model.append([0, 1, 0]) else: model.append([0, 2, 0]) Hp.model = model Hp.model_coef = np.ones(pxp.N) Hp.uc_size = pxp.N * np.ones(pxp.N) Hp.uc_pos = np.arange(0, pxp.N) Hp.gen() return Hp
def cost(alpha): H=Hamiltonian(pxp_half,"x") H.site_ops[1] = np.array([[0,alpha[0]],[alpha[0],0]]) H.model = np.array([[1]]) H.model_coef=np.array((1)) H.gen() H.sector.find_eig() z_rydberg = zm_state(2,1,pxp_half) f_neel_ham = fidelity(z_rydberg,H).eval(t,z_rydberg) # plt.plot(t,f_neel_ham) # plt.show() cut_index = 5 for n in range(0,np.size(f_neel_ham,axis=0)): if f_neel_ham[n]<0.1: cut_index = n break max_index = np.argmax(f_neel_ham[cut_index:]) t0_ham = t[max_index] print(cost,t0_ham) return np.abs(t0_ham-t0_floquet)
H.gen() H.sector.find_eig() z=zm_state(2,1,pxp) #krylov basis krylov_dim = 2*pxp.N krylov_basis = gen_krylov_basis(H.sector.matrix(),krylov_dim,z.prod_basis(),pxp,orth="qr") #FSA basis # P+P on even sites Ipe = Hamiltonian(pxp,pxp_syms) Ipe.site_ops[1] = np.array([[0,1,0],[0,0,0],[0,0,0]]) Ipe.model = np.array([[0,1,0]]) Ipe.model_coef = np.array([1]) Ipe.gen(parity=1) Imo = Hamiltonian(pxp,pxp_syms) Imo.site_ops[1] = np.array([[0,0,0],[1,0,0],[0,0,0]]) Imo.model = np.array([[0,1,0]]) Imo.model_coef = np.array([1]) Imo.gen(parity=0) Ip = H_operations.add(Ipe,Imo,np.array([1,-1])) Ip = Ip.sector.matrix() Im = np.conj(np.transpose(Ip)) plt.matshow(np.abs(Ip)) plt.show() Kpe = Hamiltonian(pxp,pxp_syms) Kpe.site_ops[1] = np.array([[0,0,1],[0,0,0],[0,0,0]]) Kpe.model = np.array([[0,1,0]]) Kpe.model_coef = np.array([1])
def exp(Q, psi): return np.vdot(psi, np.dot(Q, psi)) def var(Q, psi): Q2 = np.dot(Q, Q) return exp(Q2, psi) - exp(Q, psi)**2 N = 12 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=4), PT(pxp)]) H = Hamiltonian(pxp, pxp_syms) H.site_ops[1] = np.array([[0, 1], [1, 0]]) H.model = np.array([[0, 1, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0]]) H.model_coef = np.array([1, -1, -1]) H.uc_size = np.array([1, 4, 4]) H.uc_pos = np.array([0, 3, 1]) H.gen() H.sector.find_eig() z = zm_state(4, 1, pxp) eig_overlap(z, H).plot() plt.show() fidelity(z, H).plot(np.arange(0, 20, 0.01), z) plt.show()
pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=3)]) H0 = Hamiltonian(pxp, pxp_syms) H0.site_ops[1] = np.array([[0, 1], [1, 0]]) H0.model = np.array([[1]]) H0.model_coef = np.array([1]) H1 = Hamiltonian(pxp, pxp_syms) H1.site_ops[1] = np.array([[0, 1], [1, 0]]) H1.model = np.array([[0, 1, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 1, 0]]) H1.model_coef = np.array([1, 1, 1, 1]) H1.uc_size = np.array([3, 3, 3, 3]) H1.uc_pos = np.array([1, 2, 2, 1]) k = [0] H0.gen(k) H1.gen(k) # H0.gen() # H1.gen() H = H_operations.add(H0, H1, np.array([1, -1])) from Calculations import plot_adjacency_graph, connected_comps comp = connected_comps(H, k) # comp = connected_comps(H) comp.find_connected_components() subspace_sizes = dict() for n in range(0, len(comp.components)): print("\n") print(np.size(comp.components[n])) for m in range(0, np.size(comp.components[n], axis=0)): print(pxp.basis[pxp.keys[comp.components[n][m]]])
# Hp = Hamiltonian(pxp,pxp_syms) # Hp.site_ops[1] = np.array([[0,0],[1,0]]) # Hp.site_ops[2] = np.array([[0,1],[0,0]]) # Hp.site_ops[4] = np.array([[0,0],[0,1]]) # Hp.model = np.array([[0,1,2,1,0,4,0],[0,1,2,1,0,4,0],[0,4,0,1,2,1,0],[0,4,0,1,2,1,0]]) # Hp.model_coef = np.array([1,1,1,1]) # Hp.uc_size = np.array([4,4,4,4]) # Hp.uc_pos = np.array([1,3,3,1]) z = zm_state(4, 1, pxp) k = pxp_syms.find_k_ref(z.ref) print(k) # for n in range(0,np.size(k,axis=0)): # Hp.gen(k[n]) Hp.gen() Hm = Hp.herm_conj() # Hz = 1/2 * com(Hp.sector.matrix(k[0]),Hm.sector.matrix(k[0])) Hz = 1 / 2 * com(Hp.sector.matrix(), Hm.sector.matrix()) plt.matshow(np.abs(Hz)) plt.show() e, u = np.linalg.eigh(Hz) print(e) from Diagnostics import print_wf print_wf(u[:, 0], pxp, 1e-2) print("\n") print_wf(u[:, 1], pxp, 1e-2) print("\n") print_wf(u[:, 2], pxp, 1e-2) print("\n") print_wf(u[:, 3], pxp, 1e-2)
H = H.sector.matrix() e, u = np.linalg.eigh(H) z = zm_state(4, 1, pxp) psi_energy = np.dot(np.conj(np.transpose(u)), z.prod_basis()) if plot is True: t = np.arange(0, 20, 0.01) f = np.zeros(np.size(t)) for n in range(0, np.size(t, axis=0)): f[n] = -fidelity_eval(psi_energy, e, t[n]) plt.plot(t, f) plt.show() res = minimize_scalar(lambda t: fidelity_eval(psi_energy, e, t), method="golden", bracket=(4.5, 5.5)) f = -fidelity_eval(psi_energy, e, res.x) print(coef, f) if res.x < 1e-5: return 1000 else: return -f H0.gen() V.gen() from scipy.optimize import minimize res = minimize(lambda coef: fidelity_error(coef), method="Nelder-Mead", x0=[0]) fidelity_error([res.x], plot=True)
#krylov basis krylov_dim = 2 * pxp.N krylov_basis = gen_krylov_basis(H.sector.matrix(), krylov_dim, z.prod_basis(), pxp, orth="qr") #FSA basis # P+P on even sites pe = Hamiltonian(pxp, pxp_syms) pe.site_ops[1] = np.array([[0, 1, 1j], [-1, 0, 0], [-1j, 0, 0]]) pe.model = np.array([[0, 1, 0]]) pe.model_coef = np.array([1]) pe.gen(parity=1) #P-P on odd sites mo = Hamiltonian(pxp, pxp_syms) mo.site_ops[1] = np.array([[0, -1, 1j], [1, 0, 0], [-1j, 0, 0]]) mo.model = np.array([[0, 1, 0]]) mo.model_coef = np.array([1]) mo.gen(parity=0) #Raising op Hp = H_operations.add(pe, mo, np.array([1, 1])) Hp = Hp.sector.matrix() Hm = np.conj(np.transpose(Hp)) def com(a, b): return np.dot(a, b) - np.dot(b, a)
Hp_test0 = Hamiltonian(pxp) Hp_test0.site_ops[1] = np.array([[0, 0], [1, 0]]) Hp_test0.site_ops[2] = np.array([[0, 1], [0, 0]]) Hp_test0.model = np.array([[0, 1, 0], [0, 2, 0]]) Hp_test0.model_coef = np.array([1, 1]) Hp_test0.uc_size = np.array([2, 2]) Hp_test0.uc_pos = np.array([1, 0]) Hp_test = Hamiltonian(pxp) Hp_test.site_ops[1] = np.array([[0, 0], [1, 0]]) Hp_test.site_ops[2] = np.array([[0, 1], [0, 0]]) Hp_test.model = np.array([[0, 2, 1, 2, 0]]) Hp_test.model_coef = np.array([1]) Hp_test0.gen() Hp_test.gen() from Hamiltonian_Classes import H_operations Hp_test = H_operations.add(Hp_test0, Hp_test, np.array([1, coef_f0])) print((np.abs(Hp_test.sector.matrix() - Hp) < 1e-5).all()) Hz = 1 / 2 * com(Hp, Hm) e, u = np.linalg.eigh(Hz) z = zm_state(2, 1, pxp, 1) lw = u[:, 0] print("\n|<lw | Z_2 > |") print(np.abs(np.vdot(lw, z.prod_basis()))) print("\n") from Calculations import gen_fsa_basis, gram_schmidt
d = np.size(temp)-1 if d > int(N/2): d = N - d model_coef = np.append(model_coef,J/np.power(d,alpha)) model.append(temp) Hz = Hamiltonian(pxp,pxp_syms) Hz.site_ops[1] = np.array([[-1,0],[0,1]]) Hz.model = model Hz.model_coef = model_coef Hx = Hamiltonian(pxp,pxp_syms) Hx.site_ops[1] = np.array([[0,1],[1,0]]) Hx.model = np.array([[1]]) Hx.model_coef = np.array([-B]) k=[0] z=ref_state(np.max(pxp.basis_refs),pxp) Hz.gen(k) Hx.gen(k) H = H_operations.add(Hz,Hx,np.array([1,1])) H.sector.find_eig(k) overlap = eig_overlap(z,H,k).eval() plt.scatter(H.sector.eigvalues(k),overlap) plt.title(r"$H = -\sum_{i<j}^L \frac{J}{r_{ij}^\alpha} \sigma_i^z \sigma_{i+1}^z - B \sum_i \sigma_i^x$"+"\n"+r"$J=1$, $B=0.27$, $\alpha=2.3$, $k=0$, $N=$"+str(pxp.N)) plt.ylabel(r"$\log(\vert \langle 1111... \vert E \rangle \vert^2)$") plt.xlabel(r"$E$") plt.show()
#init system N = 20 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() # pxp_syms = model_sym_data(pxp,[translational_general(pxp,order=2),PT(pxp)]) pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=2), PT(pxp)]) z = zm_state(4, 1, pxp) k = pxp_syms.find_k_ref(z.ref) H = Hamiltonian(pxp, pxp_syms) H.site_ops[1] = np.array([[0, 1], [1, 0]]) H.model = np.array([[0, 1, 1, 1, 0]]) H.model_coef = np.array([1]) H.gen() # from Calculations import gen_krylov_basis # k=[0,0] # H.gen(k) # krylovBasis = gen_krylov_basis(H.sector.matrix(k),pxp.dim,z.sym_basis(k,pxp_syms)) # H_krylov = np.dot(np.conj(np.transpose(krylovBasis)),np.dot(H.sector.matrix(k),krylovBasis)) # e,u = np.linalg.eigh(H_krylov) # ls = level_stats(e) # print(np.shape(H_krylov)) # print(ls.mean()) # krylovBasis = dict() # for n in range(0,np.size(k,axis=0)): # krylovBasis[n] = gen_krylov_basis(H.sector.matrix(k[n]),pxp.dim,z.sym_basis(k[n],pxp_syms))
H = Hamiltonian(pxp, pxp_syms) H.site_ops[1] = np.array([[0, 1], [1, 0]]) H.site_ops[2] = np.array([[-1, 0], [0, 1]]) H.model = np.array([[0, 1, 0], [0, 1, 0, 2], [2, 0, 1, 0], [2, -1, 0, 1, 0], [0, 1, 0, -1, 2], [2, -1, -1, 0, 1, 0], [0, 1, 0, -1, -1, 2], [2, -1, -1, -1, 0, 1, 0], [0, 1, 0, -1, -1, -1, 2]]) H.model_coef = np.array([ 1, -pert_coef[0], -pert_coef[0], -pert_coef[1], -pert_coef[1], -pert_coef[2], -pert_coef[2], -pert_coef[3], -pert_coef[3] ]) # H.model = np.array([[0,1,0],[0,1,0,2],[2,0,1,0]]) # H.model_coef = np.array([1,-pert_coef[0],-pert_coef[0]]) H.gen() H.sector.find_eig() z = zm_state(2, 1, pxp) fidelity(z, H).plot(np.arange(0, 20, 0.01), z) plt.show() #find rescaling such that E1-E0 = 1 def gap(H, c): e, u = np.linalg.eigh(c * H) gap = e[1] - e[0] return np.abs(1 - gap) from scipy.optimize import minimize_scalar
pxp_syms = model_sym_data(pxp, [translational(pxp)]) H0 = Hamiltonian(pxp, pxp_syms) H0.site_ops[1] = np.array([[0, 1], [1, 0]]) H0.model = np.array([[0, 1, 0]]) H0.model_coef = np.array([1]) P = Hamiltonian(pxp, pxp_syms) P.site_ops[1] = np.array([[0, 1], [1, 0]]) P.site_ops[2] = np.array([[1, 0], [0, 0]]) P.site_ops[3] = np.array([[0, 0], [0, 1]]) P.model = np.array([[2, 1, 3], [3, 1, 2]]) P.model_coef = np.array([1, 1]) k = [0] H0.gen(k) P.gen(k) block_refs = pxp_syms.find_block_refs(k) block_keys = dict() for n in range(0, np.size(block_refs, axis=0)): block_keys[block_refs[n]] = n V_vals = np.arange(0.01, 3, 0.01) for count in range(0, np.size(V_vals, axis=0)): V = V_vals[count] H = H_operations.add(H0, P, np.array([V, 1])) H.sector.find_eig(k) neel = zm_state(2, 1, pxp, 1) pol = ref_state(0, pxp)
H.gen() H.sector.find_eig() z=zm_state(2,1,pxp) #krylov basis krylov_dim = pxp.N krylov_basis = gen_krylov_basis(H.sector.matrix(),krylov_dim,z.prod_basis(),pxp,orth="qr") #FSA basis # P+P on even sites pe = Hamiltonian(pxp,pxp_syms) pe.site_ops[1] = np.array([[0,1],[0,0]]) pe.model = np.array([[0,1,0],]) pe.model_coef = np.array([1]) pe.gen() #P-P on odd sites mo = Hamiltonian(pxp,pxp_syms) mo.site_ops[1] = np.array([[0,0],[1,0]]) mo.model = np.array([[0,1,0]]) mo.model_coef = np.array([1]) mo.gen() #Raising op # Hp = H_operations.add(pe,mo,np.array([1,1])) # Hp = Hp.sector.matrix() Hp = mo.sector.matrix() Hm = np.conj(np.transpose(Hp)) Hx = Hp + Hm
rc('text', usetex=True) # matplotlib.rcParams['figure.dpi'] = 400 N = 16 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational(pxp), parity(pxp)]) H0 = spin_Hamiltonian(pxp, "x", pxp_syms) H0.gen() Hpe = Hamiltonian(pxp, pxp_syms) Hpe.site_ops[1] = np.array([[0, 1], [0, 0]]) Hpe.model = np.array([[0, 1, 0]]) Hpe.model_coef = np.array([1]) Hpe.gen(parity=0) Hpo = Hamiltonian(pxp, pxp_syms) Hpo.site_ops[1] = np.array([[0, 1], [0, 0]]) Hpo.model = np.array([[0, 1, 0]]) Hpo.model_coef = np.array([1]) Hpo.gen(parity=1) Hme = Hamiltonian(pxp, pxp_syms) Hme.site_ops[1] = np.array([[0, 0], [1, 0]]) Hme.model = np.array([[0, 1, 0]]) Hme.model_coef = np.array([1]) Hme.gen(parity=0) Hmo = Hamiltonian(pxp, pxp_syms) Hmo.site_ops[1] = np.array([[0, 0], [1, 0]])
rc('text', usetex=True) # matplotlib.rcParams['figure.dpi'] = 400 N = 12 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational(pxp), parity(pxp)]) pert_coef = 0.051 H0 = spin_Hamiltonian(pxp, "x", pxp_syms) V = Hamiltonian(pxp, pxp_syms) V.site_ops[1] = np.array([[0, 1], [1, 0]]) V.site_ops[2] = np.array([[-1, 0], [0, 1]]) V.model = np.array([[2, 0, 1, 0], [0, 1, 0, 2]]) V.model_coef = np.array([1, 1]) V.gen() H0.gen() H = H_operations.add(H0, V, np.array([1, -pert_coef])) #find rescaling such that E1-E0 = 1 def gap(H, c): e, u = np.linalg.eigh(c * H) gap = e[1] - e[0] # print(gap,c) return gap from scipy.optimize import minimize_scalar res = minimize_scalar(lambda c: np.abs(gap(H.sector.matrix(), c) - 1), method="golden",
pxp.gen_basis() pxp_syms = model_sym_data(pxp,[translational(pxp)]) H = Hamiltonian(pxp,pxp_syms) H.site_ops[1] = np.array([[0,1],[1,0]]) # H.model = np.array([[0,1,0],[0,1,1,1,0]]) H.model = np.array([[0,1,0],[0,0,1,0],[0,1,0,0]]) # H.model_coef = np.array([1,0.122959959]) a=0.108 H.model_coef = np.array([1,a,a]) z=zm_state(2,1,pxp) k=pxp_syms.find_k_ref(z.ref) for n in range(0,np.size(k,axis=0)): H.gen(k[n]) H.sector.find_eig(k[n]) eig_overlap(z,H,k[n]).plot() plt.title(r"$H=PXP + \lambda PXXXP$, N="+str(pxp.N)) plt.show() t=np.arange(0,20,0.001) f0 = fidelity(z,H,"use sym").eval(t,z) for n in range(0,np.size(f0,axis=0)): if f0[n] < 0.1: cut = n break max_index = np.argmax(f0[cut:]) print(t[cut:][max_index]) # plt.plot(t,f0)
#init system N=8 pxp = unlocking_System([0,1],"periodic",2,N) pxp.gen_basis() pxp_syms = model_sym_data(pxp,[translational(pxp)]) Hp = Hamiltonian(pxp,pxp_syms) Hp.site_ops[1] = np.array([[0,0],[1,0]]) Hp.site_ops[2] = np.array([[0,1],[0,0]]) Hp.model = np.array([[1,2],[2,1]]) Hp.model_coef = np.array([1,1]) Hp.uc_size = np.array([2,2]) Hp.uc_pos = np.array([0,1]) Hp.gen() Hm = Hp.herm_conj() Hz = 1/2 * com(Hp.sector.matrix(),Hm.sector.matrix()) lie_algebra_num = com(Hz,Hp.sector.matrix()) Hz_an = Hamiltonian(pxp,pxp_syms) Hz_an.site_ops[1] = np.array([[0,0],[1,0]]) Hz_an.site_ops[2] = np.array([[0,1],[0,0]]) Hz_an.site_ops[3] = np.array([[-1/2,0],[0,1/2]]) Hz_an.site_ops[4] = np.array([[0,0],[0,1]]) Hz_an.model = np.array([[0,4],[4,0],[0,4],[4,0],[1,3,2],[2,3,1],[1,3,2],[2,3,1]]) Hz_an.model_coef = np.array([1/2,1/2,-1/2,-1/2,1,1,-1,-1]) Hz_an.uc_size = np.array([2,2,2,2,2,2,2,2]) Hz_an.uc_pos = np.array([1,0,0,1,1,1,0,0]) Hz_an.gen()
y = 1 / 2j * (Jp - Jm) z = 1 / 2 * com(Jp, Jm) z2 = np.dot(z, z) #create Hamiltonian J = 1 h = 0.1 D = 0.1 H = Hamiltonian(pxp) H.site_ops[1] = x H.site_ops[2] = y H.site_ops[3] = z H.site_ops[4] = z2 H.model = np.array([[1, 1], [2, 2], [3], [4]]) H.model_coef = np.array([J, J, h, D]) H.gen() Hp = np.zeros((pxp.dim, pxp.dim)) for n in range(0, np.size(pxp.basis, axis=0)): bits = np.copy(pxp.basis[n]) for m in range(0, pxp.N): if bits[m] == 2: new_bits = np.copy(bits) new_bits[m] = 0 new_ref = bin_to_int_base_m(new_bits, pxp.base) Hp[pxp.keys[new_ref], n] += 2 * (-1)**m Hm = np.conj(np.transpose(Hp)) Hx = 1 / 2 * (Hp + Hm) #scarred eigenstates psi = ref_state(0, pxp).prod_basis()
rc('text', usetex=True) # matplotlib.rcParams['figure.dpi'] = 400 N = 14 pxp = unlocking_System([0],"periodic",2,N) pxp.gen_basis() pxp_syms=model_sym_data(pxp,[translational(pxp),parity(pxp)]) H0=spin_Hamiltonian(pxp,"x",pxp_syms) H0.gen() Hp0 = Hamiltonian(pxp,pxp_syms) Hp0.site_ops[1] = np.array([[0,1],[0,0]]) Hp0.model = np.array([[1]]) Hp0.model_coef = np.array([1]) Hp0.gen() Hp1 = Hamiltonian(pxp,pxp_syms) Hp1.site_ops[1] = np.array([[0,1],[0,0]]) Hp1.site_ops[2] = np.array([[0,0],[1,0]]) Hp1.model = np.array([[0,1,2,1,0]]) Hp1.model_coef = np.array([1]) Hp1.gen() Hm0 = Hamiltonian(pxp,pxp_syms) Hm0.site_ops[1] = np.array([[0,0],[1,0]]) Hm0.model = np.array([[1]]) Hm0.model_coef = np.array([1]) Hm0.gen() Hm1 = Hamiltonian(pxp,pxp_syms)
Neel_state_spin_basis = np.zeros(np.size(pxp.basis_refs)) Neel_state_spin_basis[pxp.keys[z.ref]] = 1 Neel_state_clock_basis = np.dot(spin2clock_u, Neel_state_spin_basis) z = zm_state(2, 1, pxp) Neel_state_clock_basis = np.zeros(np.size(pxp.basis_refs)) Neel_state_clock_basis[pxp.keys[z.ref]] = 1 Neel_state_spin_basis = np.dot(clock2spin_u, Neel_state_clock_basis) print(Neel_state_spin_basis) H = Hamiltonian(pxp, pxp_syms) H.site_ops[2] = P_spin_clock_basis H.site_ops[1] = H1.site_ops[1] H.model = np.array(([[2, 1, 2]])) H.model_coef = np.array((1)) H.gen() H.sector.find_eig() print(H.sector.eigvalues()) # eig_overlap.plot(z.bits,H) # plt.show() # fidelity.plot(z.bits,np.arange(0,20,0.01),H) # plt.show() H_clock = Hamiltonian(pxp, pxp_syms) H_clock.site_ops[2] = P H_clock.site_ops[1] = H2.site_ops[1] H_clock.model = np.array([[2, 1, 2]]) H_clock.model_coef = np.array((1)) # H_clock = clock_Hamiltonian(pxp,pxp_syms) H_clock.gen()
N = 15 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=3), PT(pxp)]) z = zm_state(3, 1, pxp) k = pxp_syms.find_k_ref(z.ref) V1 = Hamiltonian(pxp, pxp_syms) V1.site_ops[1] = np.array([[0, 1], [1, 0]]) V1.model = np.array([[0, 1, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 1, 0]]) V1.model_coef = np.array([1, 1, 1, 1]) V1.uc_size = np.array([3, 3, 3, 3]) V1.uc_pos = np.array([1, 2, 2, 1]) for n in range(0, np.size(k, axis=0)): V1.gen(k_vec=k[n]) V2 = Hamiltonian(pxp, pxp_syms) V2.site_ops[1] = np.array([[0, 1], [1, 0]]) V2.model = np.array([[0, 0, 1, 0], [0, 1, 0, 0]]) V2.model_coef = np.array([1, 1]) V2.uc_size = np.array([3, 3]) V2.uc_pos = np.array([0, 0]) for n in range(0, np.size(k, axis=0)): V2.gen(k_vec=k[n]) V3 = Hamiltonian(pxp, pxp_syms) V3.site_ops[1] = np.array([[0, 1], [1, 0]]) V3.model = np.array([[0, 1, 1, 1, 0], [0, 1, 1, 1, 0]]) V3.model_coef = np.array([1, 1]) V3.uc_size = np.array([3, 3])
# print("\n") # root_refs = find_root_refs(np.array([1,4]),np.array([2,4]),H,sector_refs,from_sector,pxp) # basis = np.hstack((basis,subcube_basis(root_refs,"Right",6))) # print("\n") # root_refs = find_root_refs(np.array([3,0]),np.array([3,3]),H,sector_refs,from_sector,pxp) # basis = np.hstack((basis,subcube_basis(root_refs,"Left",6))) # include Neel fsa (orig) #fsa Hamiltonian, H= H+ + H- Hp1 = Hamiltonian(pxp) Hp1.site_ops[1] = np.array([[0, 1], [0, 0]]) Hp1.model = np.array([[1]]) Hp1.model_coef = np.array([1]) Hp1.gen(parity=0) Hp2 = Hamiltonian(pxp) Hp2.site_ops[1] = np.array([[0, 0], [1, 0]]) Hp2.model = np.array([[1]]) Hp2.model_coef = np.array([1]) Hp2.gen(parity=1) Hm = Hp1.sector.matrix() + Hp2.sector.matrix() Hp = np.conj(np.transpose(Hm)) #fsa basis from Neel z = zm_state(2, 1, pxp) fsa_basis = z.prod_basis() current_state = fsa_basis fsa_dim = pxp.N for n in range(0, fsa_dim): new_state = np.dot(Hp, current_state)
H.sector.find_eig() z=zm_state(2,1,pxp) #krylov basis krylov_dim = 2*pxp.N krylov_basis = gen_krylov_basis(H.sector.matrix(),krylov_dim,z.prod_basis(),pxp,orth="qr") #FSA basis # P+P on even sites pe = Hamiltonian(pxp,pxp_syms) # pe.site_ops[1] = np.array([[0,1],[0,0]]) pe.site_ops[1] = np.array([[0,1j,0],[0,0,1j],[1j,0,0]]) pe.model = np.array([[0,1,0]]) pe.model_coef = np.array([1]) pe.gen(parity=1) #P-P on odd sites mo = Hamiltonian(pxp,pxp_syms) # mo.site_ops[1] = np.array([[0,0],[1,0]]) mo.site_ops[1] = np.array([[0,0,-1j],[-1j,0,0],[0,-1j,0]]) mo.model = np.array([[0,1,0]]) mo.model_coef = np.array([1]) mo.gen(parity=0) #Raising op Hp = H_operations.add(pe,mo,np.array([1,1])) Hp = Hp.sector.matrix() Hm = np.conj(np.transpose(Hp)) fsa_basis = z.prod_basis() current_state = fsa_basis for n in range(0,krylov_dim): next_state = np.dot(Hm,current_state)
# Im.gen() # Kp.gen() # Km.gen() # Lp.gen() # Lm.gen() # Ip_pert.gen() # Im_pert.gen() # Kp_pert.gen() # Km_pert.gen() # Lp_pert.gen() # Lm_pert.gen() z = zm_state(2, 1, pxp) # k=pxp_syms.find_k_ref(z.ref) k = [0, 0] Ip.gen(k) Im.gen(k) Kp.gen(k) Km.gen(k) Lp.gen(k) Lm.gen(k) Ip_pert.gen(k) Im_pert.gen(k) Kp_pert.gen(k) Km_pert.gen(k) Lp_pert.gen(k) Lm_pert.gen(k) coef = 0 # coef = -0.0827840215 Ip_total = H_operations.add(Ip, Ip_pert, np.array([1, coef]))
z = zm_state(2, 1, pxp) # z=zm_state(3,1,pxp) # z=ref_state(1,pxp) hamming_sectors = find_hamming_sectors(z.bits) hamming_length = 0 for n in range(0, len(hamming_sectors)): if np.size(hamming_sectors[n]) != 0: hamming_length = hamming_length + 1 # H=spin_Hamiltonian(pxp,"x") # H.gen() V = Hamiltonian(pxp) V.site_ops[1] = np.array([[0, 0], [0, 1]]) V.model = np.array([[1, 1]]) V.model_coef = np.array([1]) V.gen() removed_count = np.zeros(len(hamming_sectors)) for n in range(0, len(hamming_sectors)): c = 0 for m in range(0, np.size(hamming_sectors[n], axis=0)): ref = hamming_sectors[n][m] index = pxp.keys[ref] if V.sector.matrix()[index, index] != 0: c = c + 1 # c=c+V.sector.matrix()[index,index] removed_count[n] = c plt.plot(removed_count) plt.show()
import scipy as sp import math from Calculations import plot_adjacency_graph N = 12 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational(pxp)]) H = Hamiltonian(pxp, pxp_syms) H.site_ops[1] = np.array([[0, 0], [1, 0]]) H.site_ops[2] = np.array([[0, 1], [0, 0]]) H.model = np.array([[0, 1, 2, 0], [0, 2, 1, 0]]) H.model_coef = np.array([1, 1]) k = [0] H.gen(k) # H.gen() # H0=spin_Hamiltonian(pxp,"x",pxp_syms) # H0.gen(k) # # H = H_operations.add(H0,H,np.array([1,1/2])) # H = H_operations.add(H0,H,np.array([1,1])) # all states # basis_labels = dict() # for n in range(0,np.size(pxp.basis,axis=0)): # basis_labels[n] = pxp.basis[n] # plot_adjacency_graph(np.abs(H.sector.matrix()),labels=basis_labels) # # plt.title(r"$P^0 X P^1 + P^1 X P^0$, N="+str(pxp.N)) # # plt.title(r"$P^0 X P^1$, N="+str(pxp.N)) # plt.show()
rydberg_subspace[pxp.keys[pxp_half.basis_refs[n]], n] = 1 #pauli ops X = Hamiltonian(pxp, pxp_syms) Y = Hamiltonian(pxp, pxp_syms) Z = Hamiltonian(pxp, pxp_syms) X.site_ops[1] = np.array([[0, 1], [1, 0]]) Y.site_ops[1] = np.array([[0, -1j], [1j, 0]]) Z.site_ops[1] = np.array([[-1, 0], [0, 1]]) X.model, X.model_coef = np.array([[1]]), np.array((1)) Y.model, Y.model_coef = np.array([[1]]), np.array((1)) Z.model, Z.model_coef = np.array([[1]]), np.array((1)) X.gen() Y.gen() Z.gen() #n_i n_i+1 H0 = Hamiltonian(pxp, pxp_syms) H0.site_ops[1] = np.array([[0, 0], [0, 1]]) H0.model = np.array([[1, 1]]) H0.model_coef = np.array((1)) #X_n H_kick = Hamiltonian(pxp, pxp_syms) H_kick.site_ops[1] = np.array([[0, 1], [1, 0]]) H_kick.model = np.array([[1]]) H_kick.model_coef = np.array((1))