@@ -1081,6 +1081,8 @@ def to_tsl(symmetry):
1081
1081
1082
1082
def symmetry_operators (self , use_miller_bravais = False ):
1083
1083
"""Define the equivalent crystal symmetries.
1084
+ Note that it takes the highest symmetry in each of the 7 crystal systems
1085
+ This may not be quite right if a specific point group with less symmetry is desired
1084
1086
1085
1087
Those come from Randle & Engler, 2000. For instance in the cubic
1086
1088
crystal struture, for instance there are 24 equivalent cube orientations.
@@ -1144,12 +1146,21 @@ def symmetry_operators(self, use_miller_bravais=False):
1144
1146
sym [8 ] = np .array ([[- 0.5 , s60 , 0. ], [s60 , 0.5 , 0. ], [0. , 0. , - 1. ]])
1145
1147
sym [9 ] = np .array ([[- 1. , 0. , 0. ], [0. , 1. , 0. ], [0. , 0. , - 1. ]])
1146
1148
sym [10 ] = np .array ([[- 0.5 , - s60 , 0. ], [- s60 , 0.5 , 0. ], [0. , 0. , - 1. ]])
1147
- sym [11 ] = np .array ([[0.5 , - s60 , 0. ], [- s60 , - 0.5 , 0. ], [0. , 0. , - 1. ]])
1149
+ sym [11 ] = np .array ([[0.5 , - s60 , 0. ], [- s60 , - 0.5 , 0. ], [0. , 0. , - 1. ]])
1150
+ elif self is Symmetry .trigonal :
1151
+ sym = np .zeros ((6 , 3 , 3 ), dtype = float )
1152
+ s60 = np .sin (60 * np .pi / 180 )
1153
+ sym [0 ] = np .array ([[1. , 0. , 0. ], [0. , 1. , 0. ], [0. , 0. , 1. ]])
1154
+ sym [1 ] = np .array ([[- 0.5 , - s60 , 0. ], [s60 , - 0.5 , 0. ], [0. , 0. , 1. ]])
1155
+ sym [2 ] = np .array ([[- 0.5 , s60 , 0. ], [- s60 , - 0.5 , 0. ], [0. , 0. , 1. ]])
1156
+ sym [3 ] = np .array ([[1. , 0. , 0. ], [0. , - 1. , 0. ], [0. , 0. , - 1. ]])
1157
+ sym [4 ] = np .array ([[- 0.5 , s60 , 0. ], [s60 , 0.5 , 0. ], [0. , 0. , - 1. ]])
1158
+ sym [5 ] = np .array ([[- 0.5 , - s60 , 0. ], [- s60 , 0.5 , 0. ], [0. , 0. , - 1. ]])
1148
1159
elif self is Symmetry .orthorhombic :
1149
1160
sym = np .zeros ((4 , 3 , 3 ), dtype = float )
1150
1161
sym [0 ] = np .array ([[1. , 0. , 0. ], [0. , 1. , 0. ], [0. , 0. , 1. ]])
1151
1162
sym [1 ] = np .array ([[1. , 0. , 0. ], [0. , - 1. , 0. ], [0. , 0. , - 1. ]])
1152
- sym [2 ] = np .array ([[- 1. , 0. , - 1 . ], [0. , 1. , 0. ], [0. , 0. , - 1. ]])
1163
+ sym [2 ] = np .array ([[- 1. , 0. , 0 . ], [0. , 1. , 0. ], [0. , 0. , - 1. ]])
1153
1164
sym [3 ] = np .array ([[- 1. , 0. , 0. ], [0. , - 1. , 0. ], [0. , 0. , 1. ]])
1154
1165
elif self is Symmetry .tetragonal :
1155
1166
sym = np .zeros ((8 , 3 , 3 ), dtype = float )
@@ -1161,6 +1172,10 @@ def symmetry_operators(self, use_miller_bravais=False):
1161
1172
sym [5 ] = np .array ([[- 1. , 0. , 0. ], [0. , 1. , 0. ], [0. , 0. , - 1. ]])
1162
1173
sym [6 ] = np .array ([[0. , 1. , 0. ], [1. , 0. , 0. ], [0. , 0. , - 1. ]])
1163
1174
sym [7 ] = np .array ([[0. , - 1. , 0. ], [- 1. , 0. , 0. ], [0. , 0. , - 1. ]])
1175
+ elif self is Symmetry .monoclinic :
1176
+ sym = np .zeros ((2 , 3 , 3 ), dtype = float )
1177
+ sym [0 ] = np .array ([[1. , 0. , 0. ], [0. , 1. , 0. ], [0. , 0. , 1. ]])
1178
+ sym [1 ] = np .array ([[- 1. , 0. , 0. ], [0. , - 1. , 0. ], [0. , 0. , 1. ]])
1164
1179
elif self is Symmetry .triclinic :
1165
1180
sym = np .zeros ((1 , 3 , 3 ), dtype = float )
1166
1181
sym [0 ] = np .array ([[1. , 0. , 0. ], [0. , 1. , 0. ], [0. , 0. , 1. ]])
@@ -1448,8 +1463,14 @@ def disorientation(ori1, ori2, crystal_structure=Symmetry.triclinic):
1448
1463
oi_list = np .einsum ('nij,jk->nik' , symmetries , ori2 )
1449
1464
1450
1465
# Compute all combinations of symmetrized ori1 and ori2
1451
- oj_list_T = np .transpose (oj_list , axes = (0 , 2 , 1 ))
1452
- delta_list = np .einsum ('bij,bjk->bik' , oi_list , oj_list_T )
1466
+ delta_list_AB = np .einsum ('aij,bkj->abik' , oi_list , oj_list )
1467
+ delta_list_BA = np .einsum ('aij,bkj->abik' , oj_list , oi_list )
1468
+
1469
+ # Flatten (2*Nsymmetry*Nsymmetry, 3, 3)
1470
+ delta_list = np .concatenate ([
1471
+ delta_list_AB .reshape (- 1 , 3 , 3 ),
1472
+ delta_list_BA .reshape (- 1 , 3 , 3 )
1473
+ ])
1453
1474
1454
1475
# Calculate misorientation angles for all delta matrices
1455
1476
mis_angles = np .array ([misorientation_angle_from_delta (delta ) for delta in delta_list ])
0 commit comments