Added the nvalchemi-toolkit UPETWrapper interface - #156
Conversation
|
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: torch-sim dependency: 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. |
`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
This PR adds a support for
nvalchemi-toolkitsimulation engine and introduces theUPETWrapperclass that allows to connect the UPET models to thenvalchemiecosystem. Additionally the PR rearranges the project scaffold for a better modularity.