def test_correct(self): shutil.copy("INCAR", "INCAR.orig") h = DriftErrorHandler(max_drift=0.0001,enaug_multiply=2) h.check() d = h.correct() incar = Incar.from_file("INCAR") self.assertTrue(incar.get("ADDGRID",False)) d = h.correct() incar = Incar.from_file("INCAR") self.assertEqual(incar.get("PREC"),"High") self.assertEqual(incar.get("ENAUG",0),incar.get("ENCUT",2)*2) clean_dir() shutil.move("INCAR.orig", "INCAR")
def test_check(self): shutil.copy("INCAR", "INCAR.orig") h = DriftErrorHandler(max_drift=0.05, to_average=11) self.assertFalse(h.check()) h = DriftErrorHandler(max_drift=0.05) self.assertFalse(h.check()) h = DriftErrorHandler(max_drift=0.0001) self.assertFalse(h.check()) incar = Incar.from_file("INCAR") incar["EDIFFG"] = -0.01 incar.write_file("INCAR") h = DriftErrorHandler(max_drift=0.0001) self.assertTrue(h.check()) h = DriftErrorHandler() h.check() self.assertEqual(h.max_drift,0.01) clean_dir() shutil.move("INCAR.orig", "INCAR")