7
7
from pymatgen .core import Structure
8
8
9
9
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
11
11
from atomate .vasp .workflows .base .electrode import get_ion_insertion_wf
12
12
13
13
__author__ = "Jimmy Shen"
18
18
ref_dir = module_dir / "../../test_files"
19
19
wf_dir = ref_dir / "insertion_wf"
20
20
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
-
26
21
27
22
class TestInsertionWorkflow (AtomateTest ):
28
23
def setUp (self ):
@@ -32,57 +27,14 @@ def setUp(self):
32
27
calc_dirs = {n_ : input_output_dirs / n_ for n_ in names }
33
28
base_struct = Structure .from_file (wf_dir / "YPO4-static/inputs/POSCAR" )
34
29
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
- )
61
30
62
- wf_stop_early = get_ion_insertion_wf (
31
+ # Run the workflow with fake VASP
32
+ wf = get_ion_insertion_wf (
63
33
structure = base_struct ,
64
34
structure_matcher = sm ,
65
35
working_ion = "Mg" ,
66
36
volumetric_data_type = "AECCAR" ,
67
37
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
- ],
86
38
optimizefw_kwargs = {"ediffg" : - 0.05 },
87
39
)
88
40
@@ -94,9 +46,20 @@ def setUp(self):
94
46
check_poscar = False ,
95
47
check_potcar = False ,
96
48
)
49
+ wf = add_modify_incar (wf , modify_incar_params = {"incar_update" : {"KPAR" : 8 }})
97
50
wf = use_potcar_spec (wf )
98
51
self .wf = wf
99
52
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
+
100
63
wf_stop_early = use_fake_vasp (
101
64
wf_stop_early ,
102
65
calc_dirs ,
@@ -105,6 +68,7 @@ def setUp(self):
105
68
check_poscar = False ,
106
69
check_potcar = False ,
107
70
)
71
+ wf = add_modify_incar (wf , modify_incar_params = {"incar_update" : {"KPAR" : 8 }})
108
72
wf_stop_early = use_potcar_spec (wf_stop_early )
109
73
self .wf_stop_early = wf_stop_early
110
74
@@ -119,8 +83,10 @@ def test_has_inserted(self):
119
83
}
120
84
),
121
85
)
122
- formula = self .get_task_collection (coll_name = "tasks" ).distinct ("formula_pretty" )
123
- self .assertEqual (set (formula ), {"Y2Mg(PO4)2" , "YPO4" })
86
+ formulas = self .get_task_collection (coll_name = "tasks" ).distinct (
87
+ "formula_pretty"
88
+ )
89
+ self .assertEqual (set (formulas ), {"YPO4" })
124
90
125
91
self .lp .add_wf (self .wf )
126
92
rapidfire (
@@ -133,7 +99,7 @@ def test_has_inserted(self):
133
99
),
134
100
)
135
101
# Check that all of the inserted pretty formulas are present
136
- formula = self .get_task_collection (coll_name = "tasks" ).distinct ("formula_pretty" )
137
- self .assertEqual (
138
- set (formula ), {"Y2Mg(PO4)2" , "Y2Mg3(PO4)2" , "YMg2PO4" , "YMgPO4" , "YPO4" }
102
+ formulas = self .get_task_collection (coll_name = "tasks" ).distinct (
103
+ "formula_pretty"
139
104
)
105
+ self .assertEqual (set (formulas ), {"YPO4" })
0 commit comments