@@ -134,7 +134,7 @@ def __init__(
134
134
self .label = label
135
135
self .adsorbates = adsorbates if adsorbates else []
136
136
self .clean_entry = clean_entry
137
- self .ads_entries_dict = {str (list ( ads .composition .as_dict ())[ 0 ] ): ads for ads in self .adsorbates }
137
+ self .ads_entries_dict = {str (next ( iter ( ads .composition .as_dict ())) ): ads for ads in self .adsorbates }
138
138
self .mark = marker
139
139
self .color = color
140
140
@@ -199,14 +199,14 @@ def surface_energy(self, ucell_entry, ref_entries=None):
199
199
ucell_entry_comp = ucell_entry .composition .reduced_composition .as_dict ()
200
200
slab_clean_comp = Composition ({el : slab_comp [el ] for el in ucell_entry_comp })
201
201
if slab_clean_comp .reduced_composition != ucell_entry .composition .reduced_composition :
202
- list_els = [list ( entry .composition .as_dict ())[ 0 ] for entry in ref_entries ]
202
+ list_els = [next ( iter ( entry .composition .as_dict ())) for entry in ref_entries ]
203
203
if not any (el in list_els for el in ucell_entry .composition .as_dict ()):
204
204
warnings .warn ("Elemental references missing for the non-dopant species." )
205
205
206
206
gamma = (Symbol ("E_surf" ) - Symbol ("Ebulk" )) / (2 * Symbol ("A" ))
207
207
ucell_comp = ucell_entry .composition
208
208
ucell_reduced_comp = ucell_comp .reduced_composition
209
- ref_entries_dict = {str (list ( ref .composition .as_dict ())[ 0 ] ): ref for ref in ref_entries }
209
+ ref_entries_dict = {str (next ( iter ( ref .composition .as_dict ())) ): ref for ref in ref_entries }
210
210
ref_entries_dict .update (self .ads_entries_dict )
211
211
212
212
# Calculate Gibbs free energy of the bulk per unit formula
@@ -613,7 +613,7 @@ def area_frac_vs_chempot_plot(
613
613
axes = plt .gca ()
614
614
615
615
for hkl in self .all_slab_entries :
616
- clean_entry = list ( self .all_slab_entries [hkl ])[ 0 ]
616
+ clean_entry = next ( iter ( self .all_slab_entries [hkl ]))
617
617
# Ignore any facets that never show up on the
618
618
# Wulff shape regardless of chemical potential
619
619
if all (a == 0 for a in hkl_area_dict [hkl ]):
0 commit comments