Repository navigation
metatomic: run models through metatomic-core - #3
Closed
EricBoittier wants to merge 9 commits into
Closed
EricBoittier wants to merge 9 commits into
EricBoittier wants to merge 9 commits into
Conversation
Split the METATOMIC action into a front-end (MetatomicAction.h) and two backends. The existing TorchScript code moves into TorchBackend, and the new CoreBackend (metatomic_core.cpp) runs models through the C++ API of metatomic-core, without torch. CoreBackend is used as soon as PLUGIN_LIBRARY or PLUGIN is given. It registers the plugin libraries, loads MODEL through the requested plugin, builds a metatomic System sharing PLUMED's positions and cell through DLPack, adds the pair lists requested by the model (computed with vesin), and requests the `feature` output (or `feature/<VARIANT>`) with explicit positions and strain gradients, which give the forces and the virial. It also handles unit conversion, float32 models, SELECTED_ATOMS, per-atom outputs and CHECK_CONSISTENCY, and rejects options it does not support yet (extra inputs, DEVICE, EXTENSIONS_DIRECTORY). module.md documents plugin models and how to configure PLUMED for them.
Add the --enable-libmetatomic-core configure option, which probes the metatomic-core C++ API (metatomic::load_model / metatomic::execute_model) and links libmetatomic and libmetatensor without requiring libtorch. It defines __PLUMED_HAS_LIBMETATOMIC_CORE and the libmetatomic_core config key. Add regtest/metatomic/rt-core, a two-atom distance model written as a metatomic.NumpyModel Python script and loaded through metatomic's Python plugin, with explicit positions and strain gradients. The second frame crosses the periodic boundary. Document plugin models in the METATOMIC action and the module page, recommending Python NumpyModel scripts and linking PLUMED against the libmetatomic shipped in the metatomic-core Python package.
…ndings Stop including the libtorch, metatensor-torch and metatomic-torch headers in the METATOMIC action, and include <metatensor.hpp> and <metatomic.hpp> instead. Rename metatomic.cpp to MetatomicAction.cpp, so that MetatomicAction.h has a matching source file as required by plumedcheck.
`sorted` was never set, so vesin read an uninitialised bool (cppcheck uninitvar).
Add the --enable-libmetatomic-core configure option, which probes the metatomic-core C++ API (metatomic::load_model / metatomic::execute_model) and links libmetatomic and libmetatensor without requiring libtorch. It defines __PLUMED_HAS_LIBMETATOMIC_CORE and the libmetatomic_core config key. Add regtest/metatomic/rt-core, a two-atom distance model written as a metatomic.NumpyModel Python script and loaded through metatomic's Python plugin, with explicit positions and strain gradients. The second frame crosses the periodic boundary. Document plugin models in the METATOMIC action and the module page, recommending Python NumpyModel scripts and linking PLUMED against the libmetatomic shipped in the metatomic-core Python package. metatomic: include the metatomic-core headers instead of the torch bindings Stop including the libtorch, metatensor-torch and metatomic-torch headers in the METATOMIC action, and include <metatensor.hpp> and <metatomic.hpp> instead. Rename metatomic.cpp to MetatomicAction.cpp, so that MetatomicAction.h has a matching source file as required by plumedcheck. metatomic: value-initialise VesinOptions `sorted` was never set, so vesin read an uninitialised bool (cppcheck uninitvar). Test per-atom gradients and fix sample label iteration Load legacy models through metatomic-core and share one Python runtime type mismatches in MetatomicAction.cpp, found by bot, constructor cast added as fix.
…plumed2 into plumed/core-review
Owner
Author
|
Closing: staging PR, the work continues in plumed#1510. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ports the METATOMIC action to metatomic-core, the new C API of metatomic. It is the cleaned-up history of plumed#1510 (left untouched), plus the per-atom gradient tests and legacy-model loading from fork PRs #1 and #2. It is rebased on current upstream
master(c2a5cd1).featurewith explicit position/strain gradients → forces and virial, units, float32,SELECTED_ATOMS,CHECK_CONSISTENCY). Plusmodule.md--enable-libmetatomic-coreconfigure check and a plugin-model regtest (rt-core)<metatensor.hpp>/<metatomic.hpp>instead of the torch bindings. Renamemetatomic.cpp→MetatomicAction.cppso the header has a matching source (plumedcheck)VesinOptionsHistory cleanup
src/tools/LinkCells.cppis dropped.Diff check against the pre-rebase branch (
backup/core-review):LinkCells.cpp, plus upstream's own changes toconfigure,configure.acandlinuxWF.yml. This branch's added and removed lines inlinuxWF.ymlare unchanged.master.The fork's
masterwas fast-forwarded to upstream first, so this diff shows only these commits. Not built locally: fork CI covers it.