Skip to content

Commit b2a01cb

Browse files
committed
general overhaul of TestInsertionWorkflow
1 parent 6bd1789 commit b2a01cb

File tree

1 file changed

+16
-54
lines changed

1 file changed

+16
-54
lines changed

atomate/vasp/workflows/tests/test_insertion_workflow.py

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pymatgen.core import Structure
88

99
from atomate.utils.testing import AtomateTest
10-
from atomate.vasp.powerups import use_fake_vasp, use_potcar_spec
10+
from atomate.vasp.powerups import add_modify_incar, use_fake_vasp, use_potcar_spec
1111
from atomate.vasp.workflows.base.electrode import get_ion_insertion_wf
1212

1313
__author__ = "Jimmy Shen"
@@ -18,11 +18,6 @@
1818
ref_dir = module_dir / "../../test_files"
1919
wf_dir = ref_dir / "insertion_wf"
2020

21-
VASP_CMD = None # for fake VASP
22-
DEBUG_MODE = (
23-
False # If true, retains the database and output dirs at the end of the test
24-
)
25-
2621

2722
class TestInsertionWorkflow(AtomateTest):
2823
def setUp(self):
@@ -32,57 +27,14 @@ def setUp(self):
3227
calc_dirs = {n_: input_output_dirs / n_ for n_ in names}
3328
base_struct = Structure.from_file(wf_dir / "YPO4-static/inputs/POSCAR")
3429
sm = StructureMatcher(ltol=0.6, stol=0.6, angle_tol=9)
35-
# Run the workflow with fake vasp
36-
wf = get_ion_insertion_wf(
37-
structure=base_struct,
38-
structure_matcher=sm,
39-
working_ion="Mg",
40-
volumetric_data_type="AECCAR",
41-
db_file=db_dir / "db.json",
42-
vasp_powerups=[
43-
{
44-
"powerup_name": "add_modify_incar",
45-
"kwargs": {"modify_incar_params": {"incar_update": {"KPAR": 8}}},
46-
},
47-
{
48-
"powerup_name": "use_fake_vasp",
49-
"kwargs": {
50-
"ref_dirs": calc_dirs,
51-
"check_incar": False,
52-
"check_kpoints": False,
53-
"check_poscar": False,
54-
"check_potcar": False,
55-
},
56-
},
57-
{"powerup_name": "use_potcar_spec", "kwargs": {}},
58-
],
59-
optimizefw_kwargs={"ediffg": -0.05},
60-
)
6130

62-
wf_stop_early = get_ion_insertion_wf(
31+
# Run the workflow with fake VASP
32+
wf = get_ion_insertion_wf(
6333
structure=base_struct,
6434
structure_matcher=sm,
6535
working_ion="Mg",
6636
volumetric_data_type="AECCAR",
6737
db_file=db_dir / "db.json",
68-
max_inserted_atoms=1,
69-
vasp_powerups=[
70-
{
71-
"powerup_name": "add_modify_incar",
72-
"kwargs": {"modify_incar_params": {"incar_update": {"KPAR": 8}}},
73-
},
74-
{
75-
"powerup_name": "use_fake_vasp",
76-
"kwargs": {
77-
"ref_dirs": calc_dirs,
78-
"check_incar": False,
79-
"check_kpoints": False,
80-
"check_poscar": False,
81-
"check_potcar": False,
82-
},
83-
},
84-
{"powerup_name": "use_potcar_spec", "kwargs": {}},
85-
],
8638
optimizefw_kwargs={"ediffg": -0.05},
8739
)
8840

@@ -94,9 +46,20 @@ def setUp(self):
9446
check_poscar=False,
9547
check_potcar=False,
9648
)
49+
wf = add_modify_incar(wf, modify_incar_params={"incar_update": {"KPAR": 8}})
9750
wf = use_potcar_spec(wf)
9851
self.wf = wf
9952

53+
wf_stop_early = get_ion_insertion_wf(
54+
structure=base_struct,
55+
structure_matcher=sm,
56+
working_ion="Mg",
57+
volumetric_data_type="AECCAR",
58+
db_file=db_dir / "db.json",
59+
max_inserted_atoms=1,
60+
optimizefw_kwargs={"ediffg": -0.05},
61+
)
62+
10063
wf_stop_early = use_fake_vasp(
10164
wf_stop_early,
10265
calc_dirs,
@@ -105,6 +68,7 @@ def setUp(self):
10568
check_poscar=False,
10669
check_potcar=False,
10770
)
71+
wf = add_modify_incar(wf, modify_incar_params={"incar_update": {"KPAR": 8}})
10872
wf_stop_early = use_potcar_spec(wf_stop_early)
10973
self.wf_stop_early = wf_stop_early
11074

@@ -138,6 +102,4 @@ def test_has_inserted(self):
138102
formulas = self.get_task_collection(coll_name="tasks").distinct(
139103
"formula_pretty"
140104
)
141-
self.assertEqual(
142-
set(formulas), {"Y2Mg(PO4)2", "Y2Mg3(PO4)2", "YMg2PO4", "YMgPO4", "YPO4"}
143-
)
105+
self.assertEqual(set(formulas), {"YPO4"})

0 commit comments

Comments
 (0)