Skip to content

Added the nvalchemi-toolkit UPETWrapper interface - #156

Merged
abmazitov merged 18 commits into
lab-cosmo:mainfrom
abmazitov:add-nvalchemi-toolkit-wrapper
Sep 8, 2026
Merged

abmazitov merged 18 commits into
lab-cosmo:mainfrom
abmazitov:add-nvalchemi-toolkit-wrapper

Conversation

@abmazitov

Copy link
Copy Markdown
Collaborator

This PR adds a support for nvalchemi-toolkit simulation engine and introduces the UPETWrapper class that allows to connect the UPET models to the nvalchemi ecosystem. Additionally the PR rearranges the project scaffold for a better modularity.

@abmazitov abmazitov changed the title Added the nvalchemi-toolkit UPETWrapper interface and rearranged the project Added the nvalchemi-toolkit UPETWrapper interface Jul 17, 2026
@VondrakMar

Copy link
Copy Markdown

Hey @abmazitov, I would like to use torch-sim together with upet, and potentially add d3 on top. This runs into a conflict between the requirements, though:

Your dependency:
"nvalchemi-toolkit-ops>=0.3.0,<0.4.0"

torch-sim dependency:
"nvalchemi-toolkit-ops[torch]>=0.4.0"

Do you know why the <0.4.0 upper bound is there? And if I remove it and use "native" upet only with d3 added on top, would that cause any issues?

Thanks

@abmazitov

Copy link
Copy Markdown
Collaborator Author

Hey @abmazitov, I would like to use torch-sim together with upet, and potentially add d3 on top. This runs into a conflict between the requirements, though:

Your dependency:

"nvalchemi-toolkit-ops>=0.3.0,<0.4.0"

torch-sim dependency:

"nvalchemi-toolkit-ops[torch]>=0.4.0"

Do you know why the <0.4.0 upper bound is there? And if I remove it and use "native" upet only with d3 added on top, would that cause any issues?

Thanks

Hey @VondrakMar , thanks for raising this question. We are currently fixing a bug in one of our dependencies (metatomic), which forced us yanking the latest releases of metatomic and this is why we have a relatively old nvalchemi-toolkit-ops version restriction.

You can try manually installing the version required by torch-sim and ignore the version conflict warnings, I expect it to work smoothly anyway. Please let us know if it works.

The version restriction was deliberate because the package is still in early WIP state and the API was changing quite frequently.

P.S.
Please next time open an issue or a ticket in GH discussions, as this thread is currently happening in the unrelated PR

abmazitov and others added 12 commits September 1, 2026 17:53
`tests/nvalchemi/test_md.py` runs 10 steps of Langevin NVT on a random
periodic system through `UPETWrapper` + `nvalchemi.dynamics.NVTLangevin`,
with a `NeighborListHook` rebuilding the list as the atoms move.

Running it surfaced a bug in `UPETWrapper.forward`: `adapt_input` stores
its gradient-enabled clone of `positions` back on the batch, and forward
only restored the caller's tensor on the stress path. With forces-only
outputs (the natural MD setting) the batch was left holding a
`requires_grad` tensor; the integrator's in-place update then made it a
non-leaf, and the next step failed in `requires_grad_ctx`. Forward now
restores the caller's positions unconditionally.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013kE99tRXYEJUogUKof4gRW
@abmazitov
abmazitov merged commit 5382657 into lab-cosmo:main Sep 8, 2026
12 checks passed
@abmazitov
abmazitov deleted the add-nvalchemi-toolkit-wrapper branch September 8, 2026 20:03
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