def test_to_dict_from_dict(self): k = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0]) d = k.to_dict k2 = Kpoints.from_dict(d) self.assertEqual(k.kpts, k2.kpts) self.assertEqual(k.style, k2.style) self.assertEqual(k.kpts_shift, k2.kpts_shift)
def test_kpt_bands_to_dict_from_dict(self): file_name = os.path.join(test_dir, 'KPOINTS.band') k = Kpoints.from_file(file_name) d = k.to_dict import json json.dumps(d) #This doesn't work k2 = Kpoints.from_dict(d) self.assertEqual(k.kpts, k2.kpts) self.assertEqual(k.style, k2.style) self.assertEqual(k.kpts_shift, k2.kpts_shift) self.assertEqual(k.num_kpts, k2.num_kpts)
def run_task(self, fw_spec): Incar.from_dict(fw_spec['vasp']['incar']).write_file('INCAR') Poscar.from_dict(fw_spec['vasp']['poscar']).write_file('POSCAR') Potcar.from_dict(fw_spec['vasp']['potcar']).write_file('POTCAR') Kpoints.from_dict(fw_spec['vasp']['kpoints']).write_file('KPOINTS')