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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
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)
Пример #5
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()
Пример #6
0
#rc('font',**{'family':'serif','serif':['Palatino']})
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 = 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()
# print("\n")
# root_refs = find_root_refs(np.array([4,1]),np.array([4,2]),H,sector_refs,from_sector,pxp)
# 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()
Пример #8
0
    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


#init system
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)])

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([[0, 1, 2, 1, 0], [0, 2, 1, 2, 0], [0, 2, 1, 2, 0],
                     [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([2, 3, 0, 1])

# 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])
Пример #9
0
def var(Q, psi):
    Q2 = np.dot(Q, Q)
    return exp(Q2, psi) - exp(Q, psi)**2


def com(a, b):
    return np.dot(a, b) - np.dot(b, a)


N = 12
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])

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, 2, 1, 2, 0], [0, 1, 2, 1, 0]])
Hp[1].model_coef = np.array([1, 1])
Hp[1].uc_size = np.array([2, 2])
Hp[1].uc_pos = np.array([0, 1])
def var(Q, psi):
    Q2 = np.dot(Q, Q)
    return exp(Q2, psi) - exp(Q, psi)**2


def com(a, b):
    return np.dot(a, b) - np.dot(b, a)


N = 12
pxp = unlocking_System([0], "periodic", 2, N)
pxp.gen_basis()
pxp_syms = model_sym_data(pxp, [translational(pxp), parity(pxp)])

H0 = Hamiltonian(pxp)
H0.site_ops[1] = np.array([[0, 1], [1, 0]])
H0.model = np.array([[0, 1, 1, 1, 0]])
H0.model_coef = np.array([1])

V = Hamiltonian(pxp)
V.site_ops[1] = np.array([[0, 1], [1, 0]])
V.site_ops[4] = np.array([[0, 0], [0, 1]])
V.model = np.array([[0, 1, 1, 1, 0, 4, 0], [0, 4, 0, 1, 1, 1, 0],
                    [0, 1, 1, 1, 0, 4, 0], [0, 4, 0, 1, 1, 1, 0]])
V.model_coef = np.array([1, 1, 1, 1])
V.uc_size = np.array([4, 4, 4, 4])
V.uc_pos = np.array([2, 0, 0, 2])


def fidelity_eval(psi_energy, e, t):
Пример #11
0
    return np.dot(a,b)-np.dot(b,a)
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

#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])
Пример #12
0
pxp.gen_basis()
pxp_syms=model_sym_data(pxp,[translational(pxp)])

H = spin_Hamiltonian(pxp,"x",pxp_syms)
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()
N = 6
pxp = unlocking_System([0, 1], "periodic", 2, N)
pxp_syms = model_sym_data(pxp, [
    translational(pxp),
    parity(pxp),
])
pxp_half = unlocking_System([0], "periodic", 2, N)

#form Rydberg subspace in full basis
rydberg_subspace = np.zeros((pxp.dim, pxp_half.dim))
for n in range(0, pxp_half.dim):
    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()
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
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)
Пример #15
0
from Calculations import level_stats,fidelity,eig_overlap,entropy,site_precession,site_projection,time_evolve_state

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 = 12
pxp = unlocking_System([0,1],"periodic",2,N)
pxp.gen_basis()
pxp_syms=model_sym_data(pxp,[translational(pxp)])

H = spin_Hamiltonian(pxp,"x",pxp_syms)
H = Hamiltonian(pxp,pxp_syms)
H.site_ops[1] = np.array([[0,1/2],[1/2,0]])
H.site_ops[2] = np.array([[1,0],[0,0]])
H.site_ops[3] = np.array([[0,0],[0,1]])
H.model = np.array([[2,1,2],[2,1,3],[3,1,2]])
V=30e-1
H.model_coef = np.array([V,1,1])
# H.model = np.array([[0,1]])
# H.model_coef = np.array([1])

k=[0]
H.gen(k)
H.sector.find_eig(k)

block_refs = pxp_syms.find_block_refs(k)
block_keys = dict()
Пример #16
0

#init system
N = 8
pxp = unlocking_System([0], "periodic", 2, N)
pxp.gen_basis()
pxp_syms = model_sym_data(pxp, [translational(pxp), parity(pxp)])

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

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()
Пример #17
0
S = 1
m = np.arange(-S, S)
couplings = np.power(S * (S + 1) - m * (m + 1), 0.5)
Jp = np.diag(couplings, 1)
Jm = np.diag(couplings, -1)
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
    '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), 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])
Пример #19
0
    return np.dot(a,b)-np.dot(b,a)
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

#init system
N=20
pxp = unlocking_System([0],"periodic",2,N)
pxp.gen_basis()

pxp_syms = model_sym_data(pxp,[translational_general(pxp,order=4),PT(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,1,0],[0,1,2,1,0],[0,2,1,2,0],[0,1,2,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([2,3,0,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].site_ops[4] = np.array([[0,0],[0,1]])
# Hp[1].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[1].model_coef = np.array([1,1,1,1])
# Hp[1].uc_size = np.array([4,4,4,4])
# Hp[1].uc_pos = np.array([1,3,3,1])
Пример #20
0
# pxp_config = model_space.basis[indices[0][index_row_loc[n]]]
# pxxxp_config = model_space.basis[indices[1][index_row_loc[n]]]
# print(pxp_config,pxxxp_config)

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()
Пример #21
0
print(com(sm, P))

e, u = np.linalg.eigh(P_spin_clock_basis)

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]
Пример #22
0
from rw_functions import save_obj,load_obj
from Calculations import level_stats,fidelity,eig_overlap,entropy,site_precession,site_projection,time_evolve_state

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

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))
Пример #23
0
def exp(Q, psi):
    return np.real(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 = 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]])
Пример #24
0
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
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))
Пример #25
0
    '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), 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])
Пример #26
0

def var(Q, psi):
    Q2 = np.dot(Q, Q)
    return exp(Q2, psi) - exp(Q, psi)**2


def com(a, b):
    return np.dot(a, b) - np.dot(b, a)


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

Hp = Hamiltonian(pxp)
Hp.site_ops[1] = np.array([[0, 0], [1, 0]])
Hp.site_ops[2] = np.array([[0, 1], [0, 0]])
Hp.model = np.array([[0, 1, 0], [0, 2, 0]])
Hp.model_coef = np.array([1, 1])
Hp.uc_size = np.array([2, 2])
Hp.uc_pos = np.array([1, 0])
Hp.gen()
Hp = Hp.sector.matrix()

z = zm_state(2, 1, pxp, 1)
fsa_basis = z.prod_basis()
current_state = fsa_basis
fsa_dim = pxp.N
for n in range(0, fsa_dim):
    next_state = np.dot(Hp, current_state)
Пример #27
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 = 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])
Пример #28
0
    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


#init system
N = 18
pxp = unlocking_System([0], "periodic", 2, N)
pxp.gen_basis()
pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=3), PT(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]])
Hp[0].model_coef = np.array([1, 1, 1])
Hp[0].uc_size = np.array([3, 3, 3])
Hp[0].uc_pos = np.array([2, 0, 1])

#1st order
# 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,0,1,0],[0,1,0,0],[0,2,0,0],[0,0,2,0]])
# Hp[1].model_coef = np.array([1,1,1,1])
# Hp[1].uc_size = np.array([3,3,3,3])
# Hp[1].uc_pos = np.array([2,1,2,1])
Пример #29
0
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']})
rc('text', usetex=True)
# matplotlib.rcParams['figure.dpi'] = 400

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()
Пример #30
0
z = zm_state(3, 1, pxp)
k = pxp_syms.find_k_ref(z.ref)
U = dict()
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]])