Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions torch_sim/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,11 @@ def wrap_positions(self) -> torch.Tensor:
"""Atomic positions wrapped according to periodic boundary conditions if pbc=True,
otherwise returns unwrapped positions with shape (n_atoms, 3).
"""
# TODO: implement a wrapping method
return self.positions
if not self.pbc:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now self.pbc is a Boolean (3,) shaped Tensor. So this expression won't work here. I don't think this piece of code should need a test, a static typing check would have catched that. replace with if not self.pbc.any()

return self.positions
return ts.transforms.pbc_wrap_batched(
self.positions, self.cell, self.system_idx, self.pbc
)

@property
def device(self) -> torch.device:
Expand Down