Skip to content

Commit 657ea73

Browse files
committed
add warnings to deprecated attributes
1 parent 9a1b87e commit 657ea73

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

torch_sim/state.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ def n_atoms_per_batch(self) -> torch.Tensor:
169169
deprecated::
170170
Use :attr:`n_atoms_per_system` instead.
171171
"""
172+
warnings.warn(
173+
"n_atoms_per_batch is deprecated, use n_atoms_per_system instead",
174+
DeprecationWarning,
175+
stacklevel=2,
176+
)
172177
return self.n_atoms_per_system
173178

174179
@property
@@ -178,6 +183,11 @@ def batch(self) -> torch.Tensor | None:
178183
deprecated::
179184
Use :attr:`system_idx` instead.
180185
"""
186+
warnings.warn(
187+
"batch is deprecated, use system_idx instead",
188+
DeprecationWarning,
189+
stacklevel=2,
190+
)
181191
return self.system_idx
182192

183193
@batch.setter
@@ -187,6 +197,11 @@ def batch(self, system_idx: torch.Tensor) -> None:
187197
deprecated::
188198
Use :attr:`system_idx` instead.
189199
"""
200+
warnings.warn(
201+
"Setting batch is deprecated, use system_idx instead",
202+
DeprecationWarning,
203+
stacklevel=2,
204+
)
190205
self.system_idx = system_idx
191206

192207
@property
@@ -196,6 +211,11 @@ def n_batches(self) -> int:
196211
deprecated::
197212
Use :attr:`n_systems` instead.
198213
"""
214+
warnings.warn(
215+
"n_batches is deprecated, use n_systems instead",
216+
DeprecationWarning,
217+
stacklevel=2,
218+
)
199219
return self.n_systems
200220

201221
@property

0 commit comments

Comments
 (0)