Skip to content

Commit

Permalink
Add default symprec of 0.01A. #4268
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jan 29, 2025
1 parent bf6c108 commit 5b997f7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pymatgen/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3352,7 +3352,7 @@ def get_symmetry_dataset(self, backend: Literal["moyopy"], **kwargs) -> moyopy.M
def get_symmetry_dataset(self, backend: Literal["spglib"], **kwargs) -> spglib.SpglibDataset: ...

def get_symmetry_dataset(
self, backend: Literal["moyopy", "spglib"] = "spglib", return_raw_dataset=False, **kwargs
self, backend: Literal["moyopy", "spglib"] = "spglib", return_raw_dataset=False, symprec: float = 1e-2, **kwargs
) -> dict | moyopy.MoyoDataset | spglib.SpglibDataset:
"""Get a symmetry dataset from the structure using either moyopy or spglib backend.
Expand All @@ -3368,6 +3368,7 @@ def get_symmetry_dataset(
return_raw_dataset (bool): Whether to return the raw Dataset object from the backend. The default is
False, which returns a dict with a common subset of the data present in both datasets. If you use the
raw Dataset object, we do not guarantee that the format of the output is not going to change.
symprec (float): Tolerance for symmetry determination. Defaults to 0.01 A.
**kwargs: Additional arguments passed to the respective backend's constructor.
For spglib, these are passed to SpacegroupAnalyzer (e.g. symprec, angle_tolerance).
For moyopy, these are passed to MoyoDataset constructor.
Expand All @@ -3391,12 +3392,12 @@ def get_symmetry_dataset(

# Convert structure to MoyoDataset format
moyo_cell = moyopy.interface.MoyoAdapter.from_structure(self)
dataset = moyopy.MoyoDataset(cell=moyo_cell, **kwargs)
dataset = moyopy.MoyoDataset(cell=moyo_cell, symprec=symprec, **kwargs)

else:
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

sga = SpacegroupAnalyzer(self, **kwargs)
sga = SpacegroupAnalyzer(self, symprec=symprec, **kwargs)
dataset = sga.get_symmetry_dataset()

if return_raw_dataset:
Expand Down

0 comments on commit 5b997f7

Please sign in to comment.