Per-system pbc: batching periodic and non-periodic systems together

Open
#584 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@lil-lon is already working on this.

Since Jul 25, 2026.

  • #594 by @lil-lon — open

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python, pytorch
Domain
backend

Research direction

Start by reading the discussion in PR #320 and the referenced batch_naive_neighbor_list API, which accepts per-system pbc. Then identify how torch-sim currently represents periodic boundary conditions and where that value reaches neighbor-list calculations. Done means agreeing on a direction and supporting mixed periodic and non-periodic systems in one batch; the issue does not specify an implementation or tests.

Written by the indexing model from the issue text.

Description

enhancement

In the review of #320 there was a short discussion about making pbc a per-system attribute so that systems with different pbc can be mixed in one batch (https://github.com/TorchSim/torch-sim/pull/320#issuecomment-3500245561).
It was deferred to a separate issue at the time, but I don't think that issue was ever opened, so raising it here.

I think this would be a useful addition. One concern in that discussion was that mixed pbc may complicate the neighbor list calculations (https://github.com/TorchSim/torch-sim/pull/320#issuecomment-3508563598), but the current neighbor list API already supports per-system pbc (e.g. batch_naive_neighbor_list in nvalchemi-toolkit-ops takes pbc of shape (num_systems, 3): https://github.com/NVIDIA/nvalchemi-toolkit-ops/blob/2b7c3c3adfb1ca84b886eecbf14bc60ff6ba1dc2/nvalchemiops/torch/neighbors/batch_naive.py#L765-L767), and I think other methods support similar APIs, so it can be handled without making the neighbor list logic so complicated.

What do you think? If we agree on a direction I'd be happy to work on a PR.

Dominant language
Python
Stars
502
Forks
108
Avg merge
1d 1h
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TorchSim/torch-sim

All issues in TorchSim/torch-sim

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.