@@ -40,6 +40,15 @@ def make_property_instance(parameters, inter_param):
4040 raise RuntimeError (f"unknown property type { prop_type } " )
4141
4242
43+ def _property_suffix (parameters ):
44+ """Return the work suffix and whether the property is a refine job."""
45+ if "init_from_suffix" in parameters and "output_suffix" in parameters :
46+ return parameters ["output_suffix" ], True
47+ if parameters .get ("reproduce" , False ):
48+ return "reprod" , False
49+ return "00" , False
50+
51+
4352def make_property (confs , inter_param , property_list ):
4453 # find all POSCARs and their name like mp-xxx
4554 # ...
@@ -54,15 +63,7 @@ def make_property(confs, inter_param, property_list):
5463 for jj in property_list :
5564 if jj .get ("skip" , False ):
5665 continue
57- if "init_from_suffix" and "output_suffix" in jj :
58- do_refine = True
59- suffix = jj ["output_suffix" ]
60- elif "reproduce" in jj and jj ["reproduce" ]:
61- do_refine = False
62- suffix = "reprod"
63- else :
64- do_refine = False
65- suffix = "00"
66+ suffix , do_refine = _property_suffix (jj )
6667 # generate working directory like mp-xxx/eos_00 if jj['type'] == 'eos'
6768 # handel the exception that the working directory exists
6869 # ...
@@ -117,12 +118,7 @@ def run_property(confs, inter_param, property_list, mdata):
117118 # ...
118119 if jj .get ("skip" , False ):
119120 continue
120- if "init_from_suffix" and "output_suffix" in jj :
121- suffix = jj ["output_suffix" ]
122- elif "reproduce" in jj and jj ["reproduce" ]:
123- suffix = "reprod"
124- else :
125- suffix = "00"
121+ suffix , _ = _property_suffix (jj )
126122
127123 property_type = jj ["type" ]
128124 path_to_work = os .path .abspath (
@@ -234,12 +230,7 @@ def post_property(confs, inter_param, property_list):
234230 # ...
235231 if jj .get ("skip" , False ):
236232 continue
237- if "init_from_suffix" and "output_suffix" in jj :
238- suffix = jj ["output_suffix" ]
239- elif "reproduce" in jj and jj ["reproduce" ]:
240- suffix = "reprod"
241- else :
242- suffix = "00"
233+ suffix , _ = _property_suffix (jj )
243234
244235 inter_param_prop = inter_param
245236 if "cal_setting" in jj and "overwrite_interaction" in jj ["cal_setting" ]:
0 commit comments