@@ -140,7 +140,7 @@ def PyExec(self):
140
140
f_handle .write (f"LATT { latt_type } \n " )
141
141
142
142
# print sym operations
143
- for sym_str in self .get_shelx_symmetry_operators (spgr , latt_type ):
143
+ for sym_str in self ._get_shelx_symmetry_operators (spgr , latt_type ):
144
144
f_handle .write (f"SYMM { sym_str } \n " )
145
145
146
146
# print atom info
@@ -167,20 +167,21 @@ def PyExec(self):
167
167
f_handle .write ("HKLF 2\n " ) # tells SHELX the columns saved in the reflection file
168
168
f_handle .write ("END" )
169
169
170
- def symmetry_operation_key (self , W1 , w1 , W2 = np .eye (3 ), w2 = np .zeros (3 )):
171
- """Symmetry element key for comparison"""
170
+ def _symmetry_operation_key (self , W1 , w1 , W2 = np .eye (3 ), w2 = np .zeros (3 )):
171
+ """Symmetry element key (9 element tuple) for comparison"""
172
172
W = W1 @ W2
173
173
w = W1 @ w2 + w1
174
174
w [w < 0 ] += 1
175
175
w [w > 1 ] -= 1
176
176
return tuple (np .round (W , 0 ).astype (int ).flatten ().tolist () + np .round (w , 3 ).tolist ())
177
177
178
- def symmetry_matrix_vector (self , symop ):
178
+ def _symmetry_matrix_vector (self , symop ):
179
+ """Symmetry rotation matrix and translation vector"""
179
180
W = np .linalg .inv (np .column_stack ([symop .transformHKL (V3D (* vec )) for vec in np .eye (3 )]))
180
181
w = np .array (symop .transformCoordinates (V3D (0 , 0 , 0 )))
181
182
return W , w
182
183
183
- def get_shelx_symmetry_operators (self , spgr , latt_type ):
184
+ def _get_shelx_symmetry_operators (self , spgr , latt_type ):
184
185
"""Get SHELX SYMM records https://cci.lbl.gov/cctbx/shelx.html"""
185
186
indentity = self .IDENTIY_OP .getIdentifier ()
186
187
inversion = self .INVERSION_OP .getIdentifier ()
@@ -190,17 +191,21 @@ def get_shelx_symmetry_operators(self, spgr, latt_type):
190
191
sym_ops_list = []
191
192
sym_ops_set = set ()
192
193
for sym_op in sym_ops :
193
- W1 , w1 = self .symmetry_matrix_vector (sym_op )
194
+ # space group symmetry operator
195
+ W1 , w1 = self ._symmetry_matrix_vector (sym_op )
194
196
sym_key = sym_op .getIdentifier ()
195
197
if sym_key != indentity and sym_key != inversion :
196
- S1 = self .symmetry_operation_key (W1 , w1 )
198
+ S1 = self ._symmetry_operation_key (W1 , w1 )
197
199
if S1 not in sym_ops_set :
198
200
sym_ops_list .append (sym_key )
201
+ # identity(/inversion) rotation symmetry operator
199
202
for rot in self .ROTATION_OPS [latt_sign ]:
200
- W2 , _ = self .symmetry_matrix_vector (rot )
203
+ W2 , _ = self ._symmetry_matrix_vector (rot )
204
+ # lattice centering translation symmetry operator
201
205
for cent in self .CENTERING_OPS [latt_numb ]:
202
- _ , w2 = self .symmetry_matrix_vector (cent )
203
- S3 = self .symmetry_operation_key (W1 , w1 , W2 , w2 )
206
+ _ , w2 = self ._symmetry_matrix_vector (cent )
207
+ # equivalenty symmetry operator generated from rotation and translation
208
+ S3 = self ._symmetry_operation_key (W1 , w1 , W2 , w2 )
204
209
sym_ops_set .add (S3 )
205
210
return sym_ops_list
206
211
0 commit comments