Skip to content

Commit c7dc381

Browse files
committed
Fix test regression.
1 parent 255852f commit c7dc381

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/pymatgen/core/lattice.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,18 @@ def __init__(
7373
self._lll_matrix_mappings: dict[float, tuple[np.ndarray, np.ndarray]] = {}
7474
self._lll_inverse = None
7575

76-
self.pbc = pbc
76+
self._pbc = tuple(bool(item) for item in pbc)
77+
78+
@property
79+
def pbc(self) -> tuple[bool, bool, bool]:
80+
"""Tuple defining the periodicity of the Lattice."""
81+
return self._pbc # type:ignore[return-value]
82+
83+
@pbc.setter
84+
def pbc(self, pbc: tuple[bool, bool, bool]) -> None:
85+
if len(pbc) != 3 or any(item not in {True, False} for item in pbc):
86+
raise ValueError(f"pbc must be a tuple of three True/False values, got {pbc}")
87+
self._pbc = tuple(bool(item) for item in pbc)
7788

7889
def __repr__(self) -> str:
7990
return "\n".join(

0 commit comments

Comments
 (0)