44
44
45
45
def hkl_tuple_to_str (hkl ):
46
46
"""
47
- Prepare for display on plots
48
- "(hkl)" for surfaces
49
- Agrs :
47
+ Prepare for display on plots "(hkl)" for surfaces
48
+
49
+ Args :
50
50
hkl: in the form of [h, k, l] or (h, k, l).
51
51
"""
52
- str_format = "($"
53
- for x in hkl :
54
- if x < 0 :
55
- str_format += "\\ overline{" + str (- x ) + "}"
56
- else :
57
- str_format += str (x )
58
- str_format += "$)"
59
- return str_format
52
+ out = "" .join (f"\\ overline{{{ - x } }}" if x < 0 else str (x ) for x in hkl )
53
+ return f"(${ out } $)"
60
54
61
55
62
56
def get_tri_area (pts ):
@@ -67,7 +61,7 @@ def get_tri_area(pts):
67
61
Args:
68
62
pts: [a, b, c] three points
69
63
"""
70
- a , b , c = pts [ 0 ], pts [ 1 ], pts [ 2 ]
64
+ a , b , c = pts
71
65
v1 = np .array (b ) - np .array (a )
72
66
v2 = np .array (c ) - np .array (a )
73
67
return abs (np .linalg .norm (np .cross (v1 , v2 )) / 2 )
@@ -218,13 +212,13 @@ def __init__(self, lattice: Lattice, miller_list, e_surf_list, symprec=1e-5):
218
212
219
213
miller_area = []
220
214
for m , in_mill_fig in enumerate (self .input_miller_fig ):
221
- miller_area .append (in_mill_fig + " : " + str ( round (self .color_area [m ], 4 )) )
215
+ miller_area .append (f" { in_mill_fig } : { round (self .color_area [m ], 4 )} " )
222
216
self .miller_area = miller_area
223
217
224
218
def _get_all_miller_e (self ):
225
219
"""
226
- From self: get miller_list(unique_miller), e_surf_list and symmetry operations(symmops )
227
- according to lattice apply symmops to get all the miller index, then get normal, get
220
+ From self: get miller_list(unique_miller), e_surf_list and symmetry operations(symm_ops )
221
+ according to lattice apply symm_ops to get all the miller index, then get normal, get
228
222
all the facets functions for Wulff shape calculation: |normal| = 1, e_surf is plane's
229
223
distance to (0, 0, 0), normal[0]x + normal[1]y + normal[2]z = e_surf.
230
224
@@ -422,7 +416,13 @@ def get_plot(
422
416
from mpl_toolkits .mplot3d import Axes3D , art3d
423
417
424
418
colors = self ._get_colors (color_set , alpha , off_color , custom_colors = custom_colors or {})
425
- color_list , color_proxy , color_proxy_on_wulff , miller_on_wulff , e_surf_on_wulff = colors
419
+ (
420
+ color_list ,
421
+ color_proxy ,
422
+ color_proxy_on_wulff ,
423
+ miller_on_wulff ,
424
+ e_surf_on_wulff ,
425
+ ) = colors
426
426
427
427
if not direction :
428
428
# If direction is not specified, use the miller indices of
0 commit comments