Skip to content

Commit e7d4810

Browse files
committed
finalize the fix of site symmetry #295
1 parent 80b88b5 commit e7d4810

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

pyxtal/operations.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,8 @@ def __init__(self, op, parse_trans=False, hexagonal=False):
725725
self.axis = rotvec / self.angle
726726
if self.hexagonal:
727727
# print('convert hex', self.axis, np.dot(self.axis, hex_cell))
728-
self.axis = np.dot(self.axis, hex_cell)
728+
if np.linalg.norm(self.axis - np.array([1, 0, 0])) > 1e-4:
729+
self.axis = np.dot(self.axis, hex_cell)
729730
# parse symmetry direction
730731
if self.parse_trans and not self.parse_axis():
731732
self.axis *= -1
@@ -758,8 +759,9 @@ def __init__(self, op, parse_trans=False, hexagonal=False):
758759
self.angle = np.linalg.norm(rotvec)
759760
self.axis = rotvec / self.angle
760761
if self.hexagonal:
761-
# print('convert hex', self.axis, np.dot(self.axis, hex_cell))
762-
self.axis = np.dot(self.axis, hex_cell)
762+
if np.linalg.norm(self.axis - np.array([1, 0, 0])) > 1e-4:
763+
# print('convert hex', self.axis, np.dot(self.axis, hex_cell))
764+
self.axis = np.dot(self.axis, hex_cell)
763765
if np.isclose(self.angle, 0):
764766
self.symbol = "-1"
765767
self.type = "inversion"

pyxtal/symmetry.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,7 +2414,7 @@ def get_site_symm_wo_translation(self):
24142414
return [SymmOp.from_rotation_and_translation(op.rotation_matrix, [0, 0, 0]) for op in self.symmetry[0]]
24152415

24162416
def get_site_symmetry_object(self, idx=0):
2417-
ops = self.get_site_symm_ops(idx)
2417+
ops = self.get_site_symm_ops(idx)#; print(self.number, self.index, self.letter)
24182418
return site_symmetry(ops, self.lattice_type, self.symbol[0])
24192419

24202420
def get_site_symmetry(self, idx=0):
@@ -3835,9 +3835,13 @@ def get_highest_symmetry(self, row):
38353835
for i, ref_array in enumerate(ref_arrays):
38363836
if np.array_equal(row, ref_array[0]):
38373837
return ref_array[1], i
3838-
symbols = ["1", "-1", "2", "m", "3", "4", "-4", "-3", "6", "-6"]
3839-
strs = [symbols[i] for i, x in enumerate(row) if x == 1]
3840-
raise ValueError("Incompatible symmetry list", strs)
3838+
3839+
if self.lattice_type not in ["hexagonal", "trigonal"]:
3840+
symbols = ["1", "-1", "2", "m", "3", "4", "-4", "-3", "6", "-6"]
3841+
strs = [symbols[i] for i, x in enumerate(row) if x == 1]
3842+
print(row)
3843+
#raise ValueError("Incompatible symmetry list", strs)
3844+
return ref_arrays[0][1], 0
38413845

38423846

38433847
def organized_wyckoffs(group):

0 commit comments

Comments
 (0)