Exemple #1
0
    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)
Exemple #2
0
 def test_as_dict(self):
     os.chdir(test_files_lobster)
     v = LobsterFilesValidator()
     d = v.as_dict()
     v2 = LobsterFilesValidator.from_dict(d)
     self.assertIsInstance(v2, LobsterFilesValidator)
Exemple #3
0
 def test_check_and_correct_3(self):
     os.chdir(os.path.join(test_files_lobster, "crash"))
     v3 = LobsterFilesValidator()
     self.assertTrue(v3.check())
Exemple #4
0
 def test_check_and_correct_2(self):
     os.chdir(os.path.join(test_files_lobster, "../lobsterins"))
     v2 = LobsterFilesValidator()
     self.assertTrue(v2.check())
Exemple #5
0
 def test_check_and_correct_1(self):
     os.chdir(test_files_lobster)
     v = LobsterFilesValidator()
     self.assertFalse(v.check())