Example #1
0
class MITNEBVaspInputSetTest(unittest.TestCase):

    def setUp(self):
        filepath = os.path.join(test_dir, 'POSCAR')
        poscar = Poscar.from_file(filepath)
        self.struct = poscar.structure
        self.vis = MITNEBVaspInputSet(nimages=10, hubbard_off=True)

    def test_get_potcar_symbols(self):
        syms = self.vis.get_potcar_symbols(self.struct)
        self.assertEqual(syms, ['Fe', 'P', 'O'])

    def test_get_incar(self):
        incar = self.vis.get_incar(self.struct)
        self.assertNotIn("LDAUU", incar)
        self.assertAlmostEqual(incar['EDIFF'], 0.00005)

    def test_get_kpoints(self):
        kpoints = self.vis.get_kpoints(self.struct)
        self.assertEqual(kpoints.kpts, [[2, 4, 6]])
        self.assertEqual(kpoints.style, Kpoints.supported_modes.Monkhorst)

    def test_to_from_dict(self):
        d = self.vis.as_dict()
        v = dec.process_decoded(d)
        self.assertEqual(v.incar_settings["IMAGES"], 10)

    def test_write_inputs(self):
        c1 = [[0.5] * 3, [0.9] * 3]
        c2 = [[0.5] * 3, [0.9, 0.1, 0.1]]
        s1 = Structure(Lattice.cubic(5), ['Si', 'Si'], c1)
        s2 = Structure(Lattice.cubic(5), ['Si', 'Si'], c2)
        structs = []
        for s in s1.interpolate(s2, 3, pbc=True):
            structs.append(Structure.from_sites(s.sites,
                                        to_unit_cell=True))

        fc = self.vis._process_structures(structs)[2].frac_coords
        self.assertTrue(np.allclose(fc, [[0.5]*3,[0.9, 1.033333, 1.0333333]]))
Example #2
0
class MITNEBVaspInputSetTest(unittest.TestCase):
    def setUp(self):
        filepath = os.path.join(test_dir, 'POSCAR')
        poscar = Poscar.from_file(filepath)
        self.struct = poscar.structure
        self.vis = MITNEBVaspInputSet(nimages=10, hubbard_off=True)

    def test_get_potcar_symbols(self):
        syms = self.vis.get_potcar_symbols(self.struct)
        self.assertEqual(syms, ['Fe', 'P', 'O'])

    def test_get_incar(self):
        incar = self.vis.get_incar(self.struct)
        self.assertNotIn("LDAUU", incar)
        self.assertAlmostEqual(incar['EDIFF'], 0.00005)

    def test_get_kpoints(self):
        kpoints = self.vis.get_kpoints(self.struct)
        self.assertEqual(kpoints.kpts, [[2, 4, 6]])
        self.assertEqual(kpoints.style, Kpoints.supported_modes.Monkhorst)

    def test_to_from_dict(self):
        d = self.vis.as_dict()
        v = dec.process_decoded(d)
        self.assertEqual(v.incar_settings["IMAGES"], 10)

    def test_write_inputs(self):
        c1 = [[0.5] * 3, [0.9] * 3]
        c2 = [[0.5] * 3, [0.9, 0.1, 0.1]]
        s1 = Structure(Lattice.cubic(5), ['Si', 'Si'], c1)
        s2 = Structure(Lattice.cubic(5), ['Si', 'Si'], c2)
        structs = []
        for s in s1.interpolate(s2, 3, pbc=True):
            structs.append(Structure.from_sites(s.sites, to_unit_cell=True))

        fc = self.vis._process_structures(structs)[2].frac_coords
        self.assertTrue(
            np.allclose(fc, [[0.5] * 3, [0.9, 1.033333, 1.0333333]]))
Example #3
0
 def setUp(self):
     filepath = os.path.join(test_dir, 'POSCAR')
     poscar = Poscar.from_file(filepath)
     self.struct = poscar.structure
     self.vis = MITNEBVaspInputSet(nimages=10, hubbard_off=True)
Example #4
0
 def setUp(self):
     filepath = os.path.join(test_dir, 'POSCAR')
     poscar = Poscar.from_file(filepath)
     self.struct = poscar.structure
     self.vis = MITNEBVaspInputSet(nimages=10, hubbard_off=True)