|
15 | 15 | import re |
16 | 16 | from copy import deepcopy |
17 | 17 | from ast import literal_eval |
| 18 | +from typing import Literal |
18 | 19 |
|
19 | 20 | import numpy as np |
20 | 21 | from monty.serialization import loadfn |
@@ -2465,8 +2466,27 @@ def equivalent_set(self, index): |
2465 | 2466 | return self |
2466 | 2467 |
|
2467 | 2468 | # =============================Get functions=========================== |
2468 | | - def get_site_symm_wo_translation(self): |
2469 | | - return [SymmOp.from_rotation_and_translation(op.rotation_matrix, [0, 0, 0]) for op in self.symmetry[0]] |
| 2469 | + def get_site_symm_wo_translation(self, space: Literal["fractional", "euclidean"] = "fractional"): |
| 2470 | + """ |
| 2471 | + Site symmetry operations of the first point, with translations removed. |
| 2472 | +
|
| 2473 | + Args: |
| 2474 | + space: "fractional" returns the rotations as stored (fractional |
| 2475 | + coordinates). "euclidean" returns them in Cartesian space, which |
| 2476 | + differs only for trigonal/hexagonal groups (``self.euclidean``), |
| 2477 | + where a 3-fold rotation such as (-y, x-y, z) is not orthogonal. |
| 2478 | + Use "euclidean" when comparing against a molecule's point group. |
| 2479 | +
|
| 2480 | + Returns: |
| 2481 | + list of pymatgen SymmOp objects |
| 2482 | + """ |
| 2483 | + if space == "fractional": |
| 2484 | + ops = self.symmetry[0] |
| 2485 | + elif space == "euclidean": |
| 2486 | + ops = self.get_site_symm_ops() |
| 2487 | + else: |
| 2488 | + raise ValueError(f"space must be 'fractional' or 'euclidean', got {space!r}") |
| 2489 | + return [SymmOp.from_rotation_and_translation(op.rotation_matrix, [0, 0, 0]) for op in ops] |
2470 | 2490 |
|
2471 | 2491 | def get_site_symmetry_object(self, idx=0): |
2472 | 2492 | ops = self.get_site_symm_ops(idx)#; print(self.number, self.index, self.letter) |
|
0 commit comments