@@ -16,11 +16,21 @@ def collect_structure_info(root=".", atol=1e-6, output="structure_info.json"):
1616 if info ["status" ] == JobStatus .DONE .value :
1717 contcar_path = os .path .join (root , folder , "CONTCAR" )
1818 abs_path = os .path .abspath (contcar_path )
19+ outcar_path = os .path .join (root , folder , "OUTCAR" )
20+ total_magnetization = None
21+ if os .path .exists (outcar_path ): # << Only try if OUTCAR exists
22+ try :
23+ with open (outcar_path ) as f :
24+ outcar_text = f .read ()
25+ total_magnetization = parse_total_magnetization (outcar_text )
26+ except Exception :
27+ total_magnetization = None
1928 if not os .path .exists (contcar_path ):
2029 structure_info [folder ] = {
2130 "abs_path" : abs_path ,
2231 "volume" : np .nan ,
2332 "composition" : None ,
33+ "last_total_magnetization" : total_magnetization ,
2434 "reason" : "CONTCAR missing" ,
2535 }
2636 continue
@@ -32,13 +42,15 @@ def collect_structure_info(root=".", atol=1e-6, output="structure_info.json"):
3242 "abs_path" : abs_path ,
3343 "volume" : np .nan ,
3444 "composition" : None ,
45+ "last_total_magnetization" : total_magnetization ,
3546 "reason" : f"Failed to parse CONTCAR: { e } " ,
3647 }
3748 else :
3849 structure_info [folder ] = {
3950 "abs_path" : abs_path ,
4051 "volume" : volume ,
4152 "composition" : composition ,
53+ "last_total_magnetization" : total_magnetization ,
4254 "reason" : "Success" ,
4355 }
4456 # Save as JSON
0 commit comments