Skip to content

Commit

Permalink
Fix Cannot extract the right mapping from spglib #228
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Aug 28, 2023
1 parent d813fc4 commit 56aa415
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pyxtal/miscellaneous/bug_spglib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pyxtal import pyxtal

c = pyxtal()
c.from_seed('pyxtal/database/cifs/c_bug.vasp'); print(c)
c.from_seed('pyxtal/database/cifs/c_bug2.vasp'); print(c)
8 changes: 4 additions & 4 deletions pyxtal/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def symmetrize(pmg, tol=1e-3, a_tol=5.0, style='pyxtal', hn=None):
pos = dataset['std_positions']
numbers = dataset['std_types']

return Structure(cell, numbers, pos)
return Structure(cell, numbers, pos), hn

def get_symmetrized_pmg(pmg, tol=1e-3, a_tol=5.0, style='pyxtal', hn=None):
"""
Expand All @@ -123,11 +123,11 @@ def get_symmetrized_pmg(pmg, tol=1e-3, a_tol=5.0, style='pyxtal', hn=None):
pymatgen structure with symmetrized lattice
"""

pmg = symmetrize(pmg, tol, a_tol=a_tol, style=style, hn=hn)
pmg, hn = symmetrize(pmg, tol, a_tol=a_tol, style=style, hn=hn)
s = sga(pmg, symprec=tol, angle_tolerance=a_tol)
# make sure that the coordinates are in standard setting
if hn is None:
hn = Hall(s._space_group_data['number'], style=style).hall_default
#if hn is None:
# hn = Hall(s._space_group_data['number'], style=style).hall_default
if hn != s._space_group_data["hall_number"]:
s._space_group_data = get_symmetry_dataset(s._cell, tol,
angle_tolerance=a_tol,
Expand Down

0 comments on commit 56aa415

Please sign in to comment.