def test_full_symm_3byb3(self): U = 20 * (np.random.rand() - 0.5) t = np.random.rand() gm = geom.Geometry.createSquareGeometry(3, 3, 0, 0, bc1_open=False, bc2_open=False) model = ed_fermions.fermions(gm, U, t, ns=np.array([2, 2])) # no symmetry hamiltonian_full = model.createH(projector=model.n_projector) eig_vals_full, eig_vects_full = model.diagH(hamiltonian_full) # rotational symmetry cx, cy = model.geometry.get_center_of_mass() rot_fn = symm.getRotFn(4, cx=cx, cy=cy) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, model.geometry) rot_op = model.n_projector.dot( model.get_xform_op(rot_cycles).dot( model.n_projector.conj().transpose())) # reflection symmetry refl_fn = symm.getReflFn(np.array([[0], [1]]), cx=cx, cy=cy) refl_cycles, max_cycle_len_refl = symm.findSiteCycles( refl_fn, model.geometry) refl_op = model.n_projector.dot( model.get_xform_op(refl_cycles).dot( model.n_projector.conj().transpose())) # translational symmetry tx_fn = symm.getTranslFn(np.array([[1], [0]])) tx_cycles, tx_max = symm.findSiteCycles(tx_fn, model.geometry) tx_op_full = model.get_xform_op(tx_cycles) tx_op = model.n_projector.dot( tx_op_full.dot(model.n_projector.conj().transpose())) ty_fn = symm.getTranslFn((np.array([[0], [1]]))) ty_cycles, ty_max = symm.findSiteCycles(ty_fn, model.geometry) ty_op_full = model.get_xform_op(ty_cycles) ty_op = model.n_projector.dot( ty_op_full.dot(model.n_projector.conj().transpose())) symm_projs = symm.getC4V_and_3byb3(rot_op, refl_op, tx_op, ty_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = model.createH(projector=proj.dot(model.n_projector)) eig_vals_sector, eig_vects_sector = model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 10)
def test_translational_symm_3x3(self): """ Test translational symmetry by diagonalizing random 3x3 spin system with and without it :return: """ cluster = geom.Geometry.createSquareGeometry(3, 3, 0, 0, bc1_open=False, bc2_open=False) jx = np.random.rand() jy = np.random.rand() jz = np.random.rand() hx = np.random.rand() hy = np.random.rand() hz = np.random.rand() # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx, jy, jz, hx, hy, hz, use_ryd_detunes=0) hamiltonian_full = spin_model.createH() eig_vals_full, eig_vects_full = spin_model.diagH(hamiltonian_full) xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, max_cycle_len_translx = symm.findSiteCycles( xtransl_fn, spin_model.geometry) xtransl_op = spin_model.get_xform_op(xtransl_cycles) xtransl_op = xtransl_op # y-translations ytransl_fn = symm.getTranslFn(np.array([[0], [1]])) ytransl_cycles, max_cycle_len_transly = symm.findSiteCycles( ytransl_fn, spin_model.geometry) ytransl_op = spin_model.get_xform_op(ytransl_cycles) ytransl_op = ytransl_op symm_projs, kxs, kys = symm.get2DTranslationProjectors( xtransl_op, max_cycle_len_translx, ytransl_op, max_cycle_len_transly) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = spin_model.createH(projector=proj) eig_vals_sector, eig_vects_sector = spin_model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 10)
def test_d4_symm(self): """ Test d4 symmetry by diagonalizing random spin system with and without it :return: """ cluster = geom.Geometry.createSquareGeometry(3, 3, 0, 0, bc1_open=False, bc2_open=False) jx = np.random.rand() jy = np.random.rand() jz = np.random.rand() hx = np.random.rand() hy = np.random.rand() hz = np.random.rand() # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx, jy, jz, hx, hy, hz, use_ryd_detunes=0) hamiltonian_full = spin_model.createH() eig_vals_full, eig_vects_full = spin_model.diagH(hamiltonian_full) # use rotationl symmetry cx, cy = spin_model.geometry.get_center_of_mass() rot_fn = symm.getRotFn(4, cx=cx, cy=cy) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, spin_model.geometry) rot_op = spin_model.get_xform_op(rot_cycles) refl_fn = symm.getReflFn(np.array([0, 1]), cx=cx, cy=cy) refl_cycles, max_cycle_len_ref = symm.findSiteCycles( refl_fn, spin_model.geometry) refl_op = spin_model.get_xform_op(refl_cycles) symm_projs = symm.getD4Projectors(rot_op, refl_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = spin_model.createH(projector=proj) eig_vals_sector, eig_vects_sector = spin_model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 10)
def test_four_by_four_xy_model_symm(self): """ Test exact diagonalization of 4x4 xy model with periodic boundary conditions reference: J. Phys. A: Math. Gen 32 51 (1999). "Finite-size scaling in the spin-1/2 xy model on a square lattice" by C J Hamer et al """ cluster = geom.Geometry.createSquareGeometry(4, 4, 0, 0, bc1_open=False, bc2_open=False) # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx=-1.0, jy=-1.0, jz=0.0, hx=0.0, hy=0.0, hz=0.0, use_ryd_detunes=0) # x-translations xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, max_cycle_len_translx = symm.findSiteCycles( xtransl_fn, spin_model.geometry) xtransl_op = spin_model.get_xform_op(xtransl_cycles) xtransl_op = xtransl_op # y-translations ytransl_fn = symm.getTranslFn(np.array([[0], [1]])) ytransl_cycles, max_cycle_len_transly = symm.findSiteCycles( ytransl_fn, spin_model.geometry) ytransl_op = spin_model.get_xform_op(ytransl_cycles) ytransl_op = ytransl_op symm_projs, kxs, kys = symm.get2DTranslationProjectors( xtransl_op, max_cycle_len_translx, ytransl_op, max_cycle_len_transly) eig_vals_sectors = [] hfull = spin_model.createH() for ii, proj in enumerate(symm_projs): h_sector = proj * hfull * proj.conj().transpose() eig_vals_sector, eig_vects_sector = spin_model.diagH( h_sector, print_results=True) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) min_eig_per_site = eigs_all_sectors[0] / spin_model.geometry.nsites self.assertAlmostEqual(min_eig_per_site, -1.124972697436, 12)
def test_d2_symmetry_3by3(self): """ Test D2 symmetry (generated by 180 degree rotation and a reflection) on a 3x3 Hubbard cluster with open boundary conditions. :return: """ # todo: do all number sectors U = 20 * (np.random.rand() - 0.5) t = np.random.rand() gm = geom.Geometry.createSquareGeometry(3, 3, 0, 0, bc1_open=False, bc2_open=False) model = ed_fermions.fermions(gm, U, t, ns=np.array([3, 4]), nspecies=2) # no symmetry hamiltonian_full = model.createH(projector=model.n_projector) eig_vals_full, eig_vects_full = model.diagH(hamiltonian_full) # rotational symmetry cx, cy = model.geometry.get_center_of_mass() rot_fn = symm.getRotFn(2, cx=cx, cy=cy) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, model.geometry) rot_op_full = model.get_xform_op(rot_cycles) rot_op = model.n_projector.dot( rot_op_full.dot(model.n_projector.conj().transpose())) # reflection symmetry refl_fn = symm.getReflFn(np.array([[0], [1]]), cx=cx, cy=cy) refl_cycles, max_cycle_len_refl = symm.findSiteCycles( refl_fn, model.geometry) refl_op_full = model.get_xform_op(refl_cycles) refl_op = model.n_projector.dot( refl_op_full.dot(model.n_projector.conj().transpose())) symm_projs = symm.getD2Projectors(rot_op, refl_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = model.createH(projector=proj.dot(model.n_projector)) eig_vals_sector, eig_vects_sector = model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 10)
def test_d3_symm_6sites(self): adjacency_mat = np.array([[0, 1, 0, 1, 0, 0], [1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [1, 1, 0, 0, 1, 1], [0, 1, 1, 1, 0, 1], [0, 0, 0, 1, 1, 0]]) cluster = geom.Geometry.createNonPeriodicGeometry( xlocs=(0, 1, 2, 0.5, 1.5, 1), ylocs=(0, 0, 0, np.sqrt(3) / 2, np.sqrt(3) / 2, np.sqrt(3)), adjacency_mat=adjacency_mat) jx = np.random.rand() jy = np.random.rand() jz = np.random.rand() hx = np.random.rand() hy = np.random.rand() hz = np.random.rand() # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx, jy, jz, hx, hy, hz, use_ryd_detunes=0) hamiltonian_full = spin_model.createH() eig_vals_full, eig_vects_full = spin_model.diagH(hamiltonian_full) # use rotationl symmetry # triangle center cx, cy = 1, 1 / np.sqrt(3) rot_fn = symm.getRotFn(3, cx=cx, cy=cy) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, spin_model.geometry) rot_op = spin_model.get_xform_op(rot_cycles) refl_fn = symm.getReflFn(np.array([0, 1]), cx=cx, cy=cy) refl_cycles, max_cycle_len_ref = symm.findSiteCycles( refl_fn, spin_model.geometry) refl_op = spin_model.get_xform_op(refl_cycles) symm_projs = symm.getD3Projectors(rot_op, refl_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = spin_model.createH(projector=proj) eig_vals_sector, eig_vects_sector = spin_model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 12)
def test_d3_symm_3sites(self): """ Test d3 symmetry by diagonalizing random spin system with and without it :return: """ # adjacency_mat = np.array([[0, 1, 1], [1, 0, 1], [1, 1, 0]]) # cluster = geom.Geometry.createNonPeriodicGeometry(xlocs=(0,0.5,1), ylocs=(0,np.sqrt(3)/2,0), adjacency_mat=adjacency_mat) cluster = geom.Geometry.createRegularPolygonGeometry(3) jx = np.random.rand() jy = np.random.rand() jz = np.random.rand() hx = np.random.rand() hy = np.random.rand() hz = np.random.rand() # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx, jy, jz, hx, hy, hz, use_ryd_detunes=0) hamiltonian_full = spin_model.createH() eig_vals_full, eig_vects_full = spin_model.diagH(hamiltonian_full) # use rotationl symmetry rot_fn = symm.getRotFn(3) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, spin_model.geometry) rot_op = spin_model.get_xform_op(rot_cycles) refl_fn = symm.getReflFn(np.array([0, 1])) refl_cycles, max_cycle_len_ref = symm.findSiteCycles( refl_fn, spin_model.geometry) refl_op = spin_model.get_xform_op(refl_cycles) symm_projs = symm.getD3Projectors(rot_op, refl_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = spin_model.createH(projector=proj) eig_vals_sector, eig_vects_sector = spin_model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 12)
def test_translation_symmetry_3by3(self): """ Test translational symmetry for a 3x3 Hubbard system with periodic boundary conditions :return: """ U = 20 * (np.random.rand() - 0.5) t = np.random.rand() gm = geom.Geometry.createSquareGeometry(3, 3, 0, 0, bc1_open=False, bc2_open=False) hubbard = ed_fermions.fermions(gm, U, t, ns=np.array([1, 1])) # no symmetry hamiltonian_full = hubbard.createH(projector=hubbard.n_projector) eig_vals_full, eig_vects_full = hubbard.diagH(hamiltonian_full) # with symmetry xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, max_cycle_len_translx = symm.findSiteCycles( xtransl_fn, hubbard.geometry) xtransl_op = hubbard.n_projector * hubbard.get_xform_op( xtransl_cycles) * hubbard.n_projector.conj().transpose() # y-translations ytransl_fn = symm.getTranslFn(np.array([[0], [1]])) ytransl_cycles, max_cycle_len_transly = symm.findSiteCycles( ytransl_fn, hubbard.geometry) ytransl_op = hubbard.n_projector * hubbard.get_xform_op( ytransl_cycles) * hubbard.n_projector.conj().transpose() symm_projs, kxs, kys = symm.get2DTranslationProjectors( xtransl_op, max_cycle_len_translx, ytransl_op, max_cycle_len_transly) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = hubbard.createH(projector=proj.dot(hubbard.n_projector)) eig_vals_sector, eig_vects_sector = hubbard.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 10)
def test_d7_symm_7sites(self): cluster = geom.Geometry.createRegularPolygonGeometry(7) jx = np.random.rand() jy = np.random.rand() jz = np.random.rand() hx = np.random.rand() hy = np.random.rand() hz = np.random.rand() # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx, jy, jz, hx, hy, hz, use_ryd_detunes=0) hamiltonian_full = spin_model.createH() eig_vals_full, eig_vects_full = spin_model.diagH(hamiltonian_full) # use rotationl symmetry rot_fn = symm.getRotFn(7) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, spin_model.geometry) rot_op = spin_model.get_xform_op(rot_cycles) refl_fn = symm.getReflFn(np.array([0, 1])) refl_cycles, max_cycle_len_ref = symm.findSiteCycles( refl_fn, spin_model.geometry) refl_op = spin_model.get_xform_op(refl_cycles) symm_projs = symm.getD6Projectors(rot_op, refl_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = spin_model.createH(projector=proj) eig_vals_sector, eig_vects_sector = spin_model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 14)
def test_findSiteCycles(self): """ Test function which finds cyclese of sites under repeated transformations :return: """ geom = ed_geometry.Geometry.createSquareGeometry(4, 4, 0, 0, 1, 1) cx, cy = geom.get_center_of_mass() permutation = geom.get_sorting_permutation('top_alternating') geom.permute_sites(permutation) rot_fn = ed_symmetry.getRotFn(4, cx=cx, cy=cy) cycles, max_cycle_len = ed_symmetry.findSiteCycles(rot_fn, geom) cycles_expected = [[0, 15, 12, 3], [1, 8, 13, 4], [2, 7, 14, 11], [5, 6, 9, 10]] self.assertEqual(max_cycle_len, 4) self.assertEqual(cycles, cycles_expected)
with np.errstate(divide="ignore"): betas = np.divide(1, temps) betas[temps == 0] = np.inf # ints = np.linspace(0, 5, 60) * t ints = np.linspace(0, 5, 5) * t ints = np.concatenate((-np.flip(ints, axis=0), ints[1:])) print("spinless fermions with nearest neighbor interactions") print("nsites = %d, n interactions = %d, ntemps = %d" % (nsites, len(ints), len(temps))) gm = geom.Geometry.createSquareGeometry(nsites, 1, 0, 0, bc1_open=False, bc2_open=True) # translational symmetry xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, max_cycle_len_translx = symm.findSiteCycles(xtransl_fn, gm) # get all symmetry operators at the beginning n_list = np.array([]) k_list = np.array([]) projector_list = [] sf = ed_fermions.fermions(gm, 0, t, us_same_species=0, potentials=0, nspecies=1) # number subspace projectors n_species_op = sf.get_sum_op(sf.n_op, 0, format="boson") n_projs, ns = sf.get_subspace_projs(n_species_op, print_results=False) # translation op xtransl_op_full = sf.get_xform_op(xtransl_cycles) # get all projectors
import ed_geometry as geom import ed_spins as spins import ed_symmetry as symm # set up system J = 1 gm = geom.Geometry.createSquareGeometry(10, 1, 0, 0, bc1_open=False, bc2_open=True) ss = spins.spinSystem(gm, jx=J, jy=J, jz=J) # total sz and spin flip op sz_op = ss.get_sum_op(ss.sz) sz_flip_op = ss.get_swap_up_down_op() # translation operators xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, ntranslations = symm.findSiteCycles(xtransl_fn, ss.geometry) tx_op = ss.get_xform_op(xtransl_cycles) # inversion op cx, cy = ss.geometry.get_center_of_mass() inv_fn = symm.getInversionFn(cx, cy) inv_cycles, _ = symm.findSiteCycles(inv_fn, ss.geometry) inv_op = ss.get_xform_op(inv_cycles) # get projectors on mz subspace mz_projs, mzs = ss.get_subspace_projs(sz_op.tocsr()) # sequentially get projectors on mz the x-translation (then spin flip for mz=0 sector only) projs = [] mzs_all = [] kxs_all = []
def test_full_symm_3x3(self): cluster = geom.Geometry.createSquareGeometry(3, 3, 0, 0, bc1_open=False, bc2_open=False) jx = np.random.rand() jy = np.random.rand() jz = np.random.rand() hx = np.random.rand() hy = np.random.rand() hz = np.random.rand() # diagonalize full hamiltonian spin_model = tvi.spinSystem(cluster, jx, jy, jz, hx, hy, hz, use_ryd_detunes=0) hamiltonian_full = spin_model.createH() eig_vals_full, eig_vects_full = spin_model.diagH(hamiltonian_full) xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, max_cycle_len_translx = symm.findSiteCycles( xtransl_fn, spin_model.geometry) tx_op = spin_model.get_xform_op(xtransl_cycles) # y-translations ytransl_fn = symm.getTranslFn(np.array([[0], [1]])) ytransl_cycles, max_cycle_len_transly = symm.findSiteCycles( ytransl_fn, spin_model.geometry) ty_op = spin_model.get_xform_op(ytransl_cycles) # rotation cx, cy = spin_model.geometry.get_center_of_mass() rot_fn = symm.getRotFn(4, cx=cx, cy=cy) rot_cycles, max_cycle_len_rot = symm.findSiteCycles( rot_fn, spin_model.geometry) rot_op = spin_model.get_xform_op(rot_cycles) # reflection # reflection about y-axis refl_fn = symm.getReflFn(np.array([0, 1]), cx=cx, cy=cy) refl_cycles, max_cycle_len_refl = symm.findSiteCycles( refl_fn, spin_model.geometry) refl_op = spin_model.get_xform_op(refl_cycles) symm_projs = symm.getC4V_and_3byb3(rot_op, refl_op, tx_op, ty_op) eig_vals_sectors = [] for ii, proj in enumerate(symm_projs): h_sector = spin_model.createH(projector=proj) eig_vals_sector, eig_vects_sector = spin_model.diagH(h_sector) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) max_diff = np.abs(eig_vals_full - eigs_all_sectors).max() self.assertAlmostEqual(max_diff, 0, 10)
def test_ising_model_5x5(self): """ Test diagonalization of 5x5 ising model with periodic boundary conditions. reference: J. Phys. A: Math. Gen 33 6683 (2000). "Finite-size scaling in the transverse Ising model on a square lattice" by C J Hamer https://doi.org/10.1088/0305-4470/33/38/303 :return: """ cluster = geom.Geometry.createSquareGeometry(5, 5, 0, 0, bc1_open=False, bc2_open=False) # paper definition of hamiltonian differs by a factor of two from mine jz_critical = -2 * 0.32669593806 h_transverse = 2 * 1.0 spin_model = tvi.spinSystem(cluster, jx=0.0, jy=0.0, jz=jz_critical, hx=h_transverse, hy=0.0, hz=0.0, use_ryd_detunes=0) # symmetry swapping up/down spins spin_swap_op = spin_model.get_swap_up_down_op() # x-translations xtransl_fn = symm.getTranslFn(np.array([[1], [0]])) xtransl_cycles, max_cycle_len_translx = symm.findSiteCycles( xtransl_fn, spin_model.geometry) xtransl_op = spin_model.get_xform_op(xtransl_cycles) xtransl_op = xtransl_op # y-translations ytransl_fn = symm.getTranslFn(np.array([[0], [1]])) ytransl_cycles, max_cycle_len_transly = symm.findSiteCycles( ytransl_fn, spin_model.geometry) ytransl_op = spin_model.get_xform_op(ytransl_cycles) ytransl_op = ytransl_op symm_projs, kxs, kys = symm.get2DTranslationProjectors( xtransl_op, max_cycle_len_translx, ytransl_op, max_cycle_len_transly) eig_vals_sectors = [] full_proj_list = [] hfull = spin_model.createH() for ii, proj in enumerate(symm_projs): spin_swap_proj_op = proj * spin_swap_op * proj.conj().transpose() # char_table = np.array([[1, 1], [1, -1]]) # ccs = [[sp.eye(spin_swap_proj_op.shape[0], format="csr")], [spin_swap_proj_op]] swap_projs, phase = symm.getZnProjectors(spin_swap_proj_op, 2) for jj, sproj in enumerate(swap_projs): full_proj_list.append(sproj * proj) h_sector = sproj * proj * hfull * proj.conj().transpose( ) * sproj.conj().transpose() eig_vals_sector, eig_vects_sector = spin_model.diagH( h_sector, print_results=True) eig_vals_sectors.append(eig_vals_sector) # why only accurate to 10 decimal places? eigs_all_sectors = np.sort(np.concatenate(eig_vals_sectors)) min_eig_per_site = eigs_all_sectors[0] / spin_model.geometry.nsites + 1 self.assertAlmostEqual(min_eig_per_site, -0.064637823298, 11)
bc1_open=False, bc2_open=False) parent_geometry.permute_sites(parent_geometry.get_sorting_permutation()) model = tvi.spinSystem(parent_geometry, jx, jy, jz, hx, hy, hz, use_ryd_detunes=False) # x-translation tx_fn = symm.getTranslFn(np.array([[1], [0]])) tx_cycles, ntx = symm.findSiteCycles(tx_fn, model.geometry) tx_op = model.get_xform_op(tx_cycles) # y-translations ty_fn = symm.getTranslFn(np.array([[0], [1]])) ty_cycles, nty = symm.findSiteCycles(ty_fn, model.geometry) ty_op = model.get_xform_op(ty_cycles) # symmetry projectors symm_projs, kxs, kys = symm.get2DTranslationProjectors(tx_op, ntx, ty_op, nty, print_results=True) # Calculate eigenvalues and expectation values for each symmetry sector