Пример #1
0
def fidelity_erorr(coef):
    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()
    Hz = 1 / 2 * com(Hp_total.sector.matrix(k), Hm.sector.matrix(k))
    e, u = np.linalg.eigh(Hz)
    psi = u[:, 0]

    H = H_operations.add(Hp_total, Hm, np.array([1, 1]))
    H.sector.find_eig(k)

    psi_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))), psi)

    t = np.arange(0, 6, 0.001)
    # 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, H.sector.eigvalues(k),
                                          t[n])
        f[n] = np.abs(np.vdot(evolved_state, psi_energy))**2
    for n in range(0, np.size(f, axis=0)):
        if f[n] < 0.1:
            cut = n
            break
    f0 = np.max(f[cut:])
    # plt.plot(t,f)
    # plt.show()

    # res = minimize_scalar(lambda t: -fidelity_eval(psi_energy,H.sector.eigvalues(),t),method="golden",bracket=(2.5,5.5))
    # f0 = fidelity_eval(psi_energy,H.sector.eigvalues(),res.x)
    return 1 - f0
def fidelity_error(coef):
    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_total = Hp_total.herm_conj()

    H = H_operations.add(Hp_total, Hm_total, np.array([1, 1]))
    H.sector.find_eig(k)

    psi_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))), psi_mom)

    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, H.sector.eigvalues(k),
                                          t[n])
        f[n] = np.abs(np.vdot(evolved_state, psi_energy))**2
    for n in range(0, np.size(f, axis=0)):
        if f[n] < 0.5:
            cut = n
            break
    f_max = np.max(f[cut:])
    error = 1 - f_max

    # res = minimize_scalar(lambda t: -fidelity_eval(psi_energy,H.sector.eigvalues(k),t),method="golden")
    # f0 = fidelity_eval(psi_energy,H.sector.eigvalues(k),res.x)
    # error = 1-f0
    print(coef, error)
    # if (np.abs(coef)>1).any():
    # return 1000
    # else:
    return error
Пример #3
0
def fidelity_eval(psi_energy, e, t):
    # f=fidelity(z,H).eval([t],z)
    evolved_state = time_evolve_state(psi_energy, e, t)
    f = np.abs(np.vdot(psi_energy, evolved_state))**2
    # f=fidelity(z,H,"use sym").eval([t],z)
    # evolved_state = time_evolve_state(z_energy,e,t)
    # f= np.abs(np.vdot(z_energy,evolved_state))**2
    return -f
Пример #4
0
def long_time_entropy(phi2, t):
    #create MPs
    def A_up(theta, phi):
        return np.array([[0, 1j * np.exp(-1j * phi)], [0, 0]])

    def A_down(theta, phi):
        return np.array([[np.cos(theta), 0], [np.sin(theta), 0]])

    theta1 = 0.9
    theta2 = 2.985
    phi1 = 0.188
    # phi2 = 1.3

    A_ups = dict()
    A_downs = dict()
    A_ups[0] = A_up(theta1, phi1)
    A_ups[1] = A_up(theta2, phi2)

    A_downs[0] = A_down(theta1, phi1)
    A_downs[1] = A_down(theta2, phi2)

    tensors = dict()
    K = 2
    for n in range(0, K):
        tensors[n] = np.zeros(
            (2, np.size(A_ups[0], axis=0), np.size(A_ups[0], axis=1)),
            dtype=complex)
    tensors[0][0] = A_downs[0]
    tensors[0][1] = A_ups[0]
    tensors[1][0] = A_downs[1]
    tensors[1][1] = A_ups[1]

    from MPS import periodic_MPS
    psi = periodic_MPS(N)
    for n in range(0, N, 1):
        psi.set_entry(n, tensors[int(n % 2)], "both")

    #convert MPS -> wf array
    wf = np.zeros(system.dim, dtype=complex)
    for n in range(0, np.size(system.basis_refs, axis=0)):
        bits = system.basis[n]
        coef = psi.node[0].tensor[bits[0]]
        for m in range(1, np.size(bits, axis=0)):
            coef = np.dot(coef, psi.node[m].tensor[bits[m]])
        coef = np.trace(coef)
        wf[n] = coef

    psi_energy = np.dot(np.conj(np.transpose(u)), wf)
    evolved_state = time_evolve_state(psi_energy, e, t)
    evolved_state_comp = np.dot(np.conj(np.transpose(u)), evolved_state)
    S = ent.eval(evolved_state_comp)
    print(phi2, S)
    return S
Пример #5
0
def cell_no(state_energy, eigs, T, delta_t):
    t_range = np.arange(0, T, delta_t)
    lin = 1 - t_range / T

    fid = np.zeros(np.size(t_range))
    for n in range(0, np.size(t_range, axis=0)):
        evolved_state = time_evolve_state(state_energy, eigs, t_range[n])
        fid[n] = np.abs(np.vdot(evolved_state, state_energy))**2
    integrand = np.multiply(lin, fid)
    integral = np.trapz(integrand, t_range)
    phase_space_cells = T / (2 * integral)
    return phase_space_cells
Пример #6
0
def fidelity_erorr(coef):
    coef = coef[0]
    Ip_total = H_operations.add(Ip, Ip_pert, np.array([1, coef]))
    Im_total = H_operations.add(Im, Im_pert, np.array([1, coef]))
    Kp_total = H_operations.add(Kp, Kp_pert, np.array([1, coef]))
    Km_total = H_operations.add(Km, Km_pert, np.array([1, coef]))
    Lp_total = H_operations.add(Lp, Lp_pert, np.array([1, coef]))
    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)

    z = zm_state(2, 1, pxp, 1)
    block_refs = pxp_syms.find_block_refs(k)
    psi = np.zeros(np.size(block_refs))
    loc = find_index_bisection(z.ref, block_refs)
    psi[loc] = 1
    psi_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))), psi)

    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, H.sector.eigvalues(k),
                                          t[n])
        f[n] = np.abs(np.vdot(evolved_state, psi_energy))**2
    for n in range(0, np.size(f, axis=0)):
        if f[n] < 0.1:
            cut = n
            break
    f0 = np.max(f[cut:])
    plt.scatter(H.sector.eigvalues(k), np.log10(np.abs(psi_energy)**2))
    plt.title(r"$PCP+\lambda(PPCP+PCPP), N=$" + str(pxp.N))
    plt.xlabel(r"$E$")
    plt.ylabel(r"$\log(\vert \langle \psi \vert E \rangle \vert^2)$")
    plt.show()
    plt.plot(t, f)
    plt.title(r"$PCP+\lambda(PPCP+PCPP), N=$" + str(pxp.N))
    plt.xlabel(r"$t$")
    plt.ylabel(r"$\vert \langle \psi(0) \vert \psi(t) \rangle \vert^2$")
    plt.show()
    return 1 - f0
Пример #7
0
def trajectory(init_state, t_range, H_eigvalues, H_eigvectors, system):
    state_energy = np.dot(np.conj(np.transpose(H_eigvectors)), init_state)
    x0 = np.vdot(init_state, np.dot(X.sector.matrix(), init_state))
    y0 = np.vdot(init_state, np.dot(Y.sector.matrix(), init_state))
    z0 = np.vdot(init_state, np.dot(Z.sector.matrix(), init_state))

    x = np.zeros(np.size(t_range))
    y = np.zeros(np.size(t_range))
    z = np.zeros(np.size(t_range))
    f = np.zeros(np.size(t_range))
    for n in range(0, np.size(t_range, axis=0)):
        evolved_state = time_evolve_state(state_energy, H_eigvalues,
                                          t_range[n])
        x[n] = np.real(np.vdot(evolved_state, np.dot(X_energy,
                                                     evolved_state))) / J
        y[n] = np.real(np.vdot(evolved_state, np.dot(Y_energy,
                                                     evolved_state))) / J
        z[n] = np.real(np.vdot(evolved_state, np.dot(Z_energy,
                                                     evolved_state))) / J
        f[n] = np.abs(np.vdot(evolved_state, state_energy))**2
    return x, y, z, f
    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()

# svd_basis = np.load("./svd_basis_for_gif/svd_basis,16,150.npy")
# t_info = np.load("./svd_basis_for_gif/t_info,16,150.npy")
# print(t_info[1])

# z_svd = np.dot(np.conj(np.transpose(svd_basis)),z.prod_basis())
# H_svd = np.dot(np.conj(np.transpose(svd_basis)),np.dot(H0.sector.matrix(),svd_basis))
Пример #9
0
neel_trans[block_keys[neel.ref]] = 1
pol_trans[block_keys[pol.ref]] = 1
all_ones_trans[block_keys[all_ones.ref]] = 1

neel_trans_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))),neel_trans)
pol_trans_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))),pol_trans)
all_ones_trans_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))),all_ones_trans)

t=np.arange(0,80,0.01)
f_neel = np.zeros(np.size(t))
f_pol = np.zeros(np.size(t))
f_all_ones = np.zeros(np.size(t))

for n in range(0,np.size(t,axis=0)):
    evolved_neel = time_evolve_state(neel_trans_energy,H.sector.eigvalues(k),t[n])
    # evolved_pol = time_evolve_state(pol_trans_energy,H.sector.eigvalues(k),t[n])
    # evolved_all_ones = time_evolve_state(all_ones_trans_energy,H.sector.eigvalues(k),t[n])

    f_neel[n] = np.abs(np.vdot(evolved_neel,neel_trans_energy))**2
    f_pol[n] = np.abs(np.vdot(evolved_neel,pol_trans_energy))**2
    f_all_ones[n] = np.abs(np.vdot(evolved_neel,all_ones_trans_energy))**2

plt.plot(t,f_neel,label=r"$\vert \phi \rangle = \vert Z_2,k=0 \rangle$")
plt.plot(t,f_pol,label=r"$\vert \phi \rangle = \vert 000... \rangle$")
plt.plot(t,f_all_ones,label=r"$\vert \phi \rangle = \vert 111...10, k=0 \rangle$")
plt.title(r"$\lambda P^0 X P^0 + P^1 X P^0 + P^0 X P^1, \lambda=$"+str(V)+" , translationally invariant fidelities, N="+str(pxp.N))
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle \phi \vert e^{-i H t} \vert Z_2,k=0\rangle \vert^2$")
plt.legend()
plt.show()
Пример #10
0
z_energy = np.conj(H.sector.eigvectors()[pxp.keys[z.ref], :])
neel_cube = np.dot(np.transpose(np.conj(basis)), psi)
neel_perm = np.dot(np.transpose(np.conj(perm_basis)), psi)
neel_fsa = np.dot(np.transpose(np.conj(fsa_basis)), psi)

neel_cube_energy = np.dot(np.conj(np.transpose(u_cube)), neel_cube)
neel_perm_energy = np.dot(np.conj(np.transpose(u_perm)), neel_perm)
neel_fsa_energy = np.dot(np.conj(np.transpose(u_fsa)), neel_fsa)

t = np.arange(0, 40, 0.01)
cube_exact_overlap = np.zeros(np.size(t))
perm_exact_overlap = np.zeros(np.size(t))
fsa_exact_overlap = np.zeros(np.size(t))
pbar = ProgressBar()
for n in pbar(range(0, np.size(t, axis=0))):
    evolved_state_exact = time_evolve_state(z_energy, H.sector.eigvalues(),
                                            t[n])
    evolved_state_comp = np.dot(H.sector.eigvectors(), evolved_state_exact)

    evolved_state_cube_energy = time_evolve_state(neel_cube_energy, e_cube,
                                                  t[n])
    evolved_state_perm_energy = time_evolve_state(neel_perm_energy, e_perm,
                                                  t[n])
    evolved_state_fsa_energy = time_evolve_state(neel_fsa_energy, e_fsa, t[n])

    evolved_state_cube = np.dot(u_cube, evolved_state_cube_energy)
    evolved_state_perm = np.dot(u_perm, evolved_state_perm_energy)
    evolved_state_fsa = np.dot(u_fsa, evolved_state_fsa_energy)

    evolved_state_cube_comp = np.dot(basis, evolved_state_cube)
    evolved_state_perm_comp = np.dot(perm_basis, evolved_state_perm)
    evolved_state_fsa_comp = np.dot(fsa_basis, evolved_state_fsa)
# V3_ops[1].site_ops[1] = np.array([[0,1],[1,0]])
# V3_ops[1].model = np.array([[0,1,1,1,0]])
# V3_ops[1].model_coef = np.array([1])
# V3_ops[1].gen(uc_size=3,uc_pos=2)

# V3 = V3_ops[0]
# for n in range(1,len(V3_ops)):
# V3=H_operations.add(V3,V3_ops[n],np.array([1,1]))

H0 = spin_Hamiltonian(pxp, "x", pxp_syms)
H0.gen()
# coef = np.array([0.18243653,-0.10390499,0.054452])
# coef = np.array([0.00783215,0.16966656,-0.05180238])
# H = H_operations.add(H0,V1,np.array([1,coef[0]]))
# H = H_operations.add(H,V2,np.array([1,coef[1]]))
# H = H_operations.add(H,V3,np.array([1,coef[2]]))
H = H0

H.sector.find_eig()
psi = np.load("./z3,entangled_MPS_coef," + str(pxp.N) + ".npy")
psi_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors())), psi)
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, H.sector.eigvalues(), t[n])
    f[n] = np.abs(np.vdot(evolved_state, psi_energy))**2
np.save("pxp,z3_mps,no_pert,t," + str(pxp.N), t)
np.save("pxp,z3_mps,no_pert,fidelity," + str(pxp.N), f)
plt.plot(t, f)
plt.show()
def fidelity_erorr(coef,plot=False):
    c=0
    Ip_total = deepcopy(Ip[0])
    for n in range(1,len(Ip)):
        Ip_total = H_operations.add(Ip_total,Ip[n],np.array([1,coef[c+n-1]]))
    Im_total = deepcopy(Im[0])
    for n in range(1,len(Im)):
        Im_total = H_operations.add(Im_total,Im[n],np.array([1,coef[c+n-1]]))
    c += len(Ip)-1
    Kp_total = deepcopy(Kp[0])
    for n in range(1,len(Kp)):
        Kp_total = H_operations.add(Kp_total,Kp[n],np.array([1,coef[c+n-1]]))
    Km_total = deepcopy(Km[0])
    for n in range(1,len(Km)):
        Km_total = H_operations.add(Km_total,Km[n],np.array([1,coef[c+n-1]]))
    c += len(Kp)-1
    Lp_total = deepcopy(Lp[0])
    for n in range(1,len(Lp)):
        Lp_total = H_operations.add(Lp_total,Lp[n],np.array([1,coef[c+n-1]]))
    Lm_total = deepcopy(Lm[0])
    for n in range(1,len(Lm)):
        Lm_total = H_operations.add(Lm_total,Lm[n],np.array([1,coef[c+n-1]]))

    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)

    z=zm_state(2,1,pxp,1)
    block_refs = pxp_syms.find_block_refs(k)
    psi = np.zeros(np.size(block_refs))
    loc = find_index_bisection(z.ref,block_refs)
    psi[loc] = 1
    psi_energy = np.dot(np.conj(np.transpose(H.sector.eigvectors(k))),psi)

    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,H.sector.eigvalues(k),t[n])
        f[n] = np.abs(np.vdot(evolved_state,psi_energy))**2
    for n in range(0,np.size(f,axis=0)):
        if f[n] < 0.1:
            cut = n
            break
    f0 = np.max(f[cut:])
    if plot is True:
        plt.scatter(H.sector.eigvalues(k),np.log10(np.abs(psi_energy)**2))
        plt.title(r"$PCP+\lambda(PPCP+PCPP), N=$"+str(pxp.N))
        plt.xlabel(r"$E$")
        plt.ylabel(r"$\log(\vert \langle \psi \vert E \rangle \vert^2)$")
        plt.show()
        plt.plot(t,f)
        plt.title(r"$PCP+\lambda(PPCP+PCPP), N=$"+str(pxp.N))
        plt.xlabel(r"$t$")
        plt.ylabel(r"$\vert \langle \psi(0) \vert \psi(t) \rangle \vert^2$")
        plt.show()
    print(coef,f0)
    return 1-f0
Пример #13
0
print("PXP FSA projected")
print(e_fsa_diffs)
print("Perm Projected")
temp = np.load("./E_diff_perm_N10.npy")
print(temp)

#compare time evolutions
t = np.arange(0, 20, 0.01)
f_fsa = np.zeros(np.size(t))
f_suq = np.zeros(np.size(t))

psi_fsa_energy = np.conj(u_fsa[0, :])
psi_suq_energy = np.conj(u[0, :])

for n in range(0, np.size(t, axis=0)):
    evolved_state_fsa = time_evolve_state(psi_fsa_energy, e_fsa, t[n])
    evolved_state_suq = time_evolve_state(psi_suq_energy, e, t[n])
    f_fsa[n] = np.abs(np.vdot(psi_fsa_energy, evolved_state_fsa))**2
    f_suq[n] = np.abs(np.vdot(psi_suq_energy, evolved_state_suq))**2
plt.plot(t, f_fsa, label="PXP, FSA Projected")
plt.plot(t,
         f_suq,
         label=r"Unconstrained SUq(2) Chain, q=$1.4403104 e^{0.3148 i}$")
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle \psi(0) \vert \psi(t) \rangle \vert^2$")
plt.title(r"$N=10$")
plt.legend()
plt.show()

# plt.plot(e_diff,label="suq")
# plt.plot(e_fsa_diffs,label="fsa")
Пример #14
0
def fidelity_eval(psi_energy, e, t):
    evolved_state = time_evolve_state(psi_energy, e, t)
    f = np.abs(np.vdot(evolved_state, psi_energy))**2
    return f
states = dict()
states_energy = dict()
f = dict()
ent = entropy(pxp)
ent_vals = np.zeros(np.size(pxp.basis_refs))
pbar = ProgressBar()
print("Plotting fidelity/entropy")
for n in pbar(range(0, np.size(pxp.basis_refs, axis=0))):
    states[n] = ref_state(pxp.basis_refs[n], pxp)
    states_energy[n] = np.conj(u[pxp.keys[states[n].ref], :])
    f[n] = np.zeros(np.size(t))

    ent_vals[n] = ent.eval(u[:, n])
    for m in range(0, np.size(t, axis=0)):
        evolved_state = time_evolve_state(states_energy[n], e, t[m])
        f[n][m] = np.abs(np.vdot(states_energy[n], evolved_state))**2

    plt.plot(t, f[n], alpha=0.6)
plt.xlabel(r"$t$")
plt.ylabel(r"$\vert \langle n(0) \vert n(t) \rangle \vert^2$")
plt.title(
    r"Hypercube $H=\sum_i X_i$, with $P=$" + str(p) +
    " chance of removing state from $L/2-1, L/2, L/2+1$ hamming sector. Computational basis fidelities, $N=$"
    + str(pxp.N))
plt.show()
plt.scatter(e, ent_vals)
plt.xlabel(r"$E$")
plt.ylabel(r"$S$")
plt.title(
    r"Hypercube $H=\sum_i X_i$, with $P=$" + str(p) +
Пример #16
0
    r"$\sum_{n} P_{n-1}X_nP_{n+1} (\sum_{d=2}^5 Z_{i+d} + Z_{i-d} ), N=$" +
    str(N) + "\n Numerical state overlap")
plt.show()
plt.scatter(H.sector.eigvalues(), overlap_neel)
plt.xlabel(r"$E$")
plt.ylabel(r"$\log(\vert \langle \psi \vert E \rangle \vert^2)$")
plt.title(
    r"$\sum_{n} P_{n-1}X_nP_{n+1} (\sum_{d=2}^5 Z_{i+d} + Z_{i-d} ), N=$" +
    str(N) + "\n Neel state overlap")
plt.show()

t = np.arange(0, 20, 0.01)
f = np.zeros(np.size(t))
f_neel = np.zeros(np.size(t))
for n in range(0, np.size(t, axis=0)):
    evolved_state = time_evolve_state(z0_energy, H.sector.eigvalues(), t[n])
    evolved_state_neel = time_evolve_state(z_energy, H.sector.eigvalues(),
                                           t[n])
    f[n] = np.abs(np.vdot(z0_energy, evolved_state))**2
    f_neel[n] = np.abs(np.vdot(z_energy, evolved_state_neel))**2
plt.plot(t, np.log10(1 - f), label="Numerical State")
plt.plot(t, np.log10(1 - f_neel), label="Neel State")
plt.legend()
plt.xlabel(r"$t$")
plt.ylabel(r"$\log(1-\vert \langle \psi(0) \vert \psi(t) \rangle \vert^2)$")
plt.title(
    r"$\sum_{n} P_{n-1}X_nP_{n+1} (\sum_{d=2}^5 Z_{i+d} + Z_{i-d} ), N=$" +
    str(N))
plt.show()

H0 = spin_Hamiltonian(pxp, "x", pxp_syms)
Пример #17
0
                np.dot(H.sector.matrix(), perm_basis))
e, u = np.linalg.eigh(H_perm)

#time evolve state in perm basis,
z = zm_state(3, 1, pxp)
# psi_energy = np.conj(H.sector.eigvectors()[pxp.keys[z.ref],:])
psi = np.dot(np.conj(np.transpose(perm_basis)), z.prod_basis())
psi = psi / np.power(np.vdot(psi, psi), 0.5)
psi_energy = np.dot(np.conj(np.transpose(u)), psi)

t = np.arange(0, 10, 0.1)
evolved_states = np.zeros((pxp.dim, np.size(t)), dtype=complex)
for n in range(0, np.size(t, axis=0)):
    # evolved_state = time_evolve_state(psi_energy,H.sector.eigvalues(),t[n])
    # evolved_prod_basis = np.dot(H.sector.eigvectors(),evolved_state)
    evolved_perm_energy_basis = time_evolve_state(psi_energy, e, t[n])
    evolved_perm_basis = np.dot(u, evolved_perm_energy_basis)
    evolved_prod_basis = np.dot(perm_basis, evolved_perm_basis)
    evolved_states[:, n] = evolved_prod_basis

system = unlocking_System([0], "periodic", 2, N)
system.gen_basis()


#minimize distance of evolved states with tensor tree ansatz
def mps_wf(theta1, phi1, theta2, phi2, theta3, phi3):
    def A_up(theta, phi):
        return np.array([[0, 1j * np.exp(-1j * phi)], [0, 0]])

    def A_down(theta, phi):
        return np.array([[np.cos(theta), 0], [np.sin(theta), 0]])
Пример #18
0
# from mpl_toolkits.mplot3d import Axes3D
# fig = plt.figure()
# ax = Axes3D(fig)
# ax.set_xlabel("X")
# ax.set_ylabel("Y")
# ax.set_zlabel("Z")

t_range = np.arange(0, 30, 0.1)
# f_neel= fidelity(z0,H).eval(t_range,z0)
# f_neel1= fidelity(z0,H).eval(t_range,z1)
# f_neel3= fidelity(z3,H).eval(t_range,z3)
f_neel = np.zeros(np.size(t_range))
f_neel1 = np.zeros(np.size(t_range))
f_neel3 = np.zeros(np.size(t_range))
for n in range(0, np.size(t_range, axis=0)):
    z2_evolved = time_evolve_state(z0_energy, H_eigvalues, t_range[n])
    z3_evolved = time_evolve_state(z3_energy, H_eigvalues, t_range[n])
    f_neel[n] = np.abs(np.vdot(z2_evolved, z0_energy))**2
    f_neel1[n] = np.abs(np.vdot(z2_evolved, z1_energy))**2
    f_neel3[n] = np.abs(np.vdot(z3_evolved, z3_energy))**2

pbar = ProgressBar()
print("Plotting Trajectories")
for n in pbar(range(0, len(states))):
    x, y, z, f = trajectory(states[n], t_range, H_eigvalues, H_eigvectors, pxp)
    plt.plot(t_range, f, alpha=0.5)
    np.save(
        "./data/" + str(N) + "/fidelity/cstate_fidelity,J" + str(J) + "," +
        str(n), f)
    # ax.plot(x,y,z)
# plt.show()
Пример #19
0
for n in pbar(range(100,501)):
    temp = np.load("./disorder_realizations/H,"+str(n)+".npy")
    H_total = H_total + temp
    c=c+1
print(c)
H_total = H_total / c
print(H_total)
np.save("H_avg,cycle_disorder,12",H_total)

e,u = np.linalg.eigh(H_total)
z=zm_state(2,1,pxp)
z_energy = np.conj(u[pxp.keys[z.ref],:])
t=np.arange(0,10,0.1)
f=np.zeros(np.size(t))
for n in range(0,np.size(f,axis=0)):
    evolved_state = time_evolve_state(z_energy,e,t[n])
    f[n] = np.abs(np.vdot(evolved_state,z_energy))**2
plt.plot(t,f)
plt.show()
pbar=ProgressBar()

for n in pbar(range(0,np.size(pxp.basis_refs,axis=0))):
# for n in pbar(range(0,np.size(e,axis=0))):
    z_energy = np.conj(u[n,:])
    f=np.zeros(np.size(t))
    for m in range(0,np.size(f,axis=0)):
        evolved_state = time_evolve_state(z_energy,e,t[m])
        f[m] = np.abs(np.vdot(evolved_state,z_energy))**2

    for m in range(0,np.size(f,axis=0)):
        if f[m] <0.2:
Пример #20
0
    H = spin_Hamiltonian(pxp, "x")
    H.gen()
    H.sector.find_eig()
    z = zm_state(2, 1, pxp)
    z_energy = H.sector.eigvectors()[pxp.keys[z.ref], :]

    pbar = ProgressBar()
    for index in pbar(range(0, np.size(t_max_vals, axis=0))):
        t_max = t_max_vals[index]
        t = np.arange(0, t_max + delta_t, delta_t)
        L = t_max / delta_t
        M = np.zeros((pxp.dim, np.size(t)), dtype=complex)
        psi_time_step = dict()
        for n in range(0, np.size(t, axis=0)):
            evolved_state = time_evolve_state(z_energy, H.sector.eigvalues(),
                                              t[n])
            M[:, n] = evolved_state
        # plt.matshow(np.abs(M))
        # plt.show()

        u, s, vh = np.linalg.svd(M)

        def error(N):
            return np.sum(s[N:])

        N = np.arange(0, np.size(s)).astype(int)
        e = np.zeros(np.size(N))
        for n in range(0, np.size(e, axis=0)):
            e[n] = error(N[n])

        #find n such that error<0.01*L
Пример #21
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.sector.matrix()
Hm = np.conj(np.transpose(Hp))

H = Hp + Hm

z = zm_state(2, 1, pxp, 1)
e, u = np.linalg.eigh(H)
overlap = np.log10(np.abs(u[pxp.keys[z.ref], :])**2)
psi_energy = np.conj(u[pxp.keys[z.ref], :])
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.plot(t, f)
plt.show()

from Calculations import gen_fsa_basis
# fsa_basis = gen_fsa_basis(Hp,z.prod_basis(),int(2*pxp.N/3))
fsa_basis = gen_fsa_basis(Hp, z.prod_basis(), int(pxp.N))
H_fsa = np.dot(np.conj(np.transpose(fsa_basis)), np.dot(H, fsa_basis))

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])
H = spin_Hamiltonian(pxp,"x",pxp_syms)
H.gen()
H.sector.find_eig()

H_perm = np.dot(np.conj(np.transpose(perm_basis)),np.dot(H.sector.matrix(),perm_basis))
e,u = np.linalg.eigh(H_perm)

#time evolve state in perm basis,
z_ref = perm_keys(int(N/2),0,N)
z_index = find_index_bisection(z_ref,basis_refs)
psi_energy = np.conj(u[z_index,:])

t=np.arange(0,10,0.1)
evolved_states = np.zeros((pxp.dim,np.size(t)),dtype=complex)
for n in range(0,np.size(t,axis=0)):
    evolved_state_perm_energy = time_evolve_state(psi_energy,e,t[n])
    evolved_state_perm = np.dot(u,evolved_state_perm_energy)
    evolved_state_prod = np.dot(perm_basis,evolved_state_perm)
    evolved_states[:,n] = evolved_state_prod

#minimize distance of evolved states with tensor tree ansatz
def TT_wf(theta1,phi1,theta2,phi2):
    c1_up = 1j * np.exp(-1j * phi1)*np.tan(theta2)
    c1_down = np.cos(theta1)

    c2_up = 1j * np.exp(-1j*phi2)*np.tan(theta1)
    c2_down = np.cos(theta2)
    wf = np.zeros(pxp.dim,dtype=complex)

    for n in range(0,np.size(pxp.basis,axis=0)):
        A_occ = 0