def test_static_run_correction(self): shutil.copy("OSZICAR.empty", "OSZICAR") s1 = Structure.from_file("POSCAR") incar = Incar.from_file("INCAR") # Test for NSW 0 incar.update({"NSW": 0}) incar.write_file("INCAR") h = VaspErrorHandler("vasp.out") self.assertEqual(h.check(), True) d = h.correct() self.assertEqual(d["errors"], ["zpotrf"]) s2 = Structure.from_file("POSCAR") self.assertAlmostEqual(s2.volume, s1.volume, 3) self.assertEqual(Incar.from_file("INCAR")["ISYM"], 0) # Test for ISIF 0-2 incar.update({"NSW": 99, "ISIF": 2}) incar.write_file("INCAR") h = VaspErrorHandler("vasp.out") self.assertEqual(h.check(), True) d = h.correct() self.assertEqual(d["errors"], ["zpotrf"]) s2 = Structure.from_file("POSCAR") self.assertAlmostEqual(s2.volume, s1.volume, 3) self.assertEqual(Incar.from_file("INCAR")["ISYM"], 0)
def test_first_step(self): shutil.copy("OSZICAR.empty", "OSZICAR") s1 = Structure.from_file("POSCAR") h = VaspErrorHandler("vasp.out") self.assertEqual(h.check(), True) d = h.correct() self.assertEqual(d["errors"], ["zpotrf"]) s2 = Structure.from_file("POSCAR") self.assertAlmostEqual(s2.volume, s1.volume * 1.2**3, 3)
def test_potim_correction(self): shutil.copy("OSZICAR.one_step", "OSZICAR") s1 = Structure.from_file("POSCAR") h = VaspErrorHandler("vasp.out") self.assertEqual(h.check(), True) d = h.correct() self.assertEqual(d["errors"], ["zpotrf"]) s2 = Structure.from_file("POSCAR") self.assertAlmostEqual(s2.volume, s1.volume, 3) self.assertAlmostEqual(Incar.from_file("INCAR")["POTIM"], 0.25)
def run_task(self, fw_spec): wd = os.getcwd() try: raw_struct = Structure.from_file(wd + "/POSCAR") formula = raw_struct.composition.formula structure = raw_struct.as_dict() except: formula = None structure = None cmd = env_chk(self["pyzfs_cmd"], fw_spec) logger.info("Running command: {}".format(cmd)) return_code = subprocess.call([cmd], shell=True) logger.info("Command {} finished running with returncode: {}".format( cmd, return_code)) return FWAction(update_spec={ "structure": structure, "formula": formula, })