Beispiel #1
0
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)
Beispiel #2
0
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()
Lm_total = H_operations.add(Lm, Lm_pert, np.array([1, coef]))

H = H_operations.add(Ip_total, Im_total, np.array([1j, -1j]))
H = H_operations.add(H, Kp_total, np.array([1, -1j]))
H = H_operations.add(H, Km_total, np.array([1, 1j]))
H = H_operations.add(H, Lp_total, np.array([1, 1j]))
H = H_operations.add(H, Lm_total, np.array([1, -1j]))

H.sector.find_eig(k)
exact_energy = H.sector.eigvalues(k)
exact_overlap = eig_overlap(z, H, k).eval()

plt.scatter(exact_energy, exact_overlap)
plt.show()
t = np.arange(0, 20, 0.01)
f = fidelity(z, H, "use sym").eval(t, z)
plt.plot(t, f)
plt.show()

#su3 rep
#0th order rep (no perts)
root3 = np.power(3, 0.5)
I3 = 1 / 2 * com(Ip.sector.matrix(k), Im.sector.matrix(k))
g8 = 1 / (2 * root3) * (com(Kp.sector.matrix(k), Km.sector.matrix(k)) +
                        com(Lp.sector.matrix(k), Lm.sector.matrix(k)))


def exp(Q, psi):
    return np.real(np.vdot(psi, np.dot(Q, psi)))

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)
k = pxp_syms.find_k_ref(psi.ref)

for n in range(0, len(Hp)):
    for m in range(0, np.size(k, axis=0)):
        Hp[n].gen(k[m])

coef = np.load("./data/xy,pert_coef,10.npy")
Hp_total = deepcopy(Hp[0])
for n in range(1, len(Hp)):
    Hp_total = H_operations.add(Hp_total, Hp[n], np.array([1, coef[n - 1]]))

Hp = Hp_total
Hm = Hp_total.herm_conj()

H = H_operations.add(Hp, Hm, np.array([1, 1]))
for m in range(0, np.size(k, axis=0)):
    H.sector.find_eig(k[m])
    eig_overlap(psi, H, k[m]).plot()
plt.show()
fidelity(psi, H, "use sym").plot(np.arange(0, 20, 0.01), psi)
plt.show()
# for m in range(0,np.size(k,axis=0)):
    # Hp[0].gen(k[m])

coef = np.load("./pxxxp,1stOrder,coef,12.npy")
# coef = np.zeros(len(Hp)-1)
Hp_total = deepcopy(Hp[0])
for n in range(1,len(Hp)):
    Hp_total = H_operations.add(Hp_total,Hp[n],np.array([1,coef[n-1]]))
Hm = Hp_total.herm_conj()

H = H_operations.add(Hp_total,Hm,np.array([1,1]))
H.sector.find_eig(k[0])
eig_overlap(z,H,k[0]).plot(tol=-15)
plt.show()
fidelity(z,H,"use sym").plot(np.arange(0,20,0.01),z)
plt.show()

from Calculations import gen_fsa_basis
fsa_basis = gen_fsa_basis(Hp_total.sector.matrix(k[0]),z.sym_basis(k[0],pxp_syms),int(2*pxp.N/4))
H_fsa = np.dot(np.conj(np.transpose(fsa_basis)),np.dot(H.sector.matrix(k[0]),fsa_basis))
e,u = np.linalg.eigh(H_fsa)
overlap_fsa = np.log10(np.abs(u[0,:])**2)

exact_overlap = eig_overlap(z,H,k[0]).eval()
plt.scatter(H.sector.eigvalues(k[0]),exact_overlap)
plt.scatter(e,overlap_fsa,marker="x",color="red",s=100)
plt.show()
t=np.arange(0,20,0.01)
f = fidelity(z,H,"use sym").eval(t,z)
plt.plot(t,f)
Beispiel #6
0
to_del = []
for n in range(0, np.size(overlap, axis=0)):
    if overlap[n] < -10:
        to_del = np.append(to_del, n)
for n in range(np.size(to_del, axis=0) - 1, -1, -1):
    overlap = np.delete(overlap, to_del[n])
    eigenvalues = np.delete(eigenvalues, to_del[n])

plt.scatter(eigenvalues, overlap)
plt.xlabel(r"$E$")
plt.ylabel(r"$\log(\vert \langle \psi \vert E \rangle \vert^2)$")
plt.title(r"PXP, Eigenstate overlap with K=3 Entangled MPS, N=18")
plt.show()

t = np.arange(0, 20, 0.01)
f = np.zeros(np.size(t))
for n in range(0, np.size(t, axis=0)):
    evolved_state = time_evolve_state(psi_energy, e, t[n])
    f[n] = np.abs(np.vdot(evolved_state, psi_energy))**2
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle \psi(t) \vert \psi(0) \rangle \vert^2$")
plt.title(r"PXP, K=3 Entangled MPS Fidelity, N=18")
plt.title(r"$PXP+\lambda_i V_i, K=3$ Entangled MPS Fidelity, N=" + str(pxp.N))
plt.plot(t, f, label="K=3 Entangled MPS")

z3 = zm_state(3, 1, pxp)
f = fidelity(z3, H, "use syms").eval(t, z3)
plt.plot(t, f, label="Z3")
plt.legend()
plt.show()
Beispiel #7
0
H.model = np.array([[0,1,1,1,0]])
H.model_coef = np.array([1])

z=zm_state(4,1,pxp)
z1=zm_state(4,1,pxp,1)
z2=zm_state(4,1,pxp,2)
z3=zm_state(4,1,pxp,3)

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()

t=np.arange(0,20,0.01)
f0 = fidelity(z,H,"use sym").eval(t,z)
f1 = fidelity(z,H,"use sym").eval(t,z1)
f2 = fidelity(z,H,"use sym").eval(t,z2)
f3 = fidelity(z,H,"use sym").eval(t,z3)

plt.plot(t,f0,label=r"$\vert 10001000...\rangle$")
plt.plot(t,f1,label=r"$\vert 01000100...\rangle$")
plt.plot(t,f2,label=r"$\vert 00100010...\rangle$")
plt.plot(t,f3,label=r"$\vert 00010001...\rangle$")
plt.legend()
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle \phi \vert e^{-iHt} \vert \psi(0) \rangle \vert^2$")
plt.title(r"$H=PXXXP$, N="+str(pxp.N))
plt.show()
fsa_basis = z.prod_basis()
current_state = fsa_basis
for n in range(0, pxp.N):
    new_state = np.dot(Hp.sector.matrix(), current_state)
    new_state = new_state / np.power(np.vdot(new_state, new_state), 0.5)
    fsa_basis = np.vstack((fsa_basis, new_state))
    current_state = new_state

fsa_basis = np.transpose(fsa_basis)
H_fsa = np.dot(np.conj(np.transpose(fsa_basis)),
               np.dot(H0.sector.matrix(), fsa_basis))
e_fsa, u_fsa = np.linalg.eigh(H_fsa)

H0.sector.find_eig()
t = np.arange(0, 35, 0.01)
f_exact = fidelity(z, H0).eval(t, z)

f_fsa = np.zeros(np.size(t))
z_energy_fsa = np.conj(u_fsa[0, :])

for n in range(0, np.size(t, axis=0)):
    evolved_state = time_evolve_state(z_energy_fsa, e_fsa, t[n])
    f_fsa[n] = np.abs(np.vdot(evolved_state, z_energy_fsa))
plt.plot(t, f_exact, label="Exact Evolution")
plt.plot(t, f_fsa, label="FSA Projected Evolution")
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle \psi(0) \vert \psi(t) \rangle \vert^2$")
plt.legend()
plt.title(r"$PXP$ Projected time evolution, N=" + str(pxp.N))
plt.show()
Beispiel #9
0
    return np.abs(t0_ham-t0_floquet)

from scipy.optimize import minimize_scalar,minimize
# res = minimize_scalar(lambda alpha: cost(alpha),method="golden",bracket=(0.001,0.005))
res = minimize(lambda alpha: cost(alpha),method="powell",x0=V/tau)
print(res)

alpha=res.x
H=Hamiltonian(pxp,"x")
H.site_ops[1] = np.array([[0,alpha],[alpha,0]])
H.model = np.array([[0,1,0]])
H.model_coef=np.array((1))
H.gen()
H.sector.find_eig()
z_rydberg = zm_state(2,1,pxp)
f_neel_ham = fidelity(z_rydberg,H).eval(t,z_rydberg)
# plt.plot(t,f_neel_ham)
# plt.show()

H_diag = np.diag(np.exp(-1j*tau*H.sector.eigvalues()))
exp_H = np.dot(H.sector.eigvectors(),np.dot(np.diag(np.exp(-1j*tau*H.sector.eigvalues())),np.conj(np.transpose(H.sector.eigvectors()))))

#evaluate direct overlap of all states
states=dict()
for n in range(0,np.size(pxp_half.basis_refs,axis=0)):
    states[n] = ref_state(pxp_half.basis_refs[n],pxp)


pbar=ProgressBar()
f_ham=dict()
f_floquet=dict()
                                    100,
                                    e_diff=0.5)
#check identified right states
plt.scatter(exact_energy, exact_overlap)
for n in range(0, np.size(scar_indices, axis=0)):
    plt.scatter(exact_energy[scar_indices[n]],
                exact_overlap[scar_indices[n]],
                marker="D",
                color="green",
                alpha=0.5,
                s=100)
plt.show()

#fidelity
t = np.arange(0, 20, 0.01)
f = fidelity(z, H).eval(t, z)
plt.plot(t, f)
plt.show()

#entropy
ent_vals = np.zeros(pxp.dim)
ent = entropy(pxp)
pbar = ProgressBar()
for n in pbar(range(0, np.size(ent_vals, axis=0))):
    ent_vals[n] = ent.eval(H.sector.eigvectors()[:, n])

ent_fsa = np.zeros(np.size(e))
u_fsa_comp = np.dot(fsa_basis, u)
for n in range(0, np.size(u_fsa_comp, axis=1)):
    ent_fsa[n] = ent.eval(u_fsa_comp[:, n])
H.gen()
H.sector.find_eig()
t=np.arange(0,20,0.1)
states=dict()
for n in range(0,np.size(pxp.basis_refs,axis=0)):
    states[n] = ref_state(pxp.basis_refs[n],pxp)
# states[0] = zm_state(2,1,pxp)
# states[1] = ref_state(1,pxp)
# states[1] = zm_state(3,1,pxp)
# states[2] = zm_state(3,1,pxp,1)
# states[3] = zm_state(3,1,pxp,2)
# states[4] = ref_state(0,pxp)
f=dict()
pbar=ProgressBar()
for n in pbar(range(0,len(states))):
    f[n] = fidelity(states[n],H).eval(t,states[n])
for n in range(0,len(f)):
    plt.plot(t,f[n])
plt.legend()
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle \psi(0) \vert \psi(t) \rangle \vert^2$")
plt.title(r"Half Hypercube Fidelity, N=12")
plt.show()

ent_vals = np.zeros(np.size(pxp.basis_refs))
ent = entropy(pxp)
for n in range(0,np.size(pxp.basis_refs,axis=0)):
    ent_vals[n] = ent.eval(H.sector.eigvectors()[:,n])
plt.scatter(H.sector.eigvalues(),ent_vals)
plt.show()