def test_sancho_non_orthogonal(setup): SE = RecursiveSI(setup.HS, '-A') s64 = SE.self_energy(0.1, dtype=np.complex64) s128 = SE.self_energy(0.1) assert s64.dtype == np.complex64 assert s128.dtype == np.complex128 assert np.allclose(s64, s128)
def test_real_space_H_k_trs(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc(b=1) RSI = RealSpaceSI(semi, surf, 0, (3, 1, 3)) RSI.set_options(dk=100, trs=True, bz=None) RSI.initialize() RSI.green(0.1, [0, 0, 0.1], dtype=np.complex128)
def test_real_space_HS(setup, k_axes, trs, bz, unfold, bulk, coupling): semi = RecursiveSI(setup.HS, '-B') surf = setup.HS.tile(4, 1) surf.set_nsc(b=1) RSI = RealSpaceSI(semi, surf, k_axes, (unfold, 1, unfold)) RSI.set_options(dk=100, trs=trs, bz=bz) RSI.initialize() RSI.self_energy(0.1, bulk=bulk, coupling=coupling)
def test_sancho_green(setup): SL = RecursiveSI(setup.HS, '-A') SR = RecursiveSI(setup.HS, '+A') E = 0.1 k = [0, 0.13, 0] # Check that left/right are different L_SE = SL.self_energy(E, k, bulk=True) R_SE = SR.self_energy(E, k) g = np.linalg.inv(L_SE - R_SE) G = SL.green(E, k) assert np.allclose(g, G) assert np.allclose(SL.green(E, k), SR.green(E, k))
def test_real_space_SI_H_test(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc(b=1) RSI = RealSpaceSI(semi, surf, 0, (3, 1, 3)) RSI.set_options(dk=100, trs=False, bz=None) RSI.initialize() RSI.green(0.1, [0, 0, 0.1], dtype=np.complex128) RSI.self_energy(0.1, [0, 0, 0.1]) RSI.clear()
def test_sancho_bloch_zero_off_diag(setup): # check whether the bloch-expansion with 0 transverse # connections returns a block-diagonal matrix H = setup.H.copy() # disconnect transverse directions H.set_nsc(b=1) no = len(H) SE = RecursiveSI(H, '+A') for nb in [2, 4, 5]: bloch = Bloch(1, nb, 1) for E in [-0.1, 0.2, 0.4, -0.5]: se = bloch(SE.self_energy, [0.2, 0.2, 0.2], E=E) for b in range(1, nb): off = b*no assert np.allclose(se[:no, :no], se[off:off+no, off:off+no]) se[off:off+no, off:off+no] = 0. se[:no, :no] = 0. assert np.allclose(se, 0.)
def test_sancho_lr(setup): SL = RecursiveSI(setup.HS, '-A') SR = RecursiveSI(setup.HS, '+A') E = 0.1 k = [0, 0.13, 0] # Check that left/right are different L_SE = SL.self_energy(E, k) R_SE = SR.self_energy(E, k) assert not np.allclose(L_SE, R_SE) LB_SEL, LB_SER = SL.self_energy_lr(E, k) RB_SEL, RB_SER = SR.self_energy_lr(E, k) assert np.allclose(LB_SEL, L_SE) assert np.allclose(LB_SER, R_SE) assert np.allclose(RB_SEL, L_SE) assert np.allclose(RB_SER, R_SE) LB_SEL, LB_SER = SL.self_energy_lr(E, k, bulk=True) L_SE = SL.self_energy(E, k, bulk=True) R_SE = SR.self_energy(E, k, bulk=True) assert not np.allclose(L_SE, R_SE) RB_SEL, RB_SER = SR.self_energy_lr(E, k, bulk=True) assert np.allclose(LB_SEL, L_SE) assert np.allclose(LB_SER, R_SE) assert np.allclose(RB_SEL, L_SE) assert np.allclose(RB_SER, R_SE)
def test_sancho_scattering_matrix(setup): SE = RecursiveSI(setup.HS, '-A') assert np.allclose(SE.scattering_matrix(0.1), SE.se2scat(SE.self_energy(0.1)))
def test_sancho_non_orthogonal(setup): SE = RecursiveSI(setup.HS, '-A') assert not np.allclose(SE.self_energy(0.1), SE.self_energy(0.1, bulk=True))
def test_real_space_SI_fail_unfold_in_semi(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc(b=1) RSI = RealSpaceSI(semi, surf, 0, (2, 2, 1))
def test_real_space_SI_fail_k_no_nsc(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc([1] * 3) RSI = RealSpaceSI(semi, surf, 0, (2, 1, 1))
def test_real_space_SI_fail_semi_in_k(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc(b=1) RSI = RealSpaceSI(semi, surf, [0, 1], (2, 1, 1))
def test_real_space_SI_fail_unfold_in_semi(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc(b=1) with pytest.raises(ValueError): RSI = RealSpaceSI(semi, surf, 0, (2, 2, 1))
def test_real_space_SI_fail_k_no_nsc(setup): semi = RecursiveSI(setup.H, '-B') surf = setup.H.tile(4, 1) surf.set_nsc([1] * 3) with pytest.raises(ValueError): RSI = RealSpaceSI(semi, surf, 0, (2, 1, 1))
def test_sancho2(self, setup): SE = RecursiveSI(setup.HS, '+A') SE.self_energy(0.1)