Skip to content

Upstream TorchSim model interface#277

Draft
CompRhys wants to merge 2 commits intoMDIL-SNU:mainfrom
CompRhys:main
Draft

Upstream TorchSim model interface#277
CompRhys wants to merge 2 commits intoMDIL-SNU:mainfrom
CompRhys:main

Conversation

@CompRhys
Copy link
Contributor

Hello, we think ts is getting to a fairly mature point now and we would like to encourge what we have called external model posture similar to ase (TorchSim/torch-sim#120) I have made this PR as a basic demo of what an external implementation might look like for SevenNet TorchSim/torch-sim#429.

I made some basic changes to the CI to add linting and using uv for test env such that ts will resolve properly for > py312 whilst still pointing to the external model PR. Draft until that PR get's merged/0.5.2 release.

@YutackPark
Copy link
Member

Thanks for reaching out. We also have colleauge who are using torch_sim for his research, so having SevenNet maintain this is reasonable. I have a few questions regarding this PR.

  1. Compared to a ASE calculator interface, the interface required by TorchSim is likely to be more complex given its focus on optimization. Is there any developer documentation or guidance (or in preparation)? In my opinion, developers may need official benchmark script that compares ASE calculator and torchsim to test validity of their implementation.

  2. Regarding
    https://github.com/TorchSim/torch-sim/blob/main/torch_sim/models/interface.py
    is this interface considered complete at this point, or is it still expected to change before the next release?

  3. Is there a planned timeline for deprecating the existing SevenNet code inside TorchSim? I need this information to add a torch sim page in our docs.

@CompRhys
Copy link
Contributor Author

CompRhys commented Feb 1, 2026

  1. Compared to a ASE calculator interface, the interface required by TorchSim is likely to be more complex given its focus on optimization. Is there any developer documentation or guidance (or in preparation)? In my opinion, developers may need official benchmark script that compares ASE calculator and torchsim to test validity of their implementation.

This is a complete PR for the whole interface and it already includes a test factory to check the ASE calculator against the model interface for a suite of SimState. Here due to a divide by zero issue I omitted testing on the molecule state with non pbc boundary conditions. There were two known issues with sevennet which were that trying to cast to float64 failed and this divide by zero error when there is no cell.

I am of the opinion that the ts interface is just as simple as ASE. You take in a SimState and then return it with energy, force and stress predictions. Whether or not the model prediction is batched by an implementation isn't enforced by the interface. All the MD/Relax etc are then batched but the main speed-ups come from avoiding the serial model calls as you have with ASE.

  1. Regarding
    https://github.com/TorchSim/torch-sim/blob/main/torch_sim/models/interface.py
    is this interface considered complete at this point, or is it still expected to change before the next release?

The interface as it is has been stable since July 2025 when we renamed batch -> system_idx.

  1. Is there a planned timeline for deprecating the existing SevenNet code inside TorchSim? I need this information to add a torch sim page in our docs.

Plan is just to wrap upstream implementations to keep existing scripts backward compatible. If we did decide to remove the models from the ts namespace in the future we would likely post a similar discussion issue 3-6 months in advance.

)

data_list = []
for sys_idx in range(n_systems):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

2 participants