mlipcpp 0.1.1__tar.gz → 0.1.3__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 (195) hide show
  1. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.github/workflows/build_wasm.yml +13 -3
  2. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.github/workflows/ci.yml +7 -2
  3. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.github/workflows/website.yml +3 -3
  4. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.github/workflows/wheels.yml +1 -1
  5. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/CMakeLists.txt +63 -8
  6. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/PKG-INFO +1 -1
  7. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/mlipcpp.hpp +61 -0
  8. mlipcpp-0.1.3/packages/mlip.js/examples/activations.html +393 -0
  9. mlipcpp-0.1.3/packages/mlip.js/examples/activations_smoke.mjs +84 -0
  10. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/packages/mlip.js/package-lock.json +2 -2
  11. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/packages/mlip.js/package.json +1 -1
  12. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/pyproject.toml +12 -1
  13. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/convert_models.py +2 -1
  14. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/export_pytorch/export_pet_full.py +81 -40
  15. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/export_pytorch/export_pet_gguf.py +41 -5
  16. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/export_pytorch/fx_converter.py +2 -0
  17. mlipcpp-0.1.3/scripts/test_stress_fd.py +379 -0
  18. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/CMakeLists.txt +38 -9
  19. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/api/c/mlipcpp_api.cpp +11 -3
  20. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/api/cpp/mlipcpp_cpp.cpp +226 -1
  21. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/api/fortran/mlipcpp.f90 +0 -4
  22. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/api/python/mlipcpp_bindings.cpp +10 -3
  23. mlipcpp-0.1.3/src/bin/graph_inference.cpp +201 -0
  24. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/ggml_utils.cpp +13 -0
  25. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/ggml_utils.h +13 -0
  26. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/log.h +1 -0
  27. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/io/xyz.cpp +22 -21
  28. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet.cpp +7 -3
  29. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet_batch.cpp +5 -1
  30. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet_layers.cpp +2 -2
  31. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/runtime/graph_interpreter.cpp +112 -18
  32. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/runtime/graph_interpreter.h +15 -0
  33. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/runtime/graph_ir.cpp +79 -17
  34. mlipcpp-0.1.3/src/runtime/graph_model.cpp +1180 -0
  35. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/runtime/graph_model.h +25 -2
  36. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_auto_vs_manual.cpp +17 -10
  37. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_graph_interpreter.cpp +107 -0
  38. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_pet.cpp +6 -6
  39. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_python_api.py +4 -4
  40. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/uv.lock +1 -1
  41. mlipcpp-0.1.3/website/bun.lock +233 -0
  42. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/package.json +2 -1
  43. mlipcpp-0.1.3/website/src/App.svelte +155 -0
  44. mlipcpp-0.1.3/website/src/components/EditOverlay.svelte +158 -0
  45. mlipcpp-0.1.3/website/src/components/EditPanel.svelte +820 -0
  46. mlipcpp-0.1.3/website/src/components/EditorHelp.svelte +197 -0
  47. mlipcpp-0.1.3/website/src/components/ModelLoader.svelte +397 -0
  48. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/OptParams.svelte +5 -2
  49. mlipcpp-0.1.3/website/src/components/PeriodicTable.svelte +194 -0
  50. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/StructureLoader.svelte +18 -3
  51. mlipcpp-0.1.3/website/src/components/Viewer.svelte +1177 -0
  52. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/ViewerControls.svelte +31 -2
  53. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/chem/elements.ts +19 -1
  54. mlipcpp-0.1.3/website/src/lib/chem/xyz.ts +53 -0
  55. mlipcpp-0.1.3/website/src/lib/data/samples.ts +244 -0
  56. mlipcpp-0.1.3/website/src/lib/editor/editorMachine.svelte.ts +163 -0
  57. mlipcpp-0.1.3/website/src/lib/editor/fragments.ts +145 -0
  58. mlipcpp-0.1.3/website/src/lib/editor/ghostFlash.ts +128 -0
  59. mlipcpp-0.1.3/website/src/lib/editor/hydrogens.ts +231 -0
  60. mlipcpp-0.1.3/website/src/lib/editor/transform.svelte.ts +556 -0
  61. mlipcpp-0.1.3/website/src/lib/molview/Selection.ts +89 -0
  62. mlipcpp-0.1.3/website/src/lib/molview/Stage.ts +921 -0
  63. mlipcpp-0.1.3/website/src/lib/molview/StructureObject.ts +271 -0
  64. mlipcpp-0.1.3/website/src/lib/molview/UnitCell.ts +172 -0
  65. mlipcpp-0.1.3/website/src/lib/molview/adapter.ts +97 -0
  66. mlipcpp-0.1.3/website/src/lib/molview/data/bonds.ts +139 -0
  67. mlipcpp-0.1.3/website/src/lib/molview/data/colors.ts +19 -0
  68. mlipcpp-0.1.3/website/src/lib/molview/data/elements.ts +230 -0
  69. mlipcpp-0.1.3/website/src/lib/molview/data/jmolColors.ts +34 -0
  70. mlipcpp-0.1.3/website/src/lib/molview/data/types.ts +74 -0
  71. mlipcpp-0.1.3/website/src/lib/molview/impostorSettings.ts +13 -0
  72. mlipcpp-0.1.3/website/src/lib/molview/lighting.ts +32 -0
  73. mlipcpp-0.1.3/website/src/lib/molview/materialStyles.ts +700 -0
  74. mlipcpp-0.1.3/website/src/lib/molview/plugins/PathTracerPlugin.ts +21 -0
  75. mlipcpp-0.1.3/website/src/lib/molview/representations/BallAndStick.ts +397 -0
  76. mlipcpp-0.1.3/website/src/lib/molview/representations/ImpostorBallAndStick.ts +778 -0
  77. mlipcpp-0.1.3/website/src/lib/molview/representations/ImpostorSpacefill.ts +385 -0
  78. mlipcpp-0.1.3/website/src/lib/molview/representations/Spacefill.ts +172 -0
  79. mlipcpp-0.1.3/website/src/lib/molview/representations/Tube.ts +346 -0
  80. mlipcpp-0.1.3/website/src/lib/molview/representations/Wireframe.ts +168 -0
  81. mlipcpp-0.1.3/website/src/lib/molview/representations/types.ts +40 -0
  82. mlipcpp-0.1.3/website/src/lib/stores/simulation.svelte.ts +1123 -0
  83. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/worker/mdWorker.ts +248 -38
  84. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/worker/simulation.ts +3 -3
  85. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/styles/app.css +89 -2
  86. mlipcpp-0.1.3/website/src/vite-env.d.ts +7 -0
  87. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/vite.config.ts +1 -1
  88. mlipcpp-0.1.1/src/bin/graph_inference.cpp +0 -122
  89. mlipcpp-0.1.1/src/runtime/graph_model.cpp +0 -578
  90. mlipcpp-0.1.1/website/bun.lock +0 -766
  91. mlipcpp-0.1.1/website/src/App.svelte +0 -73
  92. mlipcpp-0.1.1/website/src/components/ModelLoader.svelte +0 -241
  93. mlipcpp-0.1.1/website/src/components/Viewer.svelte +0 -61
  94. mlipcpp-0.1.1/website/src/lib/chem/xyz.ts +0 -23
  95. mlipcpp-0.1.1/website/src/lib/data/samples.ts +0 -93
  96. mlipcpp-0.1.1/website/src/lib/ngl/viewer.ts +0 -220
  97. mlipcpp-0.1.1/website/src/lib/stores/simulation.svelte.ts +0 -435
  98. mlipcpp-0.1.1/website/src/vite-env.d.ts +0 -26
  99. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.clang-format +0 -0
  100. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.gitignore +0 -0
  101. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/.gitmodules +0 -0
  102. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/LICENSE +0 -0
  103. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/README.md +0 -0
  104. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/cmake/PythonBindings.cmake +0 -0
  105. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/cmake/mlipcppConfig.cmake.in +0 -0
  106. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/CMakeLists.txt +0 -0
  107. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/backend_benchmark.cpp +0 -0
  108. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/c_api_test.c +0 -0
  109. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/cpp_api_test.cpp +0 -0
  110. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/fortran_api_test.f90 +0 -0
  111. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/python_ase.py +0 -0
  112. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/python_basic.py +0 -0
  113. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/python_comparison.py +0 -0
  114. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/examples/simple_inference.cpp +0 -0
  115. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/geometries/si.xyz +0 -0
  116. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/geometries/urea.cif +0 -0
  117. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/geometries/urea.xyz +0 -0
  118. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/geometries/urea_molecule.xyz +0 -0
  119. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/geometries/water.xyz +0 -0
  120. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/gguf/LICENSE +0 -0
  121. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/gguf/README.md +0 -0
  122. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/io.h +0 -0
  123. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/mlipcpp.h +0 -0
  124. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/model.h +0 -0
  125. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/neighbor_list.h +0 -0
  126. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/system.h +0 -0
  127. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/include/mlipcpp/timer.h +0 -0
  128. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/packages/mlip.js/LICENSE +0 -0
  129. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/packages/mlip.js/README.md +0 -0
  130. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/packages/mlip.js/examples/basic.html +0 -0
  131. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/packages/mlip.js/scripts/build.js +0 -0
  132. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/python/mlipcpp/__init__.py +0 -0
  133. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/python/mlipcpp/ase.py +0 -0
  134. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/__init__.py +0 -0
  135. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/benchmark_backends.sh +0 -0
  136. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/benchmark_graph_inference_forces.py +0 -0
  137. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/benchmark_pet_full_torch_compile.py +0 -0
  138. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/build_wasm.sh +0 -0
  139. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/calc_energy_pytorch.py +0 -0
  140. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/convert_cif_to_extxyz.py +0 -0
  141. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/convert_pet_mad.py +0 -0
  142. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/export_pytorch/__init__.py +0 -0
  143. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/export_pytorch/graph_ir.py +0 -0
  144. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/publish_ggufs.py +0 -0
  145. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/test_all_models.py +0 -0
  146. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/scripts/test_all_models.sh +0 -0
  147. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/backend.cpp +0 -0
  148. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/backend.h +0 -0
  149. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/gguf_loader.cpp +0 -0
  150. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/gguf_loader.h +0 -0
  151. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/neighbor_list.cpp +0 -0
  152. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/system.cpp +0 -0
  153. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/core/timer.cpp +0 -0
  154. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/ggml_attention.cpp +0 -0
  155. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/ggml_attention.h +0 -0
  156. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/model.cpp +0 -0
  157. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet.h +0 -0
  158. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet_batch.h +0 -0
  159. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet_graph.h +0 -0
  160. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/models/pet/pet_types.h +0 -0
  161. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/src/runtime/graph_ir.h +0 -0
  162. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/CMakeLists.txt +0 -0
  163. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_backend_selection.cpp +0 -0
  164. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_full_export.cpp +0 -0
  165. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_ggml_layout.cpp +0 -0
  166. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_graph_model.cpp +0 -0
  167. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_io.cpp +0 -0
  168. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_main.cpp +0 -0
  169. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_neighbor_list.cpp +0 -0
  170. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_pet_gradients.cpp +0 -0
  171. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/tests/test_system.cpp +0 -0
  172. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/.gitignore +0 -0
  173. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/bench.html +0 -0
  174. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/index.html +0 -0
  175. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/public/favicon.svg +0 -0
  176. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/bench-main.ts +0 -0
  177. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/EnergyPlot.svelte +0 -0
  178. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/MDParams.svelte +0 -0
  179. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/RunControls.svelte +0 -0
  180. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/Segmented.svelte +0 -0
  181. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/Stats.svelte +0 -0
  182. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/VibrationsPanel.svelte +0 -0
  183. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/components/XyzEditorModal.svelte +0 -0
  184. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/chem/bonds.ts +0 -0
  185. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/chem/cell.ts +0 -0
  186. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/chem/pubchem.ts +0 -0
  187. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/chem/sdf.ts +0 -0
  188. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/chem/supercell.ts +0 -0
  189. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/vib/jacobi.ts +0 -0
  190. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/vib/modes.ts +0 -0
  191. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/lib/vib/projector.ts +0 -0
  192. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/src/main.ts +0 -0
  193. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/svelte.config.js +0 -0
  194. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/tsconfig.json +0 -0
  195. {mlipcpp-0.1.1 → mlipcpp-0.1.3}/website/tsconfig.node.json +0 -0
@@ -85,7 +85,10 @@ jobs:
85
85
  run: npm pack
86
86
 
87
87
  - name: Upload WASM build artifacts
88
- if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
88
+ if: >-
89
+ github.event_name == 'workflow_dispatch' ||
90
+ (github.event_name == 'push' &&
91
+ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
89
92
  uses: actions/upload-artifact@v4
90
93
  with:
91
94
  name: wasm-build
@@ -93,7 +96,10 @@ jobs:
93
96
  retention-days: 30
94
97
 
95
98
  - name: Upload package artifact
96
- if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
99
+ if: >-
100
+ github.event_name == 'workflow_dispatch' ||
101
+ (github.event_name == 'push' &&
102
+ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
97
103
  uses: actions/upload-artifact@v4
98
104
  with:
99
105
  name: mlipjs-package
@@ -113,10 +119,14 @@ jobs:
113
119
  - name: Checkout repository
114
120
  uses: actions/checkout@v4
115
121
 
122
+ # Node 24 ships npm >= 11.5.1, which is the minimum that implements the
123
+ # OIDC-to-registry handshake for trusted publishers. Node 20/22.x ship
124
+ # npm 10.x, which can sign provenance via OIDC but still auths the
125
+ # registry PUT the old token way — that's the 404/ENEEDAUTH we hit.
116
126
  - name: Setup Node.js
117
127
  uses: actions/setup-node@v4
118
128
  with:
119
- node-version: 20
129
+ node-version: 24
120
130
  registry-url: 'https://registry.npmjs.org'
121
131
 
122
132
  - name: Download WASM build artifacts
@@ -33,13 +33,18 @@ jobs:
33
33
  restore-keys: |
34
34
  cpm-${{ runner.os }}-
35
35
 
36
+ # Bump the prefix (currently v2) to invalidate stale caches built with
37
+ # different ggml CPU baselines. Pre-v2 caches were built with
38
+ # -march=native; after we defaulted GGML_NATIVE=OFF in CMakeLists.txt
39
+ # the new objects and the old library archive can disagree on
40
+ # available CPU features at link time and SIGILL at runtime.
36
41
  - name: Cache build directory
37
42
  uses: actions/cache@v4
38
43
  with:
39
44
  path: build
40
- key: build-${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**') }}
45
+ key: build-v2-${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**') }}
41
46
  restore-keys: |
42
- build-${{ runner.os }}-${{ env.BUILD_TYPE }}-
47
+ build-v2-${{ runner.os }}-${{ env.BUILD_TYPE }}-
43
48
 
44
49
  - name: Configure CMake
45
50
  run: |
@@ -53,13 +53,13 @@ jobs:
53
53
  run: npm install
54
54
 
55
55
  # Cache the bundled GGUF across runs so we don't re-download from HF on
56
- # every build. Keyed on the URL + filename so a model bump in
57
- # package.json invalidates the cache automatically.
56
+ # every build. Keyed on package.json (the fetch URL) and the model
57
+ # converter, so a re-export published to HF invalidates the cache.
58
58
  - name: Cache bundled GGUF
59
59
  uses: actions/cache@v4
60
60
  with:
61
61
  path: website/public/pet-mad-xs.gguf
62
- key: gguf-pet-mad-xs-${{ hashFiles('website/package.json') }}
62
+ key: gguf-pet-mad-xs-${{ hashFiles('website/package.json', 'scripts/convert_models.py') }}
63
63
 
64
64
  - name: Build WASM (both variants)
65
65
  working-directory: packages/mlip.js
@@ -30,7 +30,7 @@ jobs:
30
30
  include:
31
31
  - os: ubuntu-latest
32
32
  arch: x86_64
33
- - os: macos-14
33
+ - os: macos-15
34
34
  arch: arm64
35
35
  steps:
36
36
  - uses: actions/checkout@v4
@@ -1,5 +1,5 @@
1
1
  cmake_minimum_required(VERSION 3.18)
2
- project(mlipcpp VERSION 0.1.1 LANGUAGES CXX C)
2
+ project(mlipcpp VERSION 0.1.3 LANGUAGES CXX C)
3
3
 
4
4
  set(CMAKE_CXX_STANDARD 20)
5
5
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -27,6 +27,7 @@ option(MLIPCPP_BUILD_TESTS "Build tests" OFF)
27
27
  option(MLIPCPP_BUILD_FORTRAN "Build Fortran bindings" OFF)
28
28
  option(MLIPCPP_BUILD_PYTHON "Build Python bindings" OFF)
29
29
  option(MLIPCPP_INSTALL "Generate install target" OFF)
30
+ option(MLIPCPP_BUILD_SHARED "Build libmlipcpp (and the Fortran bindings) as shared libraries; ggml/fmt are always linked in statically" OFF)
30
31
  option(MLIPCPP_USE_CUDA "Enable CUDA backend via ggml" OFF)
31
32
  option(MLIPCPP_USE_HIP "Enable HIP/ROCm backend via ggml (AMD)" OFF)
32
33
  option(MLIPCPP_USE_METAL "Enable Metal backend via ggml" OFF)
@@ -79,6 +80,24 @@ if(MLIPCPP_BUILD_PYTHON)
79
80
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
80
81
  endif()
81
82
 
83
+ # =============================================================================
84
+ # Compiler-specific settings (apply to mlipcpp *and* ggml below)
85
+ # =============================================================================
86
+ # Intel icx/icpx default to -fp-model=fast, which implies finite-math-only.
87
+ # ggml's softmax / flash attention and our attention masks rely on -INFINITY
88
+ # comparisons that fast-math is allowed to fold away (producing NaNs), so
89
+ # keep IEEE semantics for every C/C++ target in this directory tree.
90
+ foreach(_lang C CXX)
91
+ if(CMAKE_${_lang}_COMPILER_ID STREQUAL "IntelLLVM")
92
+ if(CMAKE_${_lang}_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
93
+ add_compile_options("$<$<COMPILE_LANGUAGE:${_lang}>:/fp:precise>")
94
+ else()
95
+ add_compile_options("$<$<COMPILE_LANGUAGE:${_lang}>:-fp-model=precise>")
96
+ endif()
97
+ endif()
98
+ endforeach()
99
+ unset(_lang)
100
+
82
101
  # =============================================================================
83
102
  # Dependencies (via CPM)
84
103
  # =============================================================================
@@ -96,18 +115,44 @@ if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
96
115
  file(DOWNLOAD
97
116
  https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
98
117
  ${CPM_DOWNLOAD_LOCATION}
118
+ STATUS _cpm_download_status
119
+ TLS_VERIFY ON
99
120
  )
121
+ list(GET _cpm_download_status 0 _cpm_download_code)
122
+ if(NOT _cpm_download_code EQUAL 0)
123
+ message(FATAL_ERROR
124
+ "Failed to download CPM.cmake from "
125
+ "https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake "
126
+ "(status: ${_cpm_download_status}). Check your network/proxy, then "
127
+ "delete ${CPM_DOWNLOAD_LOCATION} and re-run cmake.")
128
+ endif()
100
129
  endif()
101
130
 
102
131
  include(${CPM_DOWNLOAD_LOCATION})
103
132
 
133
+ if(NOT COMMAND CPMAddPackage)
134
+ message(FATAL_ERROR
135
+ "CPM.cmake at ${CPM_DOWNLOAD_LOCATION} is invalid (CPMAddPackage not defined). "
136
+ "Delete that file and re-run cmake to redownload.")
137
+ endif()
138
+
104
139
  # ggml (forked version with gradient support)
105
140
  # Use MLIPCPP_GGML_SOURCE_DIR to point to a local ggml checkout for development
106
141
  set(MLIPCPP_GGML_SOURCE_DIR "" CACHE PATH "Path to local ggml source directory (for development)")
107
142
 
108
- set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
109
- set(GGML_BUILD_TESTS OFF CACHE BOOL "" FORCE)
110
- set(GGML_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
143
+ # Dependencies (ggml, fmt, ...) are always built as static libraries and
144
+ # linked into mlipcpp; whether mlipcpp itself is shared is controlled by
145
+ # MLIPCPP_BUILD_SHARED. These are normal (directory-scoped) variables rather
146
+ # than FORCEd cache entries so they never override a parent project's
147
+ # BUILD_SHARED_LIBS when mlipcpp is consumed via add_subdirectory /
148
+ # FetchContent. The dependencies' option() calls honour them (CMP0077).
149
+ set(BUILD_SHARED_LIBS OFF)
150
+ set(GGML_BUILD_TESTS OFF)
151
+ set(GGML_BUILD_EXAMPLES OFF)
152
+ if(MLIPCPP_BUILD_SHARED)
153
+ # The static dependencies end up inside a shared library.
154
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
155
+ endif()
111
156
 
112
157
  # Configure ggml backend options based on mlipcpp options
113
158
  if(MLIPCPP_USE_CUDA)
@@ -146,6 +191,14 @@ if(MLIPCPP_USE_BLAS)
146
191
  set(GGML_BLAS ON CACHE BOOL "" FORCE)
147
192
  endif()
148
193
 
194
+ # Default to a portable CPU baseline (no -march=native). Wheels and CI need
195
+ # this — without it ggml bakes the build host's CPU features into the binary
196
+ # and the resulting library SIGILLs on machines with a different (or older)
197
+ # CPU. Users wanting host-tuned builds can pass -DGGML_NATIVE=ON explicitly.
198
+ if(NOT DEFINED CACHE{GGML_NATIVE})
199
+ set(GGML_NATIVE OFF CACHE BOOL "Build with -march=native (non-portable)")
200
+ endif()
201
+
149
202
  # WASM-specific ggml configuration
150
203
  if(EMSCRIPTEN)
151
204
  # SINGLE_FILE=ON embeds the .wasm as base64 inside the .js, which blocks
@@ -168,7 +221,7 @@ else()
168
221
  CPMAddPackage(
169
222
  NAME ggml
170
223
  GITHUB_REPOSITORY peterspackman/ggml
171
- GIT_TAG 833b864d
224
+ GIT_TAG 7b2db3c7
172
225
  EXCLUDE_FROM_ALL YES
173
226
  )
174
227
  endif()
@@ -180,7 +233,7 @@ elseif(NOT EMSCRIPTEN)
180
233
  CPMAddPackage(
181
234
  NAME fmt
182
235
  GITHUB_REPOSITORY fmtlib/fmt
183
- GIT_TAG 11.0.2
236
+ GIT_TAG 11.1.4
184
237
  OPTIONS
185
238
  "FMT_INSTALL OFF"
186
239
  EXCLUDE_FROM_ALL YES
@@ -200,6 +253,9 @@ CPMAddPackage(
200
253
  # =============================================================================
201
254
  # Library
202
255
  # =============================================================================
256
+ # GNUInstallDirs must be included before src/ so CMAKE_INSTALL_INCLUDEDIR is
257
+ # defined when the INSTALL_INTERFACE include paths are recorded.
258
+ include(GNUInstallDirs)
203
259
  add_subdirectory(src)
204
260
 
205
261
  # Enable CTest before descending into examples/, so add_test() calls there
@@ -272,7 +328,6 @@ endif()
272
328
  # Installation
273
329
  # =============================================================================
274
330
  if(MLIPCPP_INSTALL)
275
- include(GNUInstallDirs)
276
331
  include(CMakePackageConfigHelpers)
277
332
 
278
333
  # Install headers
@@ -287,7 +342,7 @@ if(MLIPCPP_INSTALL)
287
342
  list(APPEND MLIPCPP_EXPORT_TARGETS mlipcpp_fortran)
288
343
 
289
344
  # Install Fortran module files
290
- install(DIRECTORY ${CMAKE_BINARY_DIR}/fortran_modules/
345
+ install(DIRECTORY ${PROJECT_BINARY_DIR}/fortran_modules/
291
346
  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mlipcpp/fortran
292
347
  FILES_MATCHING PATTERN "*.mod"
293
348
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlipcpp
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Fast C++ implementation of Machine Learning Interatomic Potentials
5
5
  Author-Email: Peter Spackman <peterspackman@fastmail.com>
6
6
  License: BSD 3-Clause License
@@ -9,6 +9,8 @@
9
9
  #define MLIPCPP_HPP
10
10
 
11
11
  #include <array>
12
+ #include <cstddef>
13
+ #include <cstdint>
12
14
  #include <memory>
13
15
  #include <optional>
14
16
  #include <span>
@@ -65,6 +67,38 @@ struct ModelOptions {
65
67
  float cutoff_override = 0.0f; ///< 0 = use model default
66
68
  };
67
69
 
70
+ /**
71
+ * @brief A single intermediate tensor captured during inference.
72
+ *
73
+ * Returned by Predictor::predict_with_activations(). Data is held as raw
74
+ * bytes; the caller interprets them according to `dtype` and `shape`.
75
+ *
76
+ * Node id conventions (mirroring the GIR graph):
77
+ * - >= 0 : matches the GIR node id
78
+ * - -1000, -1001, ... : synthetic ids for model inputs (one per input)
79
+ * - 9999 : the final model output
80
+ *
81
+ * Supported dtypes (others are emitted with empty data):
82
+ * "f32", "f16" (converted to f32 in `data`), "i32", "i8" (bool/byte)
83
+ */
84
+ struct NodeActivation {
85
+ int node_id = 0;
86
+ std::string name; ///< human-readable node name
87
+ std::string dtype; ///< element type (after any f16->f32 conversion)
88
+ std::vector<int64_t> shape; ///< up to 4 entries
89
+ std::vector<uint8_t> data; ///< raw bytes; size == n_elements * elt_size
90
+ };
91
+
92
+ /**
93
+ * @brief Result of Predictor::predict_with_activations.
94
+ *
95
+ * Carries the usual energy/forces/stress alongside per-node activations.
96
+ */
97
+ struct ActivationResult {
98
+ Result prediction;
99
+ std::vector<NodeActivation> activations;
100
+ };
101
+
68
102
  /**
69
103
  * @brief Options for prediction
70
104
  */
@@ -73,6 +107,13 @@ struct PredictOptions {
73
107
  bool compute_stress = false; ///< Compute stress tensor
74
108
  bool use_nc_forces = false; ///< Use non-conservative forces from forward pass heads
75
109
  ///< (faster, but forces are not gradient of energy)
110
+ /**
111
+ * If true and compute_stress is true, evaluate stress via finite differences
112
+ * on the energy under symmetric Voigt strain (12 forward passes, slow but
113
+ * exact w.r.t. the model's own energy — useful as a validation oracle).
114
+ * Default false uses the autograd-based virial path.
115
+ */
116
+ bool fd_stress = false;
76
117
  };
77
118
 
78
119
  /**
@@ -184,6 +225,26 @@ public:
184
225
  const int32_t *atomic_numbers, const float *cell,
185
226
  const bool *pbc, const PredictOptions &options);
186
227
 
228
+ /**
229
+ * @brief Predict energy and capture every intermediate tensor.
230
+ *
231
+ * Runs the energy graph and collects each node's output (plus inputs and
232
+ * the final output) for inspection. Intended for debugging, parity
233
+ * checks, and live-trace visualisation; not optimised for throughput.
234
+ *
235
+ * Only supported for graph-based models (architecture "pet-graph").
236
+ * Throws std::runtime_error for legacy model paths or non-CPU backends
237
+ * that haven't been validated for readback.
238
+ *
239
+ * Forces are not captured in this v1 — the visualisation contract is
240
+ * energy-only (see ACTIVATION_CAPTURE.md, open question 1).
241
+ */
242
+ ActivationResult predict_with_activations(int32_t n_atoms,
243
+ const float *positions,
244
+ const int32_t *atomic_numbers,
245
+ const float *cell = nullptr,
246
+ const bool *pbc = nullptr);
247
+
187
248
  private:
188
249
  struct Impl;
189
250
  std::unique_ptr<Impl> impl_;