Skip to content

Commit 8419904

Browse files
committed
add test for use_custodian() following modify_gzip_vasp(wf, False)
1 parent 36a4072 commit 8419904

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

atomate/vasp/tests/test_vasp_powerups.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from atomate.vasp.powerups import (
77
add_priority,
8+
modify_gzip_vasp,
89
use_custodian,
910
add_trackers,
1011
add_modify_incar,
@@ -64,21 +65,32 @@ def test_custodian_powerups(self):
6465
self.assertTrue("RunVaspDirect" in fw.tasks[task_idx]._fw_name)
6566
self.assertEqual(fw.tasks[task_idx]["vasp_cmd"], "test_VASP")
6667

67-
my_wf_double_relax = remove_custodian(copy_wf(self.bs_wf))
68-
my_wf_double_relax = use_custodian(
69-
my_wf_double_relax,
68+
wf_double_relax = remove_custodian(copy_wf(self.bs_wf))
69+
70+
wf_double_relax = use_custodian(
71+
wf_double_relax,
7072
fw_name_constraint="structure optimization",
7173
custodian_params={"job_type": "double_relaxation_run"},
7274
)
7375

74-
for fw in my_wf_double_relax.fws:
76+
for fw in wf_double_relax.fws:
7577
if "structure optimization" in fw.name:
7678
self.assertTrue("RunVaspCustodian" in fw.tasks[1]._fw_name)
7779
self.assertEqual(fw.tasks[1]["job_type"], "double_relaxation_run")
7880
else:
7981
self.assertTrue("RunVaspDirect" in fw.tasks[2]._fw_name)
8082
self.assertFalse("job_type" in fw.tasks[2])
8183

84+
# test use_custodian() does not overwrite existing custodian params
85+
wf_double_relax = modify_gzip_vasp(wf_double_relax, False)
86+
wf_double_relax = use_custodian(wf_double_relax)
87+
idx_list = get_fws_and_tasks(
88+
wf_double_relax, task_name_constraint="RunVaspCustodian"
89+
)
90+
for idx_fw, idx_t in idx_list:
91+
task = wf_double_relax.fws[idx_fw].tasks[idx_t]
92+
assert task["gzip_output"] is False
93+
8294
def test_modify_incar(self):
8395
my_wf = add_modify_incar(
8496
copy_wf(self.bs_wf),

0 commit comments

Comments
 (0)