lammps-mdi 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. lammps_mdi-0.1.0/.github/workflows/BranchCI.yaml +50 -0
  2. lammps_mdi-0.1.0/.github/workflows/CI.yaml +85 -0
  3. lammps_mdi-0.1.0/.github/workflows/CodeQL.yaml +12 -0
  4. lammps_mdi-0.1.0/.github/workflows/Release.yaml +108 -0
  5. lammps_mdi-0.1.0/.gitignore +152 -0
  6. lammps_mdi-0.1.0/HISTORY.md +58 -0
  7. lammps_mdi-0.1.0/INSTALL.md +237 -0
  8. lammps_mdi-0.1.0/LICENSE +30 -0
  9. lammps_mdi-0.1.0/Makefile +165 -0
  10. lammps_mdi-0.1.0/PKG-INFO +225 -0
  11. lammps_mdi-0.1.0/README.md +149 -0
  12. lammps_mdi-0.1.0/pyproject.toml +121 -0
  13. lammps_mdi-0.1.0/setup.cfg +15 -0
  14. lammps_mdi-0.1.0/src/lammps_mdi/__init__.py +40 -0
  15. lammps_mdi-0.1.0/src/lammps_mdi/_version.py +24 -0
  16. lammps_mdi-0.1.0/src/lammps_mdi/cli.py +174 -0
  17. lammps_mdi-0.1.0/src/lammps_mdi/cuda_utils.py +202 -0
  18. lammps_mdi-0.1.0/src/lammps_mdi/mace_mdi.py +644 -0
  19. lammps_mdi-0.1.0/src/lammps_mdi/scripts/__init__.py +0 -0
  20. lammps_mdi-0.1.0/src/lammps_mdi/scripts/cpu_bind.sh +42 -0
  21. lammps_mdi-0.1.0/src/lammps_mdi/scripts/gpu_bind.sh +53 -0
  22. lammps_mdi-0.1.0/src/lammps_mdi/scripts/mdi_bind.sh +109 -0
  23. lammps_mdi-0.1.0/src/lammps_mdi/scripts/mdi_monitor.sh +47 -0
  24. lammps_mdi-0.1.0/src/lammps_mdi.egg-info/PKG-INFO +225 -0
  25. lammps_mdi-0.1.0/src/lammps_mdi.egg-info/SOURCES.txt +29 -0
  26. lammps_mdi-0.1.0/src/lammps_mdi.egg-info/dependency_links.txt +1 -0
  27. lammps_mdi-0.1.0/src/lammps_mdi.egg-info/entry_points.txt +3 -0
  28. lammps_mdi-0.1.0/src/lammps_mdi.egg-info/requires.txt +23 -0
  29. lammps_mdi-0.1.0/src/lammps_mdi.egg-info/top_level.txt +1 -0
  30. lammps_mdi-0.1.0/tests/test_basic.py +149 -0
@@ -0,0 +1,50 @@
1
+ name: BranchCI
2
+
3
+ # Runs on pushes to any branch except main/master.
4
+ # Uses pip (not conda) because lammps-mdi is designed for HPC Python
5
+ # environments, not conda. Only lightweight tests (no GPU, no torch)
6
+ # are run here; the full runtime tests require an HPC system.
7
+
8
+ on:
9
+ push:
10
+ branches-ignore:
11
+ - 'main'
12
+ - 'master'
13
+
14
+ jobs:
15
+ lint-and-test:
16
+ name: Lint & lightweight tests (ubuntu / Py${{ matrix.python-version }})
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ matrix:
20
+ python-version: ["3.11", "3.12"]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ - name: Install build tools and linters
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install black flake8 ruff
34
+
35
+ - name: Run linters
36
+ run: |
37
+ black --check --diff --extend-exclude '_version.py' src/lammps_mdi tests
38
+ flake8 src/lammps_mdi tests
39
+
40
+ - name: Install package (lightweight deps only — no torch/mace)
41
+ # pymdi, mace-torch, and torch are intentionally excluded here;
42
+ # the tests that need them are guarded with pytest.importorskip.
43
+ run: |
44
+ pip install pint matscipy
45
+ pip install --no-deps -e .
46
+
47
+ - name: Run lightweight tests
48
+ run: |
49
+ pip install pytest pytest-cov
50
+ pytest -v --cov=lammps_mdi --cov-report=term --color=yes tests/
@@ -0,0 +1,85 @@
1
+ name: CI
2
+
3
+ # Runs on PRs to main and on pushes to main.
4
+ # Two jobs:
5
+ # lint-test — linting + lightweight tests (no GPU required)
6
+ # typecheck — mypy (optional, non-blocking for now)
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - "main"
12
+ pull_request:
13
+ branches:
14
+ - "main"
15
+ workflow_dispatch:
16
+
17
+ jobs:
18
+ lint-test:
19
+ name: Lint & lightweight tests (ubuntu / Py${{ matrix.python-version }})
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ matrix:
23
+ python-version: ["3.11", "3.12"]
24
+
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ with:
28
+ fetch-depth: 0 # full history for setuptools-scm
29
+
30
+ - name: Set up Python ${{ matrix.python-version }}
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: ${{ matrix.python-version }}
34
+
35
+ - name: Install build tools and linters
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install black flake8 ruff
39
+
40
+ - name: Run linters
41
+ run: |
42
+ black --check --diff --extend-exclude '_version.py' src/lammps_mdi tests
43
+ flake8 src/lammps_mdi tests
44
+
45
+ - name: Install package (lightweight deps only — no torch/mace)
46
+ # torch, mace-torch, and pymdi are intentionally absent;
47
+ # runtime tests that need them are guarded with pytest.importorskip.
48
+ run: |
49
+ pip install pint matscipy
50
+ pip install --no-deps -e .
51
+
52
+ - name: Run lightweight tests
53
+ run: |
54
+ pip install pytest pytest-cov
55
+ pytest -v --cov=lammps_mdi --cov-report=xml --cov-report=term --color=yes tests/
56
+
57
+ - name: Upload coverage report
58
+ uses: codecov/codecov-action@v4
59
+ with:
60
+ file: ./coverage.xml
61
+ flags: unittests
62
+ name: codecov-ubuntu-py${{ matrix.python-version }}
63
+ continue-on-error: true # don't fail CI if codecov is down
64
+
65
+ typecheck:
66
+ name: mypy type checks
67
+ runs-on: ubuntu-latest
68
+ continue-on-error: true # informational only until typing is complete
69
+
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+
73
+ - name: Set up Python 3.12
74
+ uses: actions/setup-python@v5
75
+ with:
76
+ python-version: "3.12"
77
+
78
+ - name: Install mypy and stubs
79
+ run: |
80
+ pip install mypy pint matscipy
81
+ pip install --no-deps -e .
82
+
83
+ - name: Run mypy (lightweight modules only)
84
+ run: |
85
+ mypy src/lammps_mdi/cuda_utils.py src/lammps_mdi/cli.py
@@ -0,0 +1,12 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ codeql:
11
+ name: CodeQL
12
+ uses: molssi-seamm/devops/.github/workflows/CodeQL.yaml@main
@@ -0,0 +1,108 @@
1
+ name: Release
2
+
3
+ # Triggered when a GitHub release is published.
4
+ # Runs lint + lightweight tests, then deploys to Test PyPI and PyPI.
5
+ # Documentation deployment is commented out until docs are set up.
6
+
7
+ on:
8
+ release:
9
+ types: [published]
10
+
11
+ jobs:
12
+ lint-test:
13
+ name: Lint & lightweight tests (ubuntu / Py3.12)
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0 # full history for setuptools-scm version tags
20
+
21
+ - name: Set up Python 3.12
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+
26
+ - name: Install linters
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install black flake8
30
+
31
+ - name: Run linters
32
+ run: |
33
+ black --check --diff --extend-exclude '_version.py' src/lammps_mdi tests
34
+ flake8 src/lammps_mdi tests
35
+
36
+ - name: Install package (lightweight deps only)
37
+ run: |
38
+ pip install pint matscipy
39
+ pip install --no-deps -e .
40
+
41
+ - name: Run lightweight tests
42
+ run: |
43
+ pip install pytest
44
+ pytest -v --color=yes tests/
45
+
46
+ deploy:
47
+ name: Build and publish to PyPI
48
+ runs-on: ubuntu-latest
49
+ needs: lint-test
50
+ environment: pypi # requires PyPI trusted publisher or secrets configured
51
+
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+ with:
55
+ fetch-depth: 0 # full history so setuptools-scm reads the git tag
56
+
57
+ - name: Set up Python 3.12
58
+ uses: actions/setup-python@v5
59
+ with:
60
+ python-version: "3.12"
61
+
62
+ - name: Install build tools
63
+ run: |
64
+ python -m pip install --upgrade pip
65
+ pip install build twine
66
+
67
+ - name: Build source and wheel
68
+ run: |
69
+ python -m build --sdist --wheel --outdir dist/
70
+ ls -l dist/
71
+ twine check dist/*
72
+
73
+ - name: Publish to Test PyPI
74
+ uses: pypa/gh-action-pypi-publish@release/v1
75
+ with:
76
+ repository-url: https://test.pypi.org/legacy/
77
+ password: ${{ secrets.TEST_PYPI_PASSWORD }}
78
+ skip-existing: true
79
+
80
+ - name: Publish to PyPI
81
+ # Skip dev and rc releases (e.g. v0.1.0.dev1, v0.1.0rc1)
82
+ if: |
83
+ !contains(github.ref, 'dev') && !contains(github.ref, 'rc')
84
+ uses: pypa/gh-action-pypi-publish@release/v1
85
+ with:
86
+ password: ${{ secrets.PYPI_PASSWORD }}
87
+
88
+ # ---------------------------------------------------------------------------
89
+ # Documentation deployment — enable once docs/ is set up
90
+ # ---------------------------------------------------------------------------
91
+ # docs:
92
+ # name: Deploy documentation
93
+ # runs-on: ubuntu-latest
94
+ # needs: lint-test
95
+ # steps:
96
+ # - uses: actions/checkout@v4
97
+ # - uses: actions/setup-python@v5
98
+ # with:
99
+ # python-version: "3.12"
100
+ # - name: Install docs dependencies
101
+ # run: pip install pint matscipy sphinx sphinx-rtd-theme && pip install --no-deps -e .
102
+ # - name: Build HTML docs
103
+ # run: make html
104
+ # - name: Deploy to GitHub Pages
105
+ # uses: peaceiris/actions-gh-pages@v4
106
+ # with:
107
+ # github_token: ${{ secrets.GITHUB_TOKEN }}
108
+ # publish_dir: docs/_build/html
@@ -0,0 +1,152 @@
1
+ # -*- mode: gitignore; -*-
2
+
3
+ ## emacs: https://github.com/github/gitignore/blob/master/Global/Emacs.gitignore
4
+ *~
5
+ \#*\#
6
+ /.emacs.desktop
7
+ /.emacs.desktop.lock
8
+ *.elc
9
+ auto-save-list
10
+ tramp
11
+ .\#*
12
+
13
+ # vcs_versioning
14
+ _version.py
15
+
16
+ # Org-mode
17
+ .org-id-locations
18
+ *_archive
19
+
20
+ # flymake-mode
21
+ *_flymake.*
22
+
23
+ # eshell files
24
+ /eshell/history
25
+ /eshell/lastdir
26
+
27
+ # elpa packages
28
+ /elpa/
29
+
30
+ # reftex files
31
+ *.rel
32
+
33
+ # AUCTeX auto folder
34
+ /auto/
35
+
36
+ # cask packages
37
+ .cask/
38
+ dist/
39
+
40
+ # Flycheck
41
+ flycheck_*.el
42
+
43
+ # server auth directory
44
+ /server/
45
+
46
+ # projectiles files
47
+ .projectile
48
+
49
+ # directory configuration
50
+ .dir-locals.el
51
+
52
+ # network security
53
+ /network-security.data
54
+ ## end of emacs
55
+
56
+ # Byte-compiled / optimized / DLL files
57
+ __pycache__/
58
+ *.py[cod]
59
+ *$py.class
60
+
61
+ ## macOS useful to ignore https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
62
+ *.DS_Store
63
+ .AppleDouble
64
+ .LSOverride
65
+
66
+ # Thumbnails
67
+ ._*
68
+
69
+ # Files that might appear in the root of a volume
70
+ .DocumentRevisions-V100
71
+ .fseventsd
72
+ .Spotlight-V100
73
+ .TemporaryItems
74
+ .Trashes
75
+ .VolumeIcon.icns
76
+ .com.apple.timemachine.donotpresent
77
+
78
+ # Directories potentially created on remote AFP share
79
+ .AppleDB
80
+ .AppleDesktop
81
+ Network Trash Folder
82
+ Temporary Items
83
+ .apdisk
84
+ ## end of macOS
85
+
86
+ # C extensions
87
+ *.so
88
+
89
+ # Distribution / packaging
90
+ .Python
91
+ env/
92
+ build/
93
+ develop-eggs/
94
+ dist/
95
+ downloads/
96
+ eggs/
97
+ .eggs/
98
+ lib/
99
+ lib64/
100
+ parts/
101
+ sdist/
102
+ var/
103
+ *.egg-info/
104
+ .installed.cfg
105
+ *.egg
106
+
107
+ # PyInstaller
108
+ # Usually these files are written by a python script from a template
109
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
110
+ *.manifest
111
+ *.spec
112
+
113
+ # Installer logs
114
+ pip-log.txt
115
+ pip-delete-this-directory.txt
116
+
117
+ # Unit test / coverage reports
118
+ htmlcov/
119
+ .tox/
120
+ .coverage
121
+ .coverage.*
122
+ .cache
123
+ nosetests.xml
124
+ coverage.xml
125
+ *,cover
126
+ .hypothesis/
127
+
128
+ # Translations
129
+ *.mo
130
+ *.pot
131
+
132
+ # Django stuff:
133
+ *.log
134
+
135
+ # Sphinx documentation
136
+ docs/_build/
137
+
138
+ # IntelliJ Idea family of suites
139
+ .idea
140
+ *.iml
141
+ ## File-based project format:
142
+ *.ipr
143
+ *.iws
144
+ ## mpeltonen/sbt-idea plugin
145
+ .idea_modules/
146
+
147
+ # PyBuilder
148
+ target/
149
+
150
+ # Cookiecutter
151
+ output/
152
+ python_boilerplate/
@@ -0,0 +1,58 @@
1
+ # History
2
+
3
+ All notable changes to **lammps-mdi** are recorded here.
4
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
+ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ---
8
+
9
+ ## [0.1.0] — 2026-03-30
10
+
11
+ First public release.
12
+
13
+ ### Added
14
+
15
+ - `MACEEngine`: MDI engine that runs MACE-torch models, communicating
16
+ with a LAMMPS driver process via MPI-MDI. Bypasses the ASE Calculator
17
+ interface for lower per-step overhead, building model inputs directly
18
+ from MDI data.
19
+ - Automatic selection between **vesin-torch** (GPU-accelerated) and
20
+ **matscipy** (CPU fallback) neighbor list backends.
21
+ - Optional **cuEquivariance** (`--enable-cueq`) and
22
+ **openEquivariance** (`--enable-oeq`) acceleration for MACE.
23
+ - All heavy runtime dependencies (`torch`, `mdi`, `mpi4py`, `mace`,
24
+ `numpy`, `vesin`, `matscipy`) are imported lazily so the package is
25
+ importable on any machine without a GPU.
26
+ - Bundled shell scripts for CPU/GPU resource binding on HPC clusters:
27
+ - `mdi_bind.sh` — binds engine (rank 0) to GPU + NUMA-local CPUs and
28
+ driver (rank 1) to adjacent CPUs; starts nvidia-smi monitor.
29
+ For standalone machines.
30
+ - `mdi_monitor.sh` — lightweight wrapper for SLURM/PBS managed
31
+ environments; scheduler handles binding, script adds GPU monitoring.
32
+ - `gpu_bind.sh` — per-rank GPU binding for native Kokkos LAMMPS.
33
+ - `cpu_bind.sh` — CPU-only binding using L3 cache groups (EPYC 7763).
34
+ - `lammps-mdi` CLI with subcommands:
35
+ - `check` — report the runtime environment (CUDA, torch, MDI, mace, …)
36
+ - `install-scripts` — copy bundled shell scripts to a target directory
37
+ - `install-torch` — print the correct `pip install torch` command for
38
+ the detected CUDA driver version
39
+ - `version` — print the installed package version
40
+ - `mace-mdi` console script as the entry point for the MACE MDI engine.
41
+ - CUDA auto-detection via `nvidia-smi`; maps driver CUDA version to the
42
+ appropriate PyTorch wheel tag (cu118 … cu128).
43
+ - BSD-3-Clause license.
44
+
45
+ ---
46
+
47
+ ## [Unreleased]
48
+
49
+ ### Planned
50
+ - NequIPEngine: MDI engine for NequIP/Allegro models.
51
+ - SevenNetEngine: MDI engine for SevenNet models.
52
+ - Configurable CPU topology in binding scripts (currently hard-coded for
53
+ dual-GPU EPYC 7763).
54
+
55
+ ---
56
+
57
+ [0.1.0]: https://github.com/molssi-seamm/lammps-mdi/releases/tag/v0.1.0
58
+ [Unreleased]: https://github.com/molssi-seamm/lammps-mdi/compare/v0.1.0...HEAD
@@ -0,0 +1,237 @@
1
+ # Installing lammps-mdi on HPC Systems
2
+
3
+ lammps-mdi uses the Python environment that ships with your LAMMPS build.
4
+ On HPC clusters managed with EasyBuild or Spack, that Python is provided by
5
+ a module, and its site-packages must not be modified. The correct approach
6
+ is a virtual environment that **inherits** the module stack.
7
+
8
+ ---
9
+
10
+ ## Quick summary
11
+
12
+ ```
13
+ 1. Load your LAMMPS module (sets Python, numpy, mpi4py, MDI, etc.)
14
+ 2. Create a venv with --system-site-packages
15
+ 3. Activate the venv
16
+ 4. pip install torch with the right CUDA wheel
17
+ 5. pip install lammps-mdi[gpu]
18
+ 6. lammps-mdi install-scripts
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Step 1 — Load the LAMMPS module
24
+
25
+ ```bash
26
+ module load LAMMPS/22Jul2025-foss-2024a-kokkos # adjust to your site
27
+ ```
28
+
29
+ This loads Python, numpy, mpi4py, MDI, and everything else the LAMMPS
30
+ build depends on. All of these will be visible inside the venv we create
31
+ in the next step.
32
+
33
+ Verify MDI is accessible:
34
+
35
+ ```bash
36
+ python -c "import mdi; print(mdi.__version__, mdi.__file__)"
37
+ ```
38
+
39
+ If this fails, either the MDI module was not loaded or `pymdi` is not
40
+ installed in the system Python. If pymdi is not present, install it after
41
+ activating the venv (step 3):
42
+
43
+ ```bash
44
+ pip install pymdi
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Step 2 — Create a virtual environment
50
+
51
+ ```bash
52
+ python -m venv --system-site-packages ~/venvs/lammps-mdi
53
+ ```
54
+
55
+ The `--system-site-packages` flag makes the venv see all packages provided
56
+ by the loaded modules (numpy, mpi4py, MDI, lammps, …) **without** copying
57
+ or reinstalling them.
58
+
59
+ ---
60
+
61
+ ## Step 3 — Activate the venv
62
+
63
+ ```bash
64
+ source ~/venvs/lammps-mdi/bin/activate
65
+ ```
66
+
67
+ Add this to your job script or `~/.bashrc` (after the `module load` line).
68
+
69
+ ---
70
+
71
+ ## Step 4 — Install PyTorch with the correct CUDA wheel
72
+
73
+ PyTorch must be installed **before** lammps-mdi, because mace-torch depends
74
+ on it and pip must find it already present to avoid pulling in a CPU-only
75
+ or wrong-CUDA build.
76
+
77
+ Use `lammps-mdi` to find the right command for your GPU:
78
+
79
+ ```bash
80
+ # If lammps-mdi is not installed yet, use the helper directly:
81
+ python -c "
82
+ from lammps_mdi.cuda_utils import detect_cuda_version, recommend_torch_tag, torch_install_command
83
+ maj, min_ = detect_cuda_version()
84
+ tag = recommend_torch_tag(maj, min_)
85
+ print(torch_install_command(tag))
86
+ "
87
+ ```
88
+
89
+ Or simply run `nvidia-smi` and look for `CUDA Version: X.Y`, then pick the
90
+ closest matching tag from the table below:
91
+
92
+ | Driver CUDA ceiling | Use this wheel tag |
93
+ |--------------------|--------------------|
94
+ | ≥ 12.8 | `cu128` |
95
+ | ≥ 12.6 | `cu126` |
96
+ | ≥ 12.4 | `cu124` |
97
+ | ≥ 12.1 | `cu121` |
98
+ | ≥ 11.8 | `cu118` |
99
+
100
+ Example for CUDA 12.2 (driver ceiling) — use cu121:
101
+
102
+ ```bash
103
+ pip install torch --index-url https://download.pytorch.org/whl/cu121
104
+ ```
105
+
106
+ > **Note on bundled CUDA**: modern PyTorch wheels bundle their own CUDA
107
+ > runtime libraries (`nvidia-cuda-runtime-cu12`, etc.). This means the
108
+ > wheel's CUDA version can be slightly *newer* than the driver's reported
109
+ > CUDA ceiling, as long as the driver version itself is compatible.
110
+ > For CUDA 12.2 drivers the cu121 wheel works correctly.
111
+
112
+ Verify:
113
+
114
+ ```bash
115
+ python -c "import torch; print(torch.__version__, torch.cuda.is_available())"
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Step 5 — Install lammps-mdi
121
+
122
+ ```bash
123
+ # Recommended: with GPU-accelerated neighbor lists
124
+ pip install lammps-mdi[gpu]
125
+
126
+ # Or with cuEquivariance acceleration (base packages only):
127
+ pip install lammps-mdi[gpu-full]
128
+
129
+ # Then add the ops kernel matching your CUDA:
130
+ pip install cuequivariance-ops-torch-cu12 # for CUDA 12.x
131
+ # pip install cuequivariance-ops-torch-cu11 # for CUDA 11.x
132
+ ```
133
+
134
+ Run the environment check:
135
+
136
+ ```bash
137
+ lammps-mdi check
138
+ ```
139
+
140
+ Expected output (abbreviated):
141
+
142
+ ```
143
+ ============================================================
144
+ lammps-mdi environment report
145
+ ============================================================
146
+
147
+ Python: 3.12.3 (/home/user/venvs/lammps-mdi/bin/python)
148
+ GPU: CUDA driver 12.2 detected via nvidia-smi
149
+ Recommended torch wheel tag: cu121
150
+ pip install torch --index-url .../cu121
151
+
152
+ torch: 2.x.x (CUDA 12.1, 2 device(s))
153
+
154
+ pymdi: 1.4.x (/path/to/mdi/__init__.py)
155
+
156
+ mace: 0.3.x
157
+ vesin: available (GPU neighbor lists enabled)
158
+ cueq: 0.9.x
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Step 6 — Install shell scripts
164
+
165
+ The package bundles `mdi_bind.sh`, `mdi_monitor.sh`, `cpu_bind.sh`, and
166
+ `gpu_bind.sh`. Install them to `~/SEAMM/bin` (or any directory in PATH):
167
+
168
+ ```bash
169
+ lammps-mdi install-scripts # installs to ~/SEAMM/bin
170
+ lammps-mdi install-scripts --dir /opt/bin # custom directory
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Step 7 — Configure lammps.ini
176
+
177
+ Set the `gpu-code` key in `lammps.ini` to use the installed scripts.
178
+ For a standalone machine with one GPU:
179
+
180
+ ```ini
181
+ gpu-code = mpirun --mca mpi_yield_when_idle 1 \
182
+ -np 1 ~/SEAMM/bin/mdi_bind.sh \
183
+ mace-mdi -mdi "-role ENGINE -name MACE -method MPI" \
184
+ : -np 1 ~/SEAMM/bin/mdi_bind.sh \
185
+ lmp -mdi "-role DRIVER -name LAMMPS -method MPI"
186
+ ```
187
+
188
+ For HPC with SLURM (scheduler handles binding):
189
+
190
+ ```ini
191
+ gpu-code = mpirun \
192
+ -np 1 ~/SEAMM/bin/mdi_monitor.sh \
193
+ mace-mdi -mdi "-role ENGINE -name MACE -method MPI" \
194
+ : -np 1 ~/SEAMM/bin/mdi_monitor.sh \
195
+ lmp -mdi "-role DRIVER -name LAMMPS -method MPI"
196
+ ```
197
+
198
+ Note that `mace-mdi` is now a console script installed into the venv's
199
+ `bin/`, so it is available directly by name once the venv is activated.
200
+
201
+ ---
202
+
203
+ ## Adding the venv activation to job scripts
204
+
205
+ ```bash
206
+ #!/bin/bash
207
+ #SBATCH --gres=gpu:1
208
+ #SBATCH --ntasks=2
209
+
210
+ module load LAMMPS/22Jul2025-foss-2024a-kokkos
211
+ source ~/venvs/lammps-mdi/bin/activate
212
+
213
+ # SEAMM or direct mpirun command here
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Troubleshooting
219
+
220
+ **`ImportError: No module named 'mdi'`**
221
+ - The MDI module is not loaded, or `pymdi` is not installed.
222
+ Check `module list` and try `pip install pymdi`.
223
+
224
+ **`torch.cuda.is_available()` returns False**
225
+ - The torch wheel was installed without GPU support.
226
+ Reinstall with the correct `--index-url`.
227
+
228
+ **`cuequivariance` not found at runtime**
229
+ - Install the base packages: `pip install cuequivariance cuequivariance-torch`
230
+ - Then the ops kernel: `pip install cuequivariance-ops-torch-cu12`
231
+
232
+ **numpy version conflict**
233
+ - Never install numpy inside the venv with `--system-site-packages`.
234
+ The system numpy (from the module) takes precedence; a second install
235
+ in the venv can shadow it with a different version.
236
+ If pip warns about a numpy conflict from `mace-torch`, this is usually
237
+ harmless — mace-torch will use the system numpy.