Skip to content

SpacegroupAnalyzer returns duplicate symmetry operations  #2725

@lbluque

Description

@lbluque

Describe the bug
The SpacegroupAnalyzer class returns a list of symmetry operations, where each unique symop appears twice.

This seems to be related to the upgrade of spglib, since the issue occurs with spglib >= 2, but not with earlier versions.

To Reproduce
Steps to reproduce the behavior:

from pymatgen.core import Structure, Lattice
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

lattice = Lattice([[3, 3, 0], [0, 3, 3], [3, 0, 3]])
species = 3 * ["A"] + ["D"]
coords = (
    (0.25, 0.25, 0.25), (0.75, 0.75, 0.75), (0.5, 0.5, 0.5),  (0, 0, 0)
)
structure = Structure(lattice, species, coords)
sga = SpacegroupAnalyzer(structure)
symops = sga.get_symmetry_operations()

# each symop appears twice!
for i in range(0, len(symops) - 1, 2):
    assert symops[i] == symops[i + 1]

Expected behavior
The list of symmetry operations should not contain duplicates.

Desktop (please complete the following information):

  • OS: Linux
  • Version: 2022.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions