Skip to content

Commit 076e038

Browse files
committed
Comment code
1 parent 703a22c commit 076e038

File tree

1 file changed

+15
-10
lines changed
  • Framework/PythonInterface/plugins/algorithms

1 file changed

+15
-10
lines changed

Framework/PythonInterface/plugins/algorithms/SaveINS.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def PyExec(self):
140140
f_handle.write(f"LATT {latt_type}\n")
141141

142142
# 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):
144144
f_handle.write(f"SYMM {sym_str}\n")
145145

146146
# print atom info
@@ -167,20 +167,21 @@ def PyExec(self):
167167
f_handle.write("HKLF 2\n") # tells SHELX the columns saved in the reflection file
168168
f_handle.write("END")
169169

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"""
172172
W = W1 @ W2
173173
w = W1 @ w2 + w1
174174
w[w < 0] += 1
175175
w[w > 1] -= 1
176176
return tuple(np.round(W, 0).astype(int).flatten().tolist() + np.round(w, 3).tolist())
177177

178-
def symmetry_matrix_vector(self, symop):
178+
def _symmetry_matrix_vector(self, symop):
179+
"""Symmetry rotation matrix and translation vector"""
179180
W = np.linalg.inv(np.column_stack([symop.transformHKL(V3D(*vec)) for vec in np.eye(3)]))
180181
w = np.array(symop.transformCoordinates(V3D(0, 0, 0)))
181182
return W, w
182183

183-
def get_shelx_symmetry_operators(self, spgr, latt_type):
184+
def _get_shelx_symmetry_operators(self, spgr, latt_type):
184185
"""Get SHELX SYMM records https://cci.lbl.gov/cctbx/shelx.html"""
185186
indentity = self.IDENTIY_OP.getIdentifier()
186187
inversion = self.INVERSION_OP.getIdentifier()
@@ -190,17 +191,21 @@ def get_shelx_symmetry_operators(self, spgr, latt_type):
190191
sym_ops_list = []
191192
sym_ops_set = set()
192193
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)
194196
sym_key = sym_op.getIdentifier()
195197
if sym_key != indentity and sym_key != inversion:
196-
S1 = self.symmetry_operation_key(W1, w1)
198+
S1 = self._symmetry_operation_key(W1, w1)
197199
if S1 not in sym_ops_set:
198200
sym_ops_list.append(sym_key)
201+
# identity(/inversion) rotation symmetry operator
199202
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
201205
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)
204209
sym_ops_set.add(S3)
205210
return sym_ops_list
206211

0 commit comments

Comments
 (0)