def test_real_space_HS(setup, k_axes, semi_axis, trs, bz, unfold): if k_axes == semi_axis: return RSE = RealSpaceSE(setup.HS, semi_axis, k_axes, (unfold, unfold, unfold)) RSE.set_options(dk=100, trs=trs, bz=bz) RSE.initialize() RSE.green(0.1)
def test_real_space_H(setup, k_axis, semi_axis, trs, bz, unfold): if k_axis == semi_axis: return RSE = RealSpaceSE(setup.H, (unfold, unfold, 1)) RSE.update_option(semi_axis=semi_axis, k_axis=k_axis, dk=100, trs=trs, bz=bz) # Initialize and print with warnings.catch_warnings(): warnings.simplefilter('ignore') RSE.initialize() RSE.green(0.1) RSE.self_energy(0.1)
def test_real_space_H_dtype(setup): RSE = RealSpaceSE(setup.H, (2, 2, 1)) RSE.update_option(semi_axis=0, k_axis=1, dk=100) with warnings.catch_warnings(): warnings.simplefilter('ignore') RSE.initialize() g64 = RSE.green(0.1, dtype=np.complex64) g128 = RSE.green(0.1, dtype=np.complex128) assert g64.dtype == np.complex64 assert g128.dtype == np.complex128 assert np.allclose(g64, g128, atol=1.e-4) s64 = RSE.self_energy(0.1, dtype=np.complex64) s128 = RSE.self_energy(0.1, dtype=np.complex128) assert s64.dtype == np.complex64 assert s128.dtype == np.complex128 assert np.allclose(s64, s128, atol=1e-2)
def test_real_space_H_3d(): sc = SuperCell(1., nsc=[3] * 3) H = Atom(Z=1, R=[1.001]) geom = Geometry([0] * 3, atoms=H, sc=sc) H = Hamiltonian(geom) H.construct(([0.001, 1.01], (0, -1))) RSE = RealSpaceSE(H, 0, [1, 2], (3, 4, 2)) RSE.set_options(dk=100, trs=True) RSE.initialize() nk = np.ones(3, np.int32) nk[[1, 2]] = 23 bz = BrillouinZone(H, nk) RSE.set_options(bz=bz) RSE.green(0.1) # Since there is only 2 repetitions along one direction we will have the full matrix # coupled! assert np.allclose(RSE.self_energy(0.1), RSE.self_energy(0.1, coupling=True)) assert np.allclose(RSE.self_energy(0.1, bulk=True), RSE.self_energy(0.1, bulk=True, coupling=True))