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
Beispiel #2
0
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]))
            decomp_ref = np.append(decomp_ref, decompBasis.basis_refs[n])
to_keep = np.transpose(np.delete(to_keep, 0, axis=0))

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

# 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,1,0,0],[0,0,1,0]])
# Hp[2].model_coef = np.array([1,1])
Beispiel #4
0
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)
    if np.abs(np.vdot(next_state, next_state))**2 > 1e-5:
        next_state = next_state / np.power(np.vdot(next_state, next_state),
                                           0.5)
        fsa_basis = np.vstack((fsa_basis, next_state))
        current_state = next_state
    else:
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)
Hp[2].site_ops[1] = np.array([[0, 0], [1, 0]])
Hp[2].site_ops[2] = np.array([[0, 1], [0, 0]])
    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]])
Kp.model_coef = np.array([1, -1])
Kp.uc_size = np.array([2, 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]])
Ip[2].model = np.array([[0, 0, 2, 0, 0], [0, 0, 1, 0, 0]])
Ip[2].model_coef = np.array([1, -1])
Beispiel #8
0
    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])

# 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])
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]])
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])
Beispiel #10
0
# 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)
V3.site_ops[1] = np.array([[0, 1], [1, 0]])
V3.model = np.array([[0, 1, 1, 1, 0], [0, 1, 1, 1, 0]])
pxp.gen_basis()
pxp = pxp.U1_sector(5)
print(pxp.dim)
pxp_syms = model_sym_data(pxp,[translational(pxp),parity(pxp)])

J = 1
Jz = 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([[0,2,1,0],[0,1,2,0],[3,3]])
Hp[0].model_coef = np.array([J/2,J/2,Jz/2])
Hp[0].uc_size = np.array([2,2,1])
Hp[0].uc_pos = np.array([1,0,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].model = np.array([[0,2,1,0,0],[0,0,2,1,0],[0,0,1,2,0],[0,1,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([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[4] = np.array([[0,0],[0,1]])
# Hp[1].model = np.array([[0,4,0,1,2,0],[0,1,2,0,4,0],[0,2,1,0,4,0],[0,4,0,2,1,0]])
# Hp[1].model_coef = np.array([1,1,1,1])
#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,2,1,2,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,2,1,0,4,0,0],[0,0,4,0,1,2,1,0],[0,0,4,0,2,1,2,0],[0,1,2,1,0,4,0,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([0,2,0,2])
# Hp[1].gen()

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

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,2,1,2,0],[0,2,1,2,0]])
Hp[1].model_coef = np.array([1,1])
Hp[1].uc_size = np.array([4,4])
Hp[1].uc_pos = np.array([3,1])

z=zm_state(4,1,pxp)
for n in range(0,len(Hp)):
    Hp[n].gen()
Hp_total = H_operations.add(Hp[0],Hp[1], np.array([1,-1]))

H = H_operations.add(Hp_total,Hp_total.herm_conj(),np.array([1,1]))
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):
    evolved_state = time_evolve_state(psi_energy, e, t)
    f = np.abs(np.vdot(evolved_state, psi_energy))**2
    return -f


from copy import deepcopy
from Hamiltonian_Classes import H_operations
from scipy.optimize import minimize, minimize_scalar


def fidelity_error(coef, plot=False):
    coef = coef[0]
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)
Hp[2].site_ops[1] = np.array([[0, 0], [1, 0]])
Hp[2].site_ops[2] = np.array([[0, 1], [0, 0]])
#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])

# 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,1,2,1,0,4,0,0],[0,1,2,1,0,4,0,0],[0,0,4,0,1,2,1,0],[0,0,4,0,1,2,1,0]])
Beispiel #17
0

#init system
N = 9
pxp = unlocking_System([0], "periodic", 2, N)
pxp.gen_basis()
pxp_syms = model_sym_data(pxp, [translational_general(pxp, order=3)])

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

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, 1, 0, 0], [0, 0, 1, 0]])
Beispiel #18
0
#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])
# 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])
Beispiel #19
0
#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]])
# Hp[2].model_coef = np.array([1,1])
# Hp[2].uc_size = np.array([4,4])
Beispiel #20
0
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]))

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")
Beispiel #21
0
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())

Hz = 1 / 2 * com(Hp, Hm)
Beispiel #22
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()
#init system
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 = 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])

Im = dict()
Im[0] = Hamiltonian(pxp,pxp_syms)
Im[0].site_ops[1] = np.array([[0,1,0],[0,0,0],[0,0,0]])
Im[0].site_ops[2] = np.array([[0,0,0],[1,0,0],[0,0,0]])
Im[0].model = np.array([[0,2,0],[0,1,0]])
Im[0].model_coef = np.array([1,-1])