Skip to content

Commit 5dcc5a6

Browse files
committed
add type checking and fix pbc type in dataclass def
1 parent 50417d3 commit 5dcc5a6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

torch_sim/state.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class SimState:
8282
positions: torch.Tensor
8383
masses: torch.Tensor
8484
cell: torch.Tensor
85-
pbc: torch.Tensor
85+
pbc: torch.Tensor | list[bool] | bool
8686
atomic_numbers: torch.Tensor
8787
system_idx: torch.Tensor | None = field(default=None)
8888

@@ -93,6 +93,11 @@ def system_idx(self) -> torch.Tensor:
9393
"""A getter for system_idx that tells type checkers it's always defined."""
9494
return self.system_idx
9595

96+
@property
97+
def pbc(self) -> torch.Tensor:
98+
"""A getter for pbc that tells type checkers it's always defined."""
99+
return self.pbc
100+
96101
_atom_attributes: ClassVar[set[str]] = {
97102
"positions",
98103
"masses",

0 commit comments

Comments
 (0)