def run_task(self, fw_spec): lobster_cmd = env_chk(self.get("lobster_cmd"), fw_spec) gzip_output = self.get("gzip_output", True) gzip_WAVECAR = self.get("gzip_WAVECAR", False) if gzip_WAVECAR: add_files_to_gzip = VASP_OUTPUT_FILES else: add_files_to_gzip = [f for f in VASP_OUTPUT_FILES if f not in ["WAVECAR"]] handler_groups = {"default": [], "no_handler": []} validator_groups = { "default": [ LobsterFilesValidator(), EnoughBandsValidator(output_filename="lobsterout"), ], "strict": [ ChargeSpillingValidator(output_filename="lobsterout"), LobsterFilesValidator(), EnoughBandsValidator(output_filename="lobsterout"), ], "no_validator": [], } handler_group = self.get("handler_group", "default") if isinstance(handler_group, str): handlers = handler_groups[handler_group] else: handlers = handler_group validator_group = self.get("validator_group", "default") if isinstance(validator_group, str): validators = validator_groups[validator_group] else: validators = handler_group # LobsterJob gzips output files, Custodian would gzip all output files (even slurm) jobs = [ LobsterJob( lobster_cmd=lobster_cmd, output_file="lobster.out", stderr_file="std_err_lobster.txt", gzipped=gzip_output, add_files_to_gzip=add_files_to_gzip, ) ] c = Custodian( handlers=handlers, jobs=jobs, validators=validators, gzipped_output=False, max_errors=5, ) c.run() if os.path.exists(zpath("custodian.json")): stored_custodian_data = {"custodian": loadfn(zpath("custodian.json"))} return FWAction(stored_data=stored_custodian_data)
def test_as_dict(self): v = EnoughBandsValidator(output_filename=os.path.join( test_files_lobster, "lobsterout.normal")) d = v.as_dict() v2 = EnoughBandsValidator.from_dict(d) self.assertIsInstance(v2, EnoughBandsValidator)
def test_check_and_correct3(self): v3 = EnoughBandsValidator(output_filename=os.path.join( test_files_lobster, "nolobsterout/lobsterout")) self.assertFalse(v3.check())
def test_check_and_correct2(self): v2 = EnoughBandsValidator(output_filename=os.path.join( test_files_lobster, "lobsterout.nocohp")) self.assertTrue(v2.check())
def test_check_and_correct(self): v = EnoughBandsValidator(output_filename=os.path.join( test_files_lobster, "lobsterout.normal")) self.assertFalse(v.check())