Different symmetries found for same model
I'm using the development version of the nonhermitian branch of qsymm (1.3.0-dev18+g7dc8bf1b). The following weirdness is happening:
- I create a model by assembling a dictionary with sympy symbols as keys and numpy arrays as values
- I create a model via qsymm.hamiltonian_generator.hamiltonian_from_family()
- Both result in the same sympy matrix
- However, using the same symmetry finding proceedure gives different results for the discrete symmetries (but the same for continuous symmetries)
Here's the code that produced this:
k_x, k_y = sympy.symbols('k_x k_y')
sx, sy, sz = 2 * spin_matrices(1/2)
i_ = np.array([ [1 , 0], [0 , 1] ])
model_dict=dict()
mu1,mu2 = sympy.symbols('mu1 mu2')
model_dict[mu1] = np.kron( np.diag([1,0,]), sz )
model_dict[mu2] = np.kron( np.diag([0,1]), sz )
t11, t12= sympy.symbols('t11 t12')
model_dict[Mul(t11,k_x)] = np.kron( np.diag([1,0]), -sx )
model_dict[Mul(t12,k_x)] = np.kron( np.diag([0,1]), -sx )
model_dict[Mul(t11,k_y)] = np.kron( np.diag([1,0]), -sy )
model_dict[Mul(t12,k_y)] = np.kron( np.diag([0,1]), -sy )
def itb(x, y, mat):
h_ = np.zeros((2,2))
h_[x][y] = 1
return np.kron(h_, mat)
o = sympy.symbols('o')
model_dict[o] = itb(1,0, sz) + itb(0,1, sz)
lam = sympy.symbols('lam')
model_dict[Mul(sympy.I,lam)] = itb(1,0,-i_) + itb(0,1,i_)
ham1 = qsymm.Model(model_dict, momenta = ["k_x", "k_y"])
def find_symmetries(ham):
herm = qsymm.PointGroupElement(np.eye(2), True, False, None, True)
M = qsymm.groups.mirror([1, 0])
TR = qsymm.time_reversal(2)
PH = qsymm.particle_hole(2)
gens = {
herm,
M, TR, PH}
candidates = qsymm.groups.generate_group(gens)
sg, cg = qsymm.symmetries(ham, candidates=candidates,
continuous_rotations=True,
prettify=True,
_check_result=True,
sparse_linalg=False)
return sg, cg
S = qsymm.groups.spin_matrices(1/2)
rot = qsymm.ContinuousGroupGenerator(R=2 * S[1], U=scipy.linalg.block_diag(S[2], S[2]))
PH = qsymm.PointGroupElement(np.eye(2), True, True, scipy.linalg.block_diag(2 * S[0], 2 * S[0]))
herm = qsymm.PointGroupElement(np.eye(2), True, False, np.eye(4), True)
sym = [rot, PH, herm]
family = qsymm.continuum_hamiltonian(sym, dim=2, total_power=1, hermitian=False, prettify=True)
coeffs = ['mu1', 'o', 'mu2', 'lam', 0, 0, 0, 't11', 0, 't12']
ham2 = qsymm.hamiltonian_generator.hamiltonian_from_family(family, coeffs=coeffs, tosympy=False)
ham1.tosympy() == ham2.tosympy(), find_symmetries(ham1), find_symmetries(ham2)