Example #1
0
    def test_custodian_powerups(self):
        my_wf = copy_wf(self.bs_wf)
        my_wf = remove_custodian(my_wf)

        for fw in my_wf.fws:
            task_idx = 1 if "structure optimization" in fw.name else 2
            self.assertTrue("RunVaspDirect" in fw.tasks[task_idx]._fw_name)
            self.assertEqual(fw.tasks[task_idx]["vasp_cmd"], "test_VASP")

        my_wf_double_relax = remove_custodian(copy_wf(self.bs_wf))
        my_wf_double_relax = use_custodian(
            my_wf_double_relax,
            fw_name_constraint="structure optimization",
            custodian_params={"job_type": "double_relaxation_run"},
        )

        for fw in my_wf_double_relax.fws:
            if "structure optimization" in fw.name:
                self.assertTrue("RunVaspCustodian" in fw.tasks[1]._fw_name)
                self.assertEqual(fw.tasks[1]["job_type"], "double_relaxation_run")
            else:
                self.assertTrue("RunVaspDirect" in fw.tasks[2]._fw_name)
                self.assertFalse("job_type" in fw.tasks[2])
    def test_custodian_powerups(self):
        my_wf = self._copy_wf(self.bs_wf)
        my_wf = remove_custodian(my_wf)

        for fw in my_wf.fws:
            task_idx = 1 if "structure optimization" in fw.name else 2
            self.assertTrue(
                "RunVaspDirect" in fw.to_dict()["spec"]["_tasks"][task_idx]["_fw_name"])
            self.assertEqual(
                fw.to_dict()["spec"]["_tasks"][task_idx]["vasp_cmd"], "test_VASP")

        my_wf_double_relax = remove_custodian(self._copy_wf(self.bs_wf))
        my_wf_double_relax = use_custodian(my_wf_double_relax,
                                           fw_name_constraint="structure optimization",
                                           custodian_params={"job_type": "double_relaxation_run"})

        for fw in my_wf_double_relax.fws:
            if "structure optimization" in fw.name:
                self.assertTrue("RunVaspCustodian" in fw.to_dict()["spec"]["_tasks"][1]["_fw_name"])
                self.assertEqual(fw.to_dict()["spec"]["_tasks"][1]["job_type"],
                                 "double_relaxation_run")
            else:
                self.assertTrue("RunVaspDirect" in fw.to_dict()["spec"]["_tasks"][2]["_fw_name"])
                self.assertFalse("job_type" in fw.to_dict()["spec"]["_tasks"][2])