22
22
DEBUG_MODE = False
23
23
# If None, runs a "fake" VASP. Otherwise, runs VASP with this command...
24
24
VASP_CMD = None
25
- _write_task_docs = (
26
- False # Test developer option: defaults to False, need to be True only once
27
- )
25
+ # Test developer option: defaults to False, need to be True only once
26
+ _write_task_docs = False
28
27
29
28
30
29
class TestBulkModulusWorkflow (AtomateTest ):
@@ -44,18 +43,18 @@ class TestBulkModulusWorkflow(AtomateTest):
44
43
def setUp (self ):
45
44
super ().setUp ()
46
45
self .struct_si = PymatgenTest .get_structure ("Si" )
47
- self .ndeformations = 6
46
+ self .n_deformations = 6
48
47
self .deformations = [
49
48
(np .identity (3 ) * (1 + x )).tolist ()
50
- for x in np .linspace (- 0.05 , 0.05 , self .ndeformations )
49
+ for x in np .linspace (- 0.05 , 0.05 , self .n_deformations )
51
50
]
52
51
self .wf_config = {"VASP_CMD" : ">>vasp_cmd<<" , "DB_FILE" : ">>db_file<<" }
53
52
self .wf = wf_bulk_modulus (self .struct_si , self .wf_config )
54
53
55
54
def _simulate_vasprun (self , wf ):
56
55
no_vasp_ref_dirs = {}
57
56
fake_vasp_ref_dirs = {}
58
- for i in range (2 , self .ndeformations + 2 ):
57
+ for i in range (2 , self .n_deformations + 2 ):
59
58
if os .path .exists (os .path .join (reference_dir , str (i ), "inputs" )):
60
59
if not VASP_CMD :
61
60
fake_vasp_ref_dirs [
@@ -119,16 +118,16 @@ def _check_run(self, d, mode):
119
118
elif mode in ["fit equation of state" ]:
120
119
self .assertAlmostEqual (d ["bulk_modulus" ], 88.90 , places = 2 )
121
120
self .assertEqual (len (d ["all_task_ids" ]), 7 )
122
- self .assertEqual (len (d ["energies" ]), self .ndeformations )
123
- self .assertEqual (len (d ["volumes" ]), self .ndeformations )
121
+ self .assertEqual (len (d ["energies" ]), self .n_deformations )
122
+ self .assertEqual (len (d ["volumes" ]), self .n_deformations )
124
123
s = SpacegroupAnalyzer (
125
124
Structure .from_dict (d ["structure" ])
126
125
).get_conventional_standard_structure ()
127
126
self .assertAlmostEqual (s .lattice .c , 5.468 , places = 3 )
128
127
129
128
def setup_task_docs (self ):
130
129
self .task_file = "task.json"
131
- for i in range (2 , self .ndeformations + 2 ):
130
+ for i in range (2 , self .n_deformations + 2 ):
132
131
if os .path .exists (os .path .join (reference_dir , str (i ), self .task_file )):
133
132
with open (os .path .join (reference_dir , str (i ), self .task_file )) as fp :
134
133
d = json .load (fp )
@@ -161,7 +160,7 @@ def setup_task_docs(self):
161
160
162
161
def write_task_docs (self ):
163
162
# this step needs to be run once: once task.json is present, remove the inputs/outputs folders
164
- for i in range (2 , self .ndeformations + 2 ):
163
+ for i in range (2 , self .n_deformations + 2 ):
165
164
# not to unnecessarily override available task.json
166
165
if not os .path .exists (os .path .join (reference_dir , str (i ), "task.json" )):
167
166
d = self .get_task_collection ().find_one (
@@ -186,7 +185,7 @@ def write_task_docs(self):
186
185
187
186
def test_wf (self ):
188
187
self .wf = self ._simulate_vasprun (self .wf )
189
- self .assertEqual (len (self .wf .fws ), self .ndeformations + 2 )
188
+ self .assertEqual (len (self .wf .fws ), self .n_deformations + 2 )
190
189
191
190
defo_vis = [
192
191
fw .tasks [2 ]["vasp_input_set" ] for fw in self .wf .fws if "deform" in fw .name
0 commit comments