class BandstructureLoaderTest(unittest.TestCase): def setUp(self): bs = loadfn(os.path.join(test_dir, "PbTe_bandstructure.json")) bs_sp = loadfn(os.path.join(test_dir, "N2_bandstructure.json")) self.loader = BandstructureLoader(bs, vrun.structures[-1]) self.assertIsNotNone(self.loader) self.loader_sp_up = BandstructureLoader(bs_sp, vrun_sp.structures[-1],spin=1) self.loader_sp_dn = BandstructureLoader(bs_sp, vrun_sp.structures[-1],spin=-1) self.assertTupleEqual(self.loader_sp_up.ebands.shape, (12, 198)) self.assertTupleEqual(self.loader_sp_dn.ebands.shape, (12, 198)) self.assertIsNotNone(self.loader_sp_dn) self.assertIsNotNone(self.loader_sp_up) warnings.simplefilter("ignore") def tearDown(self): warnings.simplefilter("default") def test_properties(self): self.assertTupleEqual(self.loader.ebands.shape, (20, 120)) self.assertAlmostEqual(self.loader.fermi, 0.185266535678, 5) self.assertAlmostEqual(self.loader.structure.lattice.a, 4.64303565932548, 5) def test_get_volume(self): self.assertAlmostEqual(self.loader.get_volume(), 477.6256714925874, 5) def test_set_upper_lower_bands(self): min_bnd = min(self.loader_sp_up.ebands.min(),self.loader_sp_dn.ebands.min()) max_bnd = max(self.loader_sp_up.ebands.max(),self.loader_sp_dn.ebands.max()) self.loader_sp_up.set_upper_lower_bands(min_bnd,max_bnd) self.loader_sp_dn.set_upper_lower_bands(min_bnd,max_bnd) self.assertTupleEqual(self.loader_sp_up.ebands.shape, (14, 198)) self.assertTupleEqual(self.loader_sp_dn.ebands.shape, (14, 198))
class BandstructureLoaderTest(unittest.TestCase): def setUp(self): bs = loadfn(os.path.join(test_dir, "PbTe_bandstructure.json")) bs_sp = loadfn(os.path.join(test_dir, "N2_bandstructure.json")) self.loader = BandstructureLoader(bs, vrun.structures[-1]) self.assertIsNotNone(self.loader) self.loader_sp_up = BandstructureLoader(bs_sp, vrun_sp.structures[-1],spin=1) self.loader_sp_dn = BandstructureLoader(bs_sp, vrun_sp.structures[-1],spin=-1) self.assertTupleEqual(self.loader_sp_up.ebands.shape, (12, 198)) self.assertTupleEqual(self.loader_sp_dn.ebands.shape, (12, 198)) self.assertIsNotNone(self.loader_sp_dn) self.assertIsNotNone(self.loader_sp_up) warnings.simplefilter("ignore") def tearDown(self): warnings.resetwarnings() def test_properties(self): self.assertTupleEqual(self.loader.ebands.shape, (20, 120)) self.assertAlmostEqual(self.loader.fermi, 0.185266535678, 5) self.assertAlmostEqual(self.loader.structure.lattice.a, 4.64303565932548, 5) def test_get_volume(self): self.assertAlmostEqual(self.loader.get_volume(), 477.6256714925874, 5) def test_set_upper_lower_bands(self): min_bnd = min(self.loader_sp_up.ebands.min(),self.loader_sp_dn.ebands.min()) max_bnd = max(self.loader_sp_up.ebands.max(),self.loader_sp_dn.ebands.max()) self.loader_sp_up.set_upper_lower_bands(min_bnd,max_bnd) self.loader_sp_dn.set_upper_lower_bands(min_bnd,max_bnd) self.assertTupleEqual(self.loader_sp_up.ebands.shape, (14, 198)) self.assertTupleEqual(self.loader_sp_dn.ebands.shape, (14, 198))
class BandstructureLoaderTest(unittest.TestCase): def setUp(self): bs = loadfn(os.path.join(test_dir, "PbTe_bandstructure.json")) self.loader = BandstructureLoader(bs, vrun.structures[-1]) self.assertIsNotNone(self.loader) warnings.simplefilter("ignore") def tearDown(self): warnings.resetwarnings() def test_properties(self): self.assertTupleEqual(self.loader.ebands.shape, (20, 120)) self.assertAlmostEqual(self.loader.fermi, 0.185266535678, 5) self.assertAlmostEqual(self.loader.structure.lattice.a, 4.64303565932548, 5) def test_get_volume(self): self.assertAlmostEqual(self.loader.get_volume(), 477.6256714925874, 5)
class BandstructureLoaderTest(unittest.TestCase): def setUp(self): self.loader = BandstructureLoader(bs, vrun.structures[-1]) self.assertIsNotNone(self.loader) self.loader_sp = BandstructureLoader(bs_sp, vrun_sp.structures[-1]) self.assertIsNotNone(self.loader_sp) self.assertTupleEqual(self.loader_sp.ebands_all.shape, (24, 198)) warnings.simplefilter("ignore") def tearDown(self): warnings.simplefilter("default") def test_properties(self): self.assertTupleEqual(self.loader.ebands_all.shape, (20, 120)) self.assertAlmostEqual(self.loader.fermi, 0.185266535678, 5) self.assertAlmostEqual(self.loader.structure.lattice.a, 4.64303565932548, 5) def test_get_volume(self): self.assertAlmostEqual(self.loader.get_volume(), 477.6256714925874, 5)