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)
def var(Q, psi): Q2 = np.dot(Q, Q) return exp(Q2, psi) - exp(Q, psi)**2 N = 10 pxp = unlocking_System([0], "periodic", 3, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=2), PT(pxp)]) #orig H Ip = Hamiltonian(pxp, pxp_syms) Ip.site_ops[1] = np.array([[0, 1, 0], [0, 0, 0], [0, 0, 0]]) Ip.site_ops[2] = np.array([[0, 0, 0], [1, 0, 0], [0, 0, 0]]) Ip.model = np.array([[0, 1, 0], [0, 2, 0]]) Ip.model_coef = np.array([1, -1]) Ip.uc_size = np.array([2, 2]) Ip.uc_pos = np.array([1, 0]) Im = Hamiltonian(pxp, pxp_syms) Im.site_ops[1] = np.array([[0, 1, 0], [0, 0, 0], [0, 0, 0]]) Im.site_ops[2] = np.array([[0, 0, 0], [1, 0, 0], [0, 0, 0]]) Im.model = np.array([[0, 2, 0], [0, 1, 0]]) Im.model_coef = np.array([1, -1]) Im.uc_size = np.array([2, 2]) Im.uc_pos = np.array([1, 0]) Kp = Hamiltonian(pxp, pxp_syms) Kp.site_ops[1] = np.array([[0, 0, 1], [0, 0, 0], [0, 0, 0]]) Kp.site_ops[2] = np.array([[0, 0, 0], [0, 0, 0], [1, 0, 0]]) Kp.model = np.array([[0, 1, 0], [0, 2, 0]])
## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) 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)]) Hp = dict() Hp[0] = Hamiltonian(pxp) Hp[0].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[0].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[0].model = np.array([[0, 1, 0], [0, 2, 0]]) Hp[0].model_coef = np.array([1, 1]) Hp[0].uc_size = np.array([2, 2]) Hp[0].uc_pos = np.array([1, 0]) #1st order pert Hp[1] = Hamiltonian(pxp) Hp[1].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[1].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[1].model = np.array([[0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 2, 0], [0, 2, 0, 0]]) Hp[1].model_coef = np.array([1, 1, 1, 1]) Hp[1].uc_size = np.array([2, 2, 2, 2]) Hp[1].uc_pos = np.array([0, 1, 1, 0]) #2nd order perts Hp[2] = Hamiltonian(pxp)
def var(Q, psi): Q2 = np.dot(Q, Q) return exp(Q2, psi) - exp(Q, psi)**2 N = 14 pxp = unlocking_System([0, 1], "periodic", 2, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational(pxp)]) Hp = dict() Hp[0] = Hamiltonian(pxp, pxp_syms) Hp[0].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[0].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[0].model = np.array([[0, 1, 2, 0]]) Hp[0].model_coef = np.array([1]) Hp[1] = Hamiltonian(pxp, pxp_syms) Hp[1].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[1].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[1].model = np.array([[0, 1, 2, 0, 0], [0, 0, 1, 2, 0]]) Hp[1].model_coef = np.array([1, 1]) Hp[2] = Hamiltonian(pxp, pxp_syms) Hp[2].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[2].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[2].site_ops[4] = np.array([[0, 0], [0, 1]]) Hp[2].model = np.array([[0, 4, 0, 1, 2, 0], [0, 1, 2, 0, 4, 0]]) Hp[2].model_coef = np.array([1, 1]) psi = bin_state(np.array([0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0]), pxp)
x = 1 / 2 * (Jp + Jm) 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
for n in range(0, np.size(k, axis=0)): U[int(k[n])] = pxp_syms.basis_transformation(k[n]) wf = np.load("./z3,entangled_MPS_coef," + str(pxp.N) + ".npy") #project wf to symmetry basis wf_sym = dict() for n in range(0, np.size(k, axis=0)): wf_sym[int(k[n])] = np.dot(np.conj(np.transpose(U[int(k[n])])), wf) # dynamics + fidelity V1_ops = dict() V1_ops[0] = Hamiltonian(pxp, pxp_syms) V1_ops[0].site_ops[1] = np.array([[0, 1], [1, 0]]) V1_ops[0].model = np.array([[0, 1, 0, 0]]) V1_ops[0].model_coef = np.array([1]) for n in range(0, np.size(k)): V1_ops[0].gen(k_vec=k[n], uc_size=3, uc_pos=1) V1_ops[1] = Hamiltonian(pxp, pxp_syms) V1_ops[1].site_ops[1] = np.array([[0, 1], [1, 0]]) V1_ops[1].model = np.array([[0, 0, 1, 0]]) V1_ops[1].model_coef = np.array([1]) for n in range(0, np.size(k)): V1_ops[1].gen(k_vec=k[n], uc_size=3, uc_pos=2) V1_ops[2] = Hamiltonian(pxp, pxp_syms) V1_ops[2].site_ops[1] = np.array([[0, 1], [1, 0]]) V1_ops[2].model = np.array([[0, 1, 0, 0]]) V1_ops[2].model_coef = np.array([1]) for n in range(0, np.size(k)):
#rc('font',**{'family':'serif','serif':['Palatino']}) 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)]) 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:
#rc('font',**{'family':'serif','serif':['Palatino']}) rc('text', usetex=True) # matplotlib.rcParams['figure.dpi'] = 400 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)
#rc('font',**{'family':'serif','serif':['Palatino']}) 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()
rc('text', usetex=True) # matplotlib.rcParams['figure.dpi'] = 400 def com(a,b): return np.dot(a,b)-np.dot(b,a) #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]])
#rc('font',**{'family':'serif','serif':['Palatino']}) 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),
#create Hamiltonian model =[] model_coef = [] for n in range(2,N+1): temp = -np.ones(n) temp[0] = 1 temp[np.size(temp,axis=0)-1] = 1 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)
#rc('font',**{'family':'serif','serif':['Palatino']}) 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)
count = 0 pxp_config = model_space.basis[indices[0][index_row_loc[count]]] pxxxp_config = model_space.basis[indices[1][index_row_loc[count]]] print(pxp_config, pxxxp_config) # print(index_spacing_error[count]) # print(index_var_error[count]) Hp = gen_Hp(pxp_config, pxxxp_config) Hm = np.conj(np.transpose(Hp)) 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())
return exp(Q2, psi) - exp(Q, psi)**2 #init system N = 14 pxp = unlocking_System([0], "periodic", 3, N) pxp.gen_basis() pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=2), PT(pxp)]) #orig H Ip = dict() Ip[0] = Hamiltonian(pxp, pxp_syms) Ip[0].site_ops[1] = np.array([[0, 1, 0], [0, 0, 0], [0, 0, 0]]) Ip[0].site_ops[2] = np.array([[0, 0, 0], [1, 0, 0], [0, 0, 0]]) Ip[0].model = np.array([[0, 1, 0], [0, 2, 0]]) Ip[0].model_coef = np.array([1, -1]) Ip[0].uc_size = np.array([2, 2]) Ip[0].uc_pos = np.array([1, 0]) Ip[1] = Hamiltonian(pxp, pxp_syms) Ip[1].site_ops[1] = np.array([[0, 1, 0], [0, 0, 0], [0, 0, 0]]) Ip[1].site_ops[2] = np.array([[0, 0, 0], [1, 0, 0], [0, 0, 0]]) Ip[1].model = np.array([[0, 2, 0, 0], [0, 0, 2, 0], [0, 1, 0, 0], [0, 0, 1, 0]]) Ip[1].model_coef = np.array([1, 1, -1, -1]) Ip[1].uc_size = np.array([2, 2, 2, 2]) Ip[1].uc_pos = np.array([0, 1, 1, 0]) Ip[2] = Hamiltonian(pxp, pxp_syms) Ip[2].site_ops[1] = np.array([[0, 1, 0], [0, 0, 0], [0, 0, 0]]) Ip[2].site_ops[2] = np.array([[0, 0, 0], [1, 0, 0], [0, 0, 0]])
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, 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)
pxp_syms = model_sym_data(pxp, [translational(pxp), parity(pxp)]) # J = -1 # hx = 0.05 # hz = -0.5 J = 1 hx = 1 hz = 1 Hp = dict() Hp[0] = Hamiltonian(pxp, pxp_syms) Hp[0].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[0].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[0].site_ops[3] = np.array([[-1 / 2, 0], [0, 1 / 2]]) Hp[0].model = np.array([[1, 1], [2, 2], [1, 2], [2, 1], [1], [2], [3]]) Hp[0].model_coef = np.array( [J / 4, J / 4, J / 4, J / 4, hx / 2, hx / 2, hz / 2]) Hp[0].uc_size = np.array([2, 2, 2, 2, 2, 2, 1]) Hp[0].uc_pos = np.array([0, 1, 0, 1, 0, 1, 0]) Hp[1] = Hamiltonian(pxp, pxp_syms) Hp[1].site_ops[1] = np.array([[0, 0], [1, 0]]) Hp[1].site_ops[2] = np.array([[0, 1], [0, 0]]) Hp[1].site_ops[3] = np.array([[-1 / 2, 0], [0, 1 / 2]]) Hp[1].site_ops[4] = np.array([[0, 0], [0, 1]]) Hp[1].model = np.array([[2, 2, 4], [2, 2, 0], [1, 1, 0], [1, 1, 4]]) Hp[1].model_coef = np.array([1, 1, 1, 1]) Hp[1].uc_size = np.array([2, 2, 2, 2]) Hp[1].uc_pos = np.array([1, 1, 0, 0]) Hp[2] = Hamiltonian(pxp, pxp_syms) Hp[2].site_ops[1] = np.array([[0, 0], [1, 0]])
to_keep = np.zeros(pxp.dim) decomp_ref = [] pbar = ProgressBar() for n in pbar(range(0, np.size(decompBasis.basis, axis=0))): 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(decompBasis.basis[n], axis=0)): if decompBasis.basis[n][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() Hm = Hp.herm_conj() Hz = 1 / 2 * com(Hp.sector.matrix(), Hm.sector.matrix()) Hx = 1 / 2 * (Hp.sector.matrix() + Hm.sector.matrix()) Hy = 1 / 2j * (Hp.sector.matrix() - Hm.sector.matrix()) C = np.dot(Hx, Hx) + np.dot(Hy, Hy) + np.dot(Hz, Hz) ec, uc = np.linalg.eigh(C) for m in range(0, np.size(ec, axis=0)): if np.abs(var(Hz, uc[:, 0])) < 1e-5: to_keep = np.vstack((to_keep, uc[:, m]))
from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Computer Modern'],'size':26}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) 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)]) #create Hamiltonian a=0.1229 H = Hamiltonian(pxp,pxp_syms) H.site_ops[1] = np.array([[0,1],[1,0]]) H.model = np.array([[1],[0,1,1,1,0]]) H.model_coef = np.array([0,1]) 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.show() fidelity(z,H,"use sym").plot(np.arange(0,20,0.01),z) plt.show()
z = zm_state(2, 1, pxp) 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)
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()
# basis = np.hstack((basis,subcube_basis(root_refs,"Left",6))) # 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):
rc('text', usetex=True) # matplotlib.rcParams['figure.dpi'] = 400 N = 10 J = 1 hx = 1 hz = 1 #init system system = unlocking_System([0, 1], "periodic", 2, N) system.gen_basis() system_syms = model_sym_data(system, [translational(system)]) #create Hamiltonian H = Hamiltonian(system, system_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([[1, 1], [2], [1]]) H.model_coef = np.array([J, hz, hx]) #dynamics following quench from |00000> psi = ref_state(0, system) k = system_syms.find_k_ref(psi.ref) for n in range(0, np.size(k, axis=0)): H.gen(k[n]) H.sector.find_eig(k[n]) print(H.sector.eigvalues(k[n])) eig_overlap(psi, H, k[n]).plot() plt.show() fidelity(psi, H, "use sym").plot(np.arange(0, 20, 0.01), psi) plt.show()
def com(a, b): return np.dot(a, b) - np.dot(b, a) #init system N = 21 pxp = unlocking_System([0], "periodic", 2, N) pxp.gen_basis() 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]))
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)) H0.gen() H_kick.gen() H0.sector.find_eig() H_kick.sector.find_eig() # for tau in range c = 0 pbar = ProgressBar()
import numpy as np 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))
Q2 = np.dot(Q,Q) return exp(Q2,psi)-exp(Q,psi)**2 #init system N=16 pxp = unlocking_System([0],"periodic",2,N) pxp.gen_basis() pxp_syms = model_sym_data(pxp,[translational_general(pxp,order=4)]) # pxp_syms = model_sym_data(pxp,[translational(pxp)]) Hp = dict() Hp[0] = Hamiltonian(pxp,pxp_syms) Hp[0].site_ops[1] = np.array([[0,0],[1,0]]) Hp[0].site_ops[2] = np.array([[0,1],[0,0]]) Hp[0].model = np.array([[0,2,0],[0,1,0],[0,1,0],[0,1,0]]) Hp[0].model_coef = np.array([1,1,1,1]) Hp[0].uc_size = np.array([4,4,4,4]) Hp[0].uc_pos = np.array([3,0,1,2]) # Hp[1] = Hamiltonian(pxp,pxp_syms) # Hp[1].site_ops[1] = np.array([[0,0],[1,0]]) # Hp[1].site_ops[2] = np.array([[0,1],[0,0]]) # Hp[1].model = np.array([[0,1,2,1,0]]) # Hp[1].model_coef = np.array([1]) # Hp[1].uc_size = np.array([4]) # Hp[1].uc_pos = np.array([0]) # Hp[2] = Hamiltonian(pxp,pxp_syms) # Hp[2].site_ops[1] = np.array([[0,0],[1,0]]) # Hp[2].site_ops[2] = np.array([[0,1],[0,0]]) # Hp[2].model = np.array([[0,2,1,2,0],[0,2,1,2,0]])