nep-adapters 1.0.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 (194) hide show
  1. nep_adapters-1.0.0/.github/workflows/python-package.yml +284 -0
  2. nep_adapters-1.0.0/.gitignore +30 -0
  3. nep_adapters-1.0.0/AGENTS.md +28 -0
  4. nep_adapters-1.0.0/CMakeLists.txt +122 -0
  5. nep_adapters-1.0.0/PKG-INFO +861 -0
  6. nep_adapters-1.0.0/README.md +166 -0
  7. nep_adapters-1.0.0/benchmarks/CMakeLists.txt +144 -0
  8. nep_adapters-1.0.0/benchmarks/README.md +64 -0
  9. nep_adapters-1.0.0/benchmarks/cpp/bench_cpu_nep89.cpp +759 -0
  10. nep_adapters-1.0.0/benchmarks/cpp/bench_cpu_spin_lammps.cpp +310 -0
  11. nep_adapters-1.0.0/benchmarks/cuda/README.md +14 -0
  12. nep_adapters-1.0.0/benchmarks/cuda/bench_cuda_batch.cpp +506 -0
  13. nep_adapters-1.0.0/benchmarks/cuda/bench_cuda_lammps_device_layout.cu +1556 -0
  14. nep_adapters-1.0.0/benchmarks/cuda/bench_cuda_nve_compare.cu +388 -0
  15. nep_adapters-1.0.0/benchmarks/cuda/bench_spin_gpu.cpp +486 -0
  16. nep_adapters-1.0.0/benchmarks/lammps/README.md +25 -0
  17. nep_adapters-1.0.0/benchmarks/python/README.md +5 -0
  18. nep_adapters-1.0.0/cmake/NEPAdaptersCUDAAutoDetect.cmake +87 -0
  19. nep_adapters-1.0.0/cmake/NEPAdaptersConfig.cmake.in +15 -0
  20. nep_adapters-1.0.0/cmake/NEPAdaptersLAMMPSSource.cmake +152 -0
  21. nep_adapters-1.0.0/cmake/NEPAdaptersTestData.cmake +56 -0
  22. nep_adapters-1.0.0/docs/build.md +194 -0
  23. nep_adapters-1.0.0/docs/design.md +146 -0
  24. nep_adapters-1.0.0/docs/perf/cpu.md +74 -0
  25. nep_adapters-1.0.0/docs/python.md +242 -0
  26. nep_adapters-1.0.0/engines/README.md +10 -0
  27. nep_adapters-1.0.0/engines/cpu/CMakeLists.txt +138 -0
  28. nep_adapters-1.0.0/engines/cpu/README.md +7 -0
  29. nep_adapters-1.0.0/engines/cpu/cpu_engine.cpp +18 -0
  30. nep_adapters-1.0.0/engines/cpu/native/LICENSE.NEP_CPU +674 -0
  31. nep_adapters-1.0.0/engines/cpu/native/dftd3para.h +12491 -0
  32. nep_adapters-1.0.0/engines/cpu/native/ewald_nep.cpp +282 -0
  33. nep_adapters-1.0.0/engines/cpu/native/ewald_nep.h +46 -0
  34. nep_adapters-1.0.0/engines/cpu/native/neighbor_nep.cpp +495 -0
  35. nep_adapters-1.0.0/engines/cpu/native/neighbor_nep.h +40 -0
  36. nep_adapters-1.0.0/engines/cpu/native/nep.cpp +10470 -0
  37. nep_adapters-1.0.0/engines/cpu/native/nep.h +428 -0
  38. nep_adapters-1.0.0/engines/cpu/native/nep_utilities.h +3047 -0
  39. nep_adapters-1.0.0/engines/cpu_common/cpu_engine_adapter.hpp +912 -0
  40. nep_adapters-1.0.0/engines/cuda/CMakeLists.txt +76 -0
  41. nep_adapters-1.0.0/engines/cuda/README.md +138 -0
  42. nep_adapters-1.0.0/engines/cuda/angular_descriptor.cu +1044 -0
  43. nep_adapters-1.0.0/engines/cuda/angular_force.cu +1950 -0
  44. nep_adapters-1.0.0/engines/cuda/angular_harmonics.cuh +155 -0
  45. nep_adapters-1.0.0/engines/cuda/ann_energy.cu +568 -0
  46. nep_adapters-1.0.0/engines/cuda/cuda_engine.cpp +1368 -0
  47. nep_adapters-1.0.0/engines/cuda/device_model.cu +231 -0
  48. nep_adapters-1.0.0/engines/cuda/device_model.hpp +109 -0
  49. nep_adapters-1.0.0/engines/cuda/device_operations.hpp +416 -0
  50. nep_adapters-1.0.0/engines/cuda/device_output.cu +496 -0
  51. nep_adapters-1.0.0/engines/cuda/device_staging.cu +973 -0
  52. nep_adapters-1.0.0/engines/cuda/device_workspace.cu +263 -0
  53. nep_adapters-1.0.0/engines/cuda/device_workspace.hpp +168 -0
  54. nep_adapters-1.0.0/engines/cuda/force_pipeline.cpp +240 -0
  55. nep_adapters-1.0.0/engines/cuda/force_pipeline.hpp +59 -0
  56. nep_adapters-1.0.0/engines/cuda/host_staging.cpp +217 -0
  57. nep_adapters-1.0.0/engines/cuda/host_staging.hpp +42 -0
  58. nep_adapters-1.0.0/engines/cuda/internal_neighbor_builder.cu +1115 -0
  59. nep_adapters-1.0.0/engines/cuda/model_parameters.cpp +167 -0
  60. nep_adapters-1.0.0/engines/cuda/model_protocol.cpp +560 -0
  61. nep_adapters-1.0.0/engines/cuda/model_protocol.hpp +156 -0
  62. nep_adapters-1.0.0/engines/cuda/qnep_charge.cu +1384 -0
  63. nep_adapters-1.0.0/engines/cuda/radial_force.cu +1475 -0
  64. nep_adapters-1.0.0/engines/cuda/runtime_probe.cu +80 -0
  65. nep_adapters-1.0.0/engines/cuda/simulation_box.hpp +11 -0
  66. nep_adapters-1.0.0/engines/cuda/simulation_box_device.cuh +102 -0
  67. nep_adapters-1.0.0/engines/cuda/spin_onsite.cu +865 -0
  68. nep_adapters-1.0.0/engines/cuda/spin_onsite_descriptors.cuh +833 -0
  69. nep_adapters-1.0.0/engines/cuda/spin_onsite_forces.cuh +1999 -0
  70. nep_adapters-1.0.0/engines/cuda/workspace_plan.cpp +357 -0
  71. nep_adapters-1.0.0/engines/cuda/zbl_force.cu +536 -0
  72. nep_adapters-1.0.0/frontends/README.md +10 -0
  73. nep_adapters-1.0.0/frontends/lammps/CMakeLists.txt +411 -0
  74. nep_adapters-1.0.0/frontends/lammps/README.md +308 -0
  75. nep_adapters-1.0.0/frontends/lammps/nepadaptersplugin.cpp +83 -0
  76. nep_adapters-1.0.0/frontends/lammps/pair_nep_adapters_common.cpp +385 -0
  77. nep_adapters-1.0.0/frontends/lammps/pair_nep_adapters_common.h +60 -0
  78. nep_adapters-1.0.0/frontends/lammps/pair_nep_adapters_cpu.cpp +13 -0
  79. nep_adapters-1.0.0/frontends/lammps/pair_nep_adapters_cpu.h +23 -0
  80. nep_adapters-1.0.0/frontends/lammps/pair_nep_adapters_cuda.cpp +734 -0
  81. nep_adapters-1.0.0/frontends/lammps/pair_nep_adapters_cuda.h +74 -0
  82. nep_adapters-1.0.0/frontends/python/CMakeLists.txt +230 -0
  83. nep_adapters-1.0.0/frontends/python/README.md +213 -0
  84. nep_adapters-1.0.0/frontends/python/nep_adapters/__init__.py +69 -0
  85. nep_adapters-1.0.0/frontends/python/nep_adapters/ase.py +87 -0
  86. nep_adapters-1.0.0/frontends/python/nep_adapters/calculator.py +1046 -0
  87. nep_adapters-1.0.0/frontends/python/nep_adapters/errors.py +48 -0
  88. nep_adapters-1.0.0/frontends/python/nep_adapters/runtime.py +283 -0
  89. nep_adapters-1.0.0/frontends/python/src/python_module.cpp +1038 -0
  90. nep_adapters-1.0.0/frontends/python/tests/baseline_utils.py +80 -0
  91. nep_adapters-1.0.0/frontends/python/tests/test_ase_calculator.py +71 -0
  92. nep_adapters-1.0.0/frontends/python/tests/test_backend_isolation.py +64 -0
  93. nep_adapters-1.0.0/frontends/python/tests/test_calculator.py +98 -0
  94. nep_adapters-1.0.0/frontends/python/tests/test_cpu_smoke.py +138 -0
  95. nep_adapters-1.0.0/frontends/python/tests/test_cuda_qnep.py +203 -0
  96. nep_adapters-1.0.0/frontends/python/tests/test_cuda_smoke.py +181 -0
  97. nep_adapters-1.0.0/frontends/python/tests/test_production_api.py +462 -0
  98. nep_adapters-1.0.0/frontends/python/tests/test_runtime_contract.py +50 -0
  99. nep_adapters-1.0.0/frontends/python/tests/test_spin_calculator.py +260 -0
  100. nep_adapters-1.0.0/frontends/python/tests/test_wheel_install.py +59 -0
  101. nep_adapters-1.0.0/include/nep_adapters/api.h +302 -0
  102. nep_adapters-1.0.0/include/nep_adapters/capability.hpp +34 -0
  103. nep_adapters-1.0.0/include/nep_adapters/engine.hpp +138 -0
  104. nep_adapters-1.0.0/include/nep_adapters/engines/cpu.hpp +19 -0
  105. nep_adapters-1.0.0/include/nep_adapters/engines/cuda.hpp +12 -0
  106. nep_adapters-1.0.0/include/nep_adapters/views.hpp +42 -0
  107. nep_adapters-1.0.0/include/nep_adapters/virial_order.hpp +47 -0
  108. nep_adapters-1.0.0/pyproject.toml +59 -0
  109. nep_adapters-1.0.0/src/CMakeLists.txt +20 -0
  110. nep_adapters-1.0.0/src/registry.cpp +481 -0
  111. nep_adapters-1.0.0/tests/CMakeLists.txt +739 -0
  112. nep_adapters-1.0.0/tests/README.md +102 -0
  113. nep_adapters-1.0.0/tests/cpu_test_utils.hpp +243 -0
  114. nep_adapters-1.0.0/tests/fixtures/README.md +12 -0
  115. nep_adapters-1.0.0/tests/fixtures/cpu_baseline/README.md +9 -0
  116. nep_adapters-1.0.0/tests/fixtures/cpu_baseline/descriptor.txt +9 -0
  117. nep_adapters-1.0.0/tests/fixtures/cpu_baseline/nep.txt +2317 -0
  118. nep_adapters-1.0.0/tests/fixtures/cpu_baseline/train.xyz +10 -0
  119. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/README.md +7 -0
  120. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/nep/descriptor_ref.out +250 -0
  121. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/nep/force_analytical_ref.out +250 -0
  122. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/nep/nep.txt +1357 -0
  123. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/nep/virial_ref.out +250 -0
  124. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/nep/xyz.in +252 -0
  125. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/qnep/descriptor_ref.out +250 -0
  126. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/qnep/force_analytical_ref.out +250 -0
  127. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/qnep/nep.txt +2378 -0
  128. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/qnep/virial_ref.out +250 -0
  129. nep_adapters-1.0.0/tests/fixtures/nep_cpu_reference/qnep/xyz.in +252 -0
  130. nep_adapters-1.0.0/tests/fixtures/production_api/README.md +26 -0
  131. nep_adapters-1.0.0/tests/fixtures/production_api/dftd3/combined_golden.txt +9 -0
  132. nep_adapters-1.0.0/tests/fixtures/production_api/dftd3/nep.txt +6974 -0
  133. nep_adapters-1.0.0/tests/fixtures/production_api/dftd3/pure_golden.txt +9 -0
  134. nep_adapters-1.0.0/tests/fixtures/production_api/dftd3/structure.xyz +6 -0
  135. nep_adapters-1.0.0/tests/fixtures/production_api/dipole/descriptor_golden.txt +14 -0
  136. nep_adapters-1.0.0/tests/fixtures/production_api/dipole/golden.txt +2 -0
  137. nep_adapters-1.0.0/tests/fixtures/production_api/dipole/nep.txt +8660 -0
  138. nep_adapters-1.0.0/tests/fixtures/production_api/dipole/structure.xyz +15 -0
  139. nep_adapters-1.0.0/tests/fixtures/production_api/polarizability/descriptor_golden.txt +14 -0
  140. nep_adapters-1.0.0/tests/fixtures/production_api/polarizability/golden.txt +2 -0
  141. nep_adapters-1.0.0/tests/fixtures/production_api/polarizability/nep.txt +11721 -0
  142. nep_adapters-1.0.0/tests/fixtures/production_api/polarizability/structure.xyz +15 -0
  143. nep_adapters-1.0.0/tests/fixtures/production_api/qnep_charge_bec_golden.txt +18 -0
  144. nep_adapters-1.0.0/tests/fixtures/spin_chiral_protocol/lammps_structure.json +32 -0
  145. nep_adapters-1.0.0/tests/fixtures/spin_chiral_protocol/nep.txt +2872 -0
  146. nep_adapters-1.0.0/tests/fixtures/spin_chiral_protocol/reference_small_pbc.txt +396 -0
  147. nep_adapters-1.0.0/tests/test_cpu.cpp +153 -0
  148. nep_adapters-1.0.0/tests/test_cpu_lammps_neighbors.cpp +204 -0
  149. nep_adapters-1.0.0/tests/test_cpu_nep89.cpp +79 -0
  150. nep_adapters-1.0.0/tests/test_cpu_production_api.cpp +337 -0
  151. nep_adapters-1.0.0/tests/test_cpu_qnep.cpp +120 -0
  152. nep_adapters-1.0.0/tests/test_cpu_spin.cpp +999 -0
  153. nep_adapters-1.0.0/tests/test_cuda_angular_batch_force.cpp +140 -0
  154. nep_adapters-1.0.0/tests/test_cuda_batch_interface.cpp +74 -0
  155. nep_adapters-1.0.0/tests/test_cuda_build_policy.py +165 -0
  156. nep_adapters-1.0.0/tests/test_cuda_cpu_triclinic_parity.cpp +571 -0
  157. nep_adapters-1.0.0/tests/test_cuda_device_model.cu +628 -0
  158. nep_adapters-1.0.0/tests/test_cuda_engine_contract.cpp +719 -0
  159. nep_adapters-1.0.0/tests/test_cuda_lammps_host_sim.cpp +252 -0
  160. nep_adapters-1.0.0/tests/test_cuda_lammps_kk_sim.cu +862 -0
  161. nep_adapters-1.0.0/tests/test_cuda_nep5_batch_force.cpp +139 -0
  162. nep_adapters-1.0.0/tests/test_cuda_q1111_batch_force.cpp +140 -0
  163. nep_adapters-1.0.0/tests/test_cuda_q112_batch_force.cpp +140 -0
  164. nep_adapters-1.0.0/tests/test_cuda_q123_batch_force.cpp +140 -0
  165. nep_adapters-1.0.0/tests/test_cuda_q134_batch_force.cpp +140 -0
  166. nep_adapters-1.0.0/tests/test_cuda_q222_batch_force.cpp +140 -0
  167. nep_adapters-1.0.0/tests/test_cuda_q233_batch_force.cpp +140 -0
  168. nep_adapters-1.0.0/tests/test_cuda_qnep_reference.cpp +197 -0
  169. nep_adapters-1.0.0/tests/test_cuda_radial_batch_force.cpp +166 -0
  170. nep_adapters-1.0.0/tests/test_cuda_spin_chiral_polar.cpp +324 -0
  171. nep_adapters-1.0.0/tests/test_cuda_spin_density.cpp +390 -0
  172. nep_adapters-1.0.0/tests/test_cuda_spin_fixture.cpp +266 -0
  173. nep_adapters-1.0.0/tests/test_cuda_spin_onsite.cpp +234 -0
  174. nep_adapters-1.0.0/tests/test_cuda_spin_protocol.cpp +50 -0
  175. nep_adapters-1.0.0/tests/test_cuda_spin_scalar.cpp +253 -0
  176. nep_adapters-1.0.0/tests/test_cuda_zbl_batch_force.cpp +139 -0
  177. nep_adapters-1.0.0/tests/test_domain_decomp_contract.cpp +254 -0
  178. nep_adapters-1.0.0/tests/test_fp64_oracle.cpp +2631 -0
  179. nep_adapters-1.0.0/tests/test_install_consumer.cmake.in +57 -0
  180. nep_adapters-1.0.0/tests/test_install_lammps_source.py +114 -0
  181. nep_adapters-1.0.0/tests/test_nep_cpu_reference.cpp +203 -0
  182. nep_adapters-1.0.0/tests/test_registry.cpp +204 -0
  183. nep_adapters-1.0.0/tests/test_run_4090_spin_lmp_profile.py +600 -0
  184. nep_adapters-1.0.0/tests/test_run_lammps_baseline_smoke.py +109 -0
  185. nep_adapters-1.0.0/tests/test_run_lammps_spin_smoke.py +92 -0
  186. nep_adapters-1.0.0/tests/test_virial_order.cpp +52 -0
  187. nep_adapters-1.0.0/tools/check_wheel_contents.py +112 -0
  188. nep_adapters-1.0.0/tools/generate_test_report.py +584 -0
  189. nep_adapters-1.0.0/tools/install_lammps_source.py +239 -0
  190. nep_adapters-1.0.0/tools/run_4090_spin_lmp_profile.py +1185 -0
  191. nep_adapters-1.0.0/tools/run_cuda_tests.py +59 -0
  192. nep_adapters-1.0.0/tools/run_lammps_baseline_smoke.py +395 -0
  193. nep_adapters-1.0.0/tools/run_lammps_mpi_smoke.py +280 -0
  194. nep_adapters-1.0.0/tools/run_lammps_spin_smoke.py +340 -0
@@ -0,0 +1,284 @@
1
+ name: Build Python packages
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ tag_name:
9
+ description: Existing tag to validate/build, or empty for the current ref
10
+ required: false
11
+ default: ""
12
+ type: string
13
+ build_gpu:
14
+ description: Build combined Linux and Windows CPU+CUDA wheels
15
+ required: false
16
+ default: true
17
+ type: boolean
18
+ windows_cuda_only:
19
+ description: Build only the Windows CPython 3.10 CPU+CUDA validation wheel
20
+ required: false
21
+ default: false
22
+ type: boolean
23
+ linux_cuda_only:
24
+ description: Build only the Linux CPython 3.10 CPU+CUDA wheel
25
+ required: false
26
+ default: false
27
+ type: boolean
28
+
29
+ permissions:
30
+ contents: read
31
+
32
+ concurrency:
33
+ group: python-package-${{ github.event_name }}-${{ github.ref }}
34
+ cancel-in-progress: false
35
+
36
+ env:
37
+ TARGET_REF: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag_name || github.ref }}
38
+
39
+ jobs:
40
+ sdist:
41
+ name: Source distribution
42
+ if: >-
43
+ github.event_name != 'workflow_dispatch' ||
44
+ (!inputs.windows_cuda_only && !inputs.linux_cuda_only)
45
+ runs-on: ubuntu-latest
46
+ steps:
47
+ - uses: actions/checkout@v6
48
+ with:
49
+ fetch-depth: 0
50
+ ref: ${{ env.TARGET_REF }}
51
+ - uses: actions/setup-python@v6
52
+ with:
53
+ python-version: "3.12"
54
+ cache: pip
55
+ - name: Validate release version
56
+ if: github.event_name == 'release' || inputs.tag_name != ''
57
+ env:
58
+ RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag_name }}
59
+ run: |
60
+ python - <<'PY'
61
+ import os
62
+ import tomllib
63
+ from pathlib import Path
64
+
65
+ version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"]
66
+ expected = f"v{version}"
67
+ actual = os.environ["RELEASE_TAG"]
68
+ if actual != expected:
69
+ raise SystemExit(f"release tag {actual!r} must equal {expected!r}")
70
+ PY
71
+ - name: Build and verify sdist
72
+ env:
73
+ NEP_CUDA: "0"
74
+ run: |
75
+ python -m pip install --upgrade pip build twine
76
+ python -m build --sdist
77
+ python -m twine check dist/*
78
+ python -m pip install dist/*.tar.gz
79
+ python -c "import nep_adapters"
80
+ - uses: actions/upload-artifact@v6
81
+ with:
82
+ name: python-sdist
83
+ path: dist/*.tar.gz
84
+ if-no-files-found: error
85
+
86
+ cpu_wheels:
87
+ name: CPU wheels (${{ matrix.label }})
88
+ if: >-
89
+ github.event_name != 'workflow_dispatch' ||
90
+ (!inputs.windows_cuda_only && !inputs.linux_cuda_only)
91
+ runs-on: ${{ matrix.os }}
92
+ strategy:
93
+ fail-fast: false
94
+ matrix:
95
+ include:
96
+ - os: macos-15-intel
97
+ label: macos-x86_64
98
+ archs: x86_64
99
+ macos_target: "14.0"
100
+ - os: macos-14
101
+ label: macos-arm64
102
+ archs: arm64
103
+ macos_target: "14.0"
104
+ steps:
105
+ - uses: actions/checkout@v6
106
+ with:
107
+ fetch-depth: 0
108
+ ref: ${{ env.TARGET_REF }}
109
+ - uses: actions/setup-python@v6
110
+ with:
111
+ python-version: "3.12"
112
+ - name: Build platform wheels
113
+ uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
114
+ env:
115
+ CIBW_ENVIRONMENT: NEP_CUDA=0
116
+ CIBW_ARCHS: ${{ matrix.archs }}
117
+ CIBW_BEFORE_ALL_MACOS: brew install libomp
118
+ CIBW_ENVIRONMENT_MACOS: >-
119
+ MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_target }}
120
+ - name: Audit platform wheel contents
121
+ run: python tools/check_wheel_contents.py --variant cpu --wheel-dir wheelhouse
122
+ - uses: actions/upload-artifact@v6
123
+ with:
124
+ name: python-platform-${{ matrix.label }}
125
+ path: wheelhouse/*.whl
126
+ if-no-files-found: error
127
+
128
+ gpu_wheels:
129
+ name: Combined CPU+CUDA wheels (Linux x86_64)
130
+ if: >-
131
+ (github.event_name == 'release' ||
132
+ inputs.tag_name != '' ||
133
+ inputs.build_gpu ||
134
+ inputs.linux_cuda_only) &&
135
+ !inputs.windows_cuda_only
136
+ runs-on: ubuntu-latest
137
+ steps:
138
+ - uses: actions/checkout@v6
139
+ with:
140
+ fetch-depth: 0
141
+ ref: ${{ env.TARGET_REF }}
142
+ - uses: actions/setup-python@v6
143
+ with:
144
+ python-version: "3.12"
145
+ - name: Build combined wheels
146
+ uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
147
+ env:
148
+ CIBW_ARCHS_LINUX: x86_64
149
+ CIBW_BUILD: >-
150
+ ${{ inputs.linux_cuda_only &&
151
+ 'cp310-manylinux_x86_64' ||
152
+ 'cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64 cp314-manylinux_x86_64' }}
153
+ CIBW_BEFORE_ALL_LINUX: |
154
+ set -euxo pipefail
155
+ dnf install -y dnf-plugins-core
156
+ dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
157
+ dnf install -y gcc-toolset-13-gcc-c++ cuda-compiler-12-4 cuda-cudart-devel-12-4
158
+ ln -sfn /usr/local/cuda-12.4 /usr/local/cuda
159
+ CIBW_ENVIRONMENT_LINUX: >-
160
+ PATH=/usr/local/cuda/bin:$PATH
161
+ CC=/opt/rh/gcc-toolset-13/root/usr/bin/gcc
162
+ CXX=/opt/rh/gcc-toolset-13/root/usr/bin/g++
163
+ CUDACXX=/usr/local/cuda/bin/nvcc
164
+ CUDAHOSTCXX=/opt/rh/gcc-toolset-13/root/usr/bin/g++
165
+ CMAKE_ARGS="-DNEP_ADAPTERS_CUDA_ENABLE_QNEP_PPPM=OFF
166
+ -DCMAKE_CUDA_HOST_COMPILER=/opt/rh/gcc-toolset-13/root/usr/bin/g++
167
+ -DCMAKE_CUDA_ARCHITECTURES=60-real;89-real;60-virtual"
168
+ CIBW_TEST_COMMAND_LINUX: >-
169
+ NEP_ADAPTERS_EXPECT_GPU_MODULE=1
170
+ python {project}/frontends/python/tests/test_wheel_install.py
171
+ - name: Audit combined wheel contents
172
+ run: python tools/check_wheel_contents.py --variant combined --wheel-dir wheelhouse
173
+ - uses: actions/upload-artifact@v6
174
+ with:
175
+ name: python-combined-linux-x86_64
176
+ path: wheelhouse/*.whl
177
+ if-no-files-found: error
178
+
179
+ windows_cuda_wheels:
180
+ name: Combined CPU+CUDA wheels (Windows x86_64)
181
+ if: >-
182
+ (github.event_name == 'release' ||
183
+ inputs.tag_name != '' ||
184
+ inputs.build_gpu ||
185
+ inputs.windows_cuda_only) &&
186
+ !inputs.linux_cuda_only
187
+ runs-on: windows-2022
188
+ steps:
189
+ - uses: actions/checkout@v6
190
+ with:
191
+ fetch-depth: 0
192
+ ref: ${{ env.TARGET_REF }}
193
+ - uses: actions/setup-python@v6
194
+ with:
195
+ python-version: "3.12"
196
+ - name: Install CUDA 12.4
197
+ id: cuda-toolkit
198
+ uses: Jimver/cuda-toolkit@3d45d157f327c09c04b50ee6ccdea2d9d017ec76 # v0.2.35
199
+ with:
200
+ cuda: "12.4.1"
201
+ method: network
202
+ sub-packages: '["nvcc", "cudart", "visual_studio_integration"]'
203
+ - name: Build combined wheel
204
+ uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
205
+ env:
206
+ CIBW_ARCHS_WINDOWS: AMD64
207
+ CIBW_BUILD: >-
208
+ ${{ inputs.windows_cuda_only &&
209
+ 'cp310-win_amd64' ||
210
+ 'cp310-win_amd64 cp311-win_amd64 cp312-win_amd64 cp313-win_amd64 cp314-win_amd64' }}
211
+ CIBW_ENVIRONMENT_WINDOWS: >-
212
+ CMAKE_GENERATOR="Visual Studio 17 2022"
213
+ CUDAToolkit_ROOT="${{ steps.cuda-toolkit.outputs.CUDA_PATH }}"
214
+ CMAKE_ARGS="-DNEP_ADAPTERS_CUDA_ENABLE_QNEP_PPPM=OFF
215
+ -DCMAKE_CUDA_ARCHITECTURES=60-real;89-real;60-virtual"
216
+ CIBW_TEST_ENVIRONMENT_WINDOWS: NEP_ADAPTERS_EXPECT_GPU_MODULE=1
217
+ - name: Audit combined wheel contents
218
+ run: python tools/check_wheel_contents.py --variant combined --wheel-dir wheelhouse
219
+ - uses: actions/upload-artifact@v6
220
+ with:
221
+ name: python-combined-windows-x86_64
222
+ path: wheelhouse/*.whl
223
+ if-no-files-found: error
224
+
225
+ release_assets:
226
+ name: Attach packages to GitHub release
227
+ needs: [sdist, cpu_wheels, gpu_wheels, windows_cuda_wheels]
228
+ if: >-
229
+ always() &&
230
+ github.event_name == 'release' &&
231
+ needs.sdist.result == 'success' &&
232
+ needs.cpu_wheels.result == 'success' &&
233
+ needs.gpu_wheels.result == 'success' &&
234
+ needs.windows_cuda_wheels.result == 'success'
235
+ runs-on: ubuntu-latest
236
+ permissions:
237
+ contents: write
238
+ steps:
239
+ - uses: actions/download-artifact@v7
240
+ with:
241
+ pattern: python-*
242
+ path: dist
243
+ merge-multiple: true
244
+ - name: Upload release assets
245
+ uses: softprops/action-gh-release@v2
246
+ with:
247
+ tag_name: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag_name }}
248
+ files: dist/*
249
+ overwrite_files: true
250
+
251
+ publish_pypi:
252
+ name: Publish packages to PyPI
253
+ needs: [sdist, cpu_wheels, gpu_wheels, windows_cuda_wheels]
254
+ if: >-
255
+ always() &&
256
+ github.event_name == 'release' &&
257
+ needs.sdist.result == 'success' &&
258
+ needs.cpu_wheels.result == 'success' &&
259
+ needs.gpu_wheels.result == 'success' &&
260
+ needs.windows_cuda_wheels.result == 'success'
261
+ runs-on: ubuntu-latest
262
+ permissions:
263
+ contents: read
264
+ id-token: write
265
+ steps:
266
+ - uses: actions/download-artifact@v7
267
+ with:
268
+ name: python-sdist
269
+ path: dist
270
+ - uses: actions/download-artifact@v7
271
+ with:
272
+ pattern: python-platform-*
273
+ path: dist
274
+ merge-multiple: true
275
+ - uses: actions/download-artifact@v7
276
+ if: needs.gpu_wheels.result == 'success'
277
+ with:
278
+ pattern: python-combined-*
279
+ path: dist
280
+ merge-multiple: true
281
+ - name: Publish
282
+ uses: pypa/gh-action-pypi-publish@release/v1
283
+ with:
284
+ packages-dir: dist
@@ -0,0 +1,30 @@
1
+ .DS_Store
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ /build*/
6
+ /.build/
7
+ /reports/
8
+ /diagnostics/
9
+ /tmp/
10
+ /CMakeFiles/
11
+ /CMakeCache.txt
12
+ /Makefile
13
+ /cmake_install.cmake
14
+ /CTestTestfile.cmake
15
+ /Testing/
16
+ /install_manifest.txt
17
+
18
+ /reports/
19
+ /benchmarks/results/
20
+ /tmp/hpc-platform/
21
+ /analysis/scaling_tile16_20260706/
22
+ /analysis/scaling_al_tile16_20260706/
23
+ /dist/
24
+ *.egg-info/
25
+
26
+ *.o
27
+ *.obj
28
+ *.a
29
+ *.so
30
+ *.dylib
@@ -0,0 +1,28 @@
1
+ # Repository Agent Notes
2
+
3
+ ## Python Environment
4
+
5
+ Use the `mysci` conda environment for Python-facing work:
6
+
7
+ ```sh
8
+ source /Users/superbing/miniconda3/etc/profile.d/conda.sh
9
+ conda activate mysci
10
+ ```
11
+
12
+ For CMake builds that enable the Python frontend, pass:
13
+
14
+ ```sh
15
+ -DPython3_EXECUTABLE=/Users/superbing/miniconda3/envs/mysci/bin/python
16
+ ```
17
+
18
+ ## Virial Ordering Contract
19
+
20
+ Keep virial ordering explicit at public API boundaries:
21
+
22
+ - `find_force_batch` follows `NEP::compute` raw9 order:
23
+ `xx, xy, xz, yx, yy, yz, zx, zy, zz`.
24
+ - `find_force_lammps_neighbors` follows LAMMPS order. `total_virial6` is
25
+ `xx, yy, zz, xy, xz, yz`; per-atom raw9 is
26
+ `xx, yy, zz, xy, xz, yz, yx, zx, zy`.
27
+ - Engine-internal storage may use a different layout, but copyback must convert
28
+ to the relevant public API order before returning results.
@@ -0,0 +1,122 @@
1
+ cmake_minimum_required(VERSION 3.24)
2
+
3
+ include(cmake/NEPAdaptersCUDAAutoDetect.cmake)
4
+ nep_adapters_resolve_cuda_default(NEP_ADAPTERS_ENABLE_CUDA_DEFAULT)
5
+ option(NEP_ADAPTERS_ENABLE_CUDA
6
+ "Enable CUDA; auto-detects nvcc unless NEP_CUDA or this option is set"
7
+ ${NEP_ADAPTERS_ENABLE_CUDA_DEFAULT})
8
+ unset(NEP_ADAPTERS_ENABLE_CUDA_DEFAULT)
9
+ option(
10
+ NEP_ADAPTERS_CUDA_ENABLE_QNEP_PPPM
11
+ "Build the optional qNEP PPPM implementation and link cuFFT"
12
+ OFF)
13
+
14
+ if(NEP_ADAPTERS_CUDA_ENABLE_QNEP_PPPM AND NOT NEP_ADAPTERS_ENABLE_CUDA)
15
+ message(FATAL_ERROR
16
+ "NEP_ADAPTERS_CUDA_ENABLE_QNEP_PPPM=ON requires NEP_ADAPTERS_ENABLE_CUDA=ON.")
17
+ endif()
18
+
19
+ if(NEP_ADAPTERS_ENABLE_CUDA AND
20
+ NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
21
+ set(CMAKE_CUDA_ARCHITECTURES native)
22
+ endif()
23
+ if(NEP_ADAPTERS_ENABLE_CUDA)
24
+ message(STATUS
25
+ "NEPAdapters CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
26
+ endif()
27
+
28
+ if(NEP_ADAPTERS_ENABLE_CUDA)
29
+ project(NEPAdapters VERSION 1.0.0 LANGUAGES CXX CUDA)
30
+ else()
31
+ project(NEPAdapters VERSION 1.0.0 LANGUAGES CXX)
32
+ endif()
33
+
34
+ include(CMakePackageConfigHelpers)
35
+ include(GNUInstallDirs)
36
+
37
+ option(NEP_ADAPTERS_BUILD_TESTS "Build NEPAdapters tests" ON)
38
+ option(NEP_ADAPTERS_BUILD_BENCHMARKS "Build NEPAdapters performance benchmarks" OFF)
39
+ option(NEP_ADAPTERS_ENABLE_CPU "Enable the CPU engine" ON)
40
+ option(NEP_ADAPTERS_ENABLE_PYTHON "Enable the Python frontend" OFF)
41
+ option(NEP_ADAPTERS_ENABLE_LAMMPS "Enable the LAMMPS frontend" OFF)
42
+ option(
43
+ NEP_ADAPTERS_INSTALL_DEVELOPMENT_FILES
44
+ "Install C/C++ libraries, headers, and CMake package metadata"
45
+ ON)
46
+
47
+ set(NEP_ADAPTERS_PACKAGE_NEEDS_OPENMP OFF)
48
+ set(NEP_ADAPTERS_PACKAGE_NEEDS_BLAS OFF)
49
+ set(NEP_ADAPTERS_PACKAGE_NEEDS_CUDATOOLKIT OFF)
50
+
51
+ if(NEP_ADAPTERS_BUILD_TESTS OR NEP_ADAPTERS_BUILD_BENCHMARKS)
52
+ include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/NEPAdaptersTestData.cmake")
53
+ enable_testing()
54
+ endif()
55
+
56
+ add_subdirectory(src)
57
+
58
+ if(NEP_ADAPTERS_ENABLE_CPU)
59
+ add_subdirectory(engines/cpu)
60
+ endif()
61
+
62
+ if(NEP_ADAPTERS_ENABLE_CUDA)
63
+ add_subdirectory(engines/cuda)
64
+ endif()
65
+
66
+ if(NEP_ADAPTERS_ENABLE_PYTHON)
67
+ add_subdirectory(frontends/python)
68
+ endif()
69
+
70
+ if(NEP_ADAPTERS_ENABLE_LAMMPS)
71
+ add_subdirectory(frontends/lammps)
72
+ endif()
73
+
74
+ if(NEP_ADAPTERS_BUILD_TESTS)
75
+ add_subdirectory(tests)
76
+ endif()
77
+
78
+ if(NEP_ADAPTERS_BUILD_BENCHMARKS)
79
+ add_subdirectory(benchmarks)
80
+ endif()
81
+
82
+ if(NEP_ADAPTERS_INSTALL_DEVELOPMENT_FILES)
83
+ install(
84
+ DIRECTORY include/
85
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
86
+ )
87
+
88
+ install(
89
+ TARGETS nep_adapters
90
+ EXPORT NEPAdaptersTargets
91
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
92
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
93
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
94
+ )
95
+
96
+ install(
97
+ EXPORT NEPAdaptersTargets
98
+ NAMESPACE NEPAdapters::
99
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NEPAdapters
100
+ )
101
+ endif()
102
+
103
+ configure_package_config_file(
104
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/NEPAdaptersConfig.cmake.in
105
+ ${CMAKE_CURRENT_BINARY_DIR}/NEPAdaptersConfig.cmake
106
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NEPAdapters
107
+ )
108
+
109
+ write_basic_package_version_file(
110
+ ${CMAKE_CURRENT_BINARY_DIR}/NEPAdaptersConfigVersion.cmake
111
+ VERSION ${PROJECT_VERSION}
112
+ COMPATIBILITY SameMajorVersion
113
+ )
114
+
115
+ if(NEP_ADAPTERS_INSTALL_DEVELOPMENT_FILES)
116
+ install(
117
+ FILES
118
+ ${CMAKE_CURRENT_BINARY_DIR}/NEPAdaptersConfig.cmake
119
+ ${CMAKE_CURRENT_BINARY_DIR}/NEPAdaptersConfigVersion.cmake
120
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NEPAdapters
121
+ )
122
+ endif()