Skip to content

Implement SimState.wrap_positions using pbc_wrap_batched#350

Merged
CompRhys merged 5 commits intoTorchSim:mainfrom
Praagnya:wrap-positions-property
Feb 5, 2026
Merged

Implement SimState.wrap_positions using pbc_wrap_batched#350
CompRhys merged 5 commits intoTorchSim:mainfrom
Praagnya:wrap-positions-property

Conversation

@Praagnya
Copy link
Contributor

@Praagnya Praagnya commented Nov 22, 2025

Summary

  • Implemented SimState.wrap_positions property using ts.transforms.pbc_wrap_batched to properly wrap atomic positions according to periodic boundary conditions.

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
  • Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.

Resolves #343

@Praagnya
Copy link
Contributor Author

@thomasloux Could you please review this? I created a new branch without the test since my previous commits got messy after other changes in my fork. So I opened a clean PR.

@orionarcher
Copy link
Collaborator

Could you link the other PR for context?

@Praagnya
Copy link
Contributor Author

Previous PR: #345

"""
# 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()

@thomasloux
Copy link
Collaborator

For reference of use of static check #339

@CompRhys CompRhys dismissed thomasloux’s stale review February 5, 2026 14:22

I have addressed the blocking comment on this abandoned PR

Copy link
Collaborator

@thomasloux thomasloux left a comment

Choose a reason for hiding this comment

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

Not sure the tests are super necessary, but good for me.

@CompRhys CompRhys merged commit c5d4c30 into TorchSim:main Feb 5, 2026
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SimState.wrap_positions

4 participants