Esempio n. 1
0
    def test_static_constructors(self):
        kpoints = Kpoints.gamma_automatic([3, 3, 3], [0, 0, 0])
        self.assertEqual(kpoints.style, "Gamma")
        self.assertEqual(kpoints.kpts, [[3, 3, 3]])
        kpoints = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0])
        self.assertEqual(kpoints.style, "Monkhorst")
        self.assertEqual(kpoints.kpts, [[2, 2, 2]])
        kpoints = Kpoints.automatic(100)
        self.assertEqual(kpoints.style, "Automatic")
        self.assertEqual(kpoints.kpts, [[100]])
        filepath = os.path.join(test_dir, 'POSCAR')
        poscar = Poscar.from_file(filepath)
        kpoints = Kpoints.automatic_density(poscar.structure, 500)
        self.assertEqual(kpoints.kpts, [[2, 4, 4]])
        self.assertEqual(kpoints.style, "Monkhorst")
        kpoints = Kpoints.automatic_density(poscar.structure, 500, True)
        self.assertEqual(kpoints.style, "Gamma")
        kpoints = Kpoints.automatic_density_by_vol(poscar.structure, 1000)
        self.assertEqual(kpoints.kpts, [[6, 11, 13]])
        self.assertEqual(kpoints.style, "Gamma")

        s = poscar.structure
        s.make_supercell(3)
        kpoints = Kpoints.automatic_density(s, 500)
        self.assertEqual(kpoints.kpts, [[1, 1, 1]])
        self.assertEqual(kpoints.style, "Gamma")
Esempio n. 2
0
 def test_static_constructors(self):
     kpoints = Kpoints.gamma_automatic([3, 3, 3], [0, 0, 0])
     self.assertEqual(kpoints.style, "Gamma")
     self.assertEqual(kpoints.kpts, [[3, 3, 3]])
     kpoints = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0])
     self.assertEqual(kpoints.style, "Monkhorst")
     self.assertEqual(kpoints.kpts, [[2, 2, 2]])
     kpoints = Kpoints.automatic(100)
     self.assertEqual(kpoints.style, "Automatic")
     self.assertEqual(kpoints.kpts, [[100]])
     filepath = os.path.join(test_dir, 'POSCAR')
     poscar = Poscar.from_file(filepath)
     kpoints = Kpoints.automatic_density(poscar.structure, 500)
     self.assertEqual(kpoints.kpts, [[2, 4, 4]])
     self.assertEqual(kpoints.style, "Monkhorst")
     kpoints = Kpoints.automatic_density(poscar.structure, 500, True)
     self.assertEqual(kpoints.style, "Gamma")
     kpoints = Kpoints.automatic_density_by_vol(poscar.structure, 1000)
     self.assertEqual(kpoints.kpts, [[8, 11, 15]])
     self.assertEqual(kpoints.style, "Gamma")