We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 255852f commit c7dc381Copy full SHA for c7dc381
src/pymatgen/core/lattice.py
@@ -73,7 +73,18 @@ def __init__(
73
self._lll_matrix_mappings: dict[float, tuple[np.ndarray, np.ndarray]] = {}
74
self._lll_inverse = None
75
76
- self.pbc = pbc
+ 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
88
89
def __repr__(self) -> str:
90
return "\n".join(
0 commit comments