From b4aedf012f7614ed45cc88395832dbf5ac946019 Mon Sep 17 00:00:00 2001 From: Stef Smeets Date: Wed, 25 Oct 2023 15:39:22 +0200 Subject: [PATCH] Propagate site labels in `SymmetrizedStructure()` (#3423) --- pymatgen/symmetry/structure.py | 1 + tests/io/test_cif.py | 1 + 2 files changed, 2 insertions(+) diff --git a/pymatgen/symmetry/structure.py b/pymatgen/symmetry/structure.py index 5d3c1d50838..a7aa4913c63 100644 --- a/pymatgen/symmetry/structure.py +++ b/pymatgen/symmetry/structure.py @@ -50,6 +50,7 @@ def __init__( structure.frac_coords, site_properties=structure.site_properties, properties=structure.properties, + labels=structure.labels, ) equivalent_indices: list[list[int]] = [[] for _ in range(len(uniq))] diff --git a/tests/io/test_cif.py b/tests/io/test_cif.py index ef116c0ce1f..e838566c6e2 100644 --- a/tests/io/test_cif.py +++ b/tests/io/test_cif.py @@ -222,6 +222,7 @@ def test_get_symmetrized_structure(self): assert isinstance(sym_structure, SymmetrizedStructure) assert structure == sym_structure assert sym_structure.equivalent_indices == [[0, 1, 2, 3], [4, 5, 6, 7, 8, 9, 10, 11]] + assert set(sym_structure.labels) == {"O1", "Li1"} def test_site_symbol_preference(self): parser = CifParser(f"{TEST_FILES_DIR}/site_type_symbol_test.cif")