def test_eig3(self, setup): setup.HS.construct([(0.1, 1.5), ((1., 1.), (0.1, 0.1))]) BS = BandStructure(setup.HS, [[0, 0, 0], [0.5, 0.5, 0]], 10) eigs = BS.asarray().eigh() assert len(BS) == eigs.shape[0] assert len(setup.HS) == eigs.shape[1] eig2 = np.array([eig for eig in BS.asyield().eigh()]) assert np.allclose(eigs, eig2) setup.HS.empty()
def finite_bands(dev, pot, SF): H = Hamiltonian(dev) R = np.array([1.4, 1.44, 3.33, 3.37]) * SF t = (0, 3.16, 0, 0.39) H.construct([R, t]) energies = pot.pot_func(dev.xyz) for i in dev.iter(): H[i, i] = energies[i] #band = BandStructure(H, [[-np.pi / 2.46, 0, 0], [np.pi / 2.46, 0, 0]], # 400, [r'$-\pi$',r'$\pi$']) band = BandStructure( H, [[0, 0, 0], [0, 0.5, 0], [1 / 3, 2 / 3, 0], [0, 0, 0]], 400, [r'$\Gamma$', r'$M$', r'$K$', r'$\Gamma$']) bnds = band.asarray().eigh() lk, kt, kl = band.lineark(True) fig = plt.figure() ax = fig.add_subplot(111) for bnd in bnds.T: ax.plot(lk, bnd) plt.xticks(kt, kl) plt.xlim(0, lk[-1]) #plt.ylim([0, 0.055]) plt.ylim([-3, 3]) #ax.set_ylim(-.1,.1) plt.show()