feat: add TorchSim integration#155
Merged
Merged
Conversation
Add a convenience function that wraps Potential.from_checkpoint() with gradient checkpointing support and automatic version normalization from checkpoint paths. Exported from mattersim.forcefield. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port TorchSim support from the internal repo, providing GPU-accelerated batch molecular dynamics and structure relaxation via torch-sim. New package: mattersim.torchsim - TorchSimWrapper: adapts MatterSim Potential as a TorchSim ModelInterface - TorchSimBatchMD: batch MD with NVT/NPT integrators, temperature schedules - TorchSimBatchRelaxer: batch structure optimization with FIRE/etc. - Settings classes (IntegratorSettings, OptimizerSettings) with validation - Trajectory loading/saving via TorchSim H5MD format - Graph construction bridge (build_graph_from_simstate) - Model loading with AOTI compilation support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
27 tests covering settings validation, TorchSimWrapper forward pass, batch relaxation (file + in-memory), batch MD with multiple integrators, trajectory continuation, per-system temperature schedules, and trajectory loader convenience constructors. GPU-heavy tests are marked @slow and @requires_gpu so they are skipped on CPU-only machines. Also adds mattersim_potential_best_device fixture to conftest.py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
load_mattersim now always sets Potential.version so the pre-computed autobatcher memory scaler table is used instead of falling back to slow runtime memory estimation. - Default checkpoint (load_path=None) gets 'mattersim-v1.0.0-1M' - Explicit paths are normalized to canonical version strings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Since requires-python is now >=3.12 (for torch-sim-atomistic), the python_version < 3.10 dependency conditionals for emmet-core and numpy are unreachable. Simplify to unconditional versions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop Python 3.10 from CI matrix since requires-python is now >=3.12. Add Python 3.13 to the test matrix. Update macOS job to 3.12. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only build wheels for Python 3.12 and 3.13 since torch-sim-atomistic requires Python >=3.12. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update badge, prerequisite, and conda create example to reflect the new minimum Python 3.12 requirement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…, cibuildwheel Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
23c4659 to
3abacda
Compare
Remove the batch runner infrastructure (TorchSimBatchRunner, TorchSimBatchMD, TorchSimBatchRelaxer), their settings classes (IntegratorSettings, OptimizerSettings), trajectory loaders, and associated tests. Keep the core TorchSim wrapper (TorchSimWrapper, graph_construction, model_loading) that adapts MatterSim potentials as TorchSim ModelInterface. Deleted files: - src/mattersim/torchsim/base.py - src/mattersim/torchsim/batch_relax.py - src/mattersim/torchsim/md.py - src/mattersim/torchsim/settings.py - src/mattersim/torchsim/settings_base.py - src/mattersim/torchsim/trajectory_loader.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add user guide for running structure relaxation and molecular dynamics using the TorchSim backend with MatterSim potentials. Covers wrapper creation, optimization, MD with various integrators, and trajectory saving. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use correct parameter name 'force_tol' (not 'fmax') and drop 'include_cell_forces' from the minimal example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
flt17
reviewed
May 6, 2026
flt17
reviewed
May 6, 2026
flt17
reviewed
May 6, 2026
flt17
approved these changes
May 6, 2026
Contributor
flt17
left a comment
There was a problem hiding this comment.
LGTM, a few minor things only.
danielzuegner
approved these changes
May 7, 2026
emmet-core is not imported anywhere in the codebase. Removing the dead dependency per review feedback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace load_mattersim() calls in model_loading.py with direct Potential.from_checkpoint() + enable_gradient_checkpointing() calls. Remove load_mattersim from forcefield __init__.py exports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove internal-only NaN sanitization logic per review feedback. Removed from TorchSimWrapper and get_torchsim_wrapper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
float64 support belongs to PR #156. For now use the wrapper's default float32 in model_loading and doc examples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Port TorchSim support from the internal repo, providing a GPU-accelerated model wrapper that adapts MatterSim potentials as a TorchSim
ModelInterface.Breaking Change: Python >=3.12 Required
torch-sim-atomisticrequires Python 3.12+, sorequires-pythonhas been bumped from>=3.10to>=3.12. All CI pipelines, docs, README, MODEL_CARD, environment.yaml, and cibuildwheel config have been updated accordingly.Changes
New package:
mattersim.torchsimTorchSimWrapper: adapts MatterSim Potential as a TorchSim ModelInterfacebuild_graph_from_simstate)get_torchsim_wrapper)New documentation
docs/user_guide/torchsim.rst: user guide covering wrapper creation, structure relaxation withts.optimize(), molecular dynamics withts.integrate(), and trajectory savingDependencies
torch-sim-atomistic>=0.6.0as required dependencyemmet-coredependencyrequires-pythonfrom>=3.10to>=3.12CI/CD
Tests
Package import smoke test and TorchSimWrapper forward pass test. GPU tests marked
@slowand@requires_gpu.