Repository navigation
Add AIMNet2 backend (aimnet2, aimnet2-nse, aimnet2-2025) - #53
Merged
Merged
Conversation
- model_type "aimnet" (alias "aimnet2"), pinned aimnet[ase,torchsim]==0.2.5; ASE path via AIMNet2ASE, batch path via AIMNet2TorchSim in Float64Wrapper. - Inputs are checked before loading: the 14 supported elements, closed-shell models reject multiplicity > 1, and aimnet2/aimnet2-2025 reject H–H contacts below 0.8 Å (aimnetcentral #139). - D3 and model_path are rejected; model_cache_dir sets AIMNET_CACHE_DIR. - memory_scales_with "auto" uses n_atoms: AIMNet2's all-pairs Coulomb matrix grows with the square of the batch's atoms, independent of edges. - Docs, skill, example config, examples and workflow benchmark entries.
The autobatcher sizes batches from forward passes only. BFGS adds a dense Hessian per structure and runs out of GPU memory on large jobs with every backend; L-BFGS does the same with AIMNet2, whose batches fill the GPU because aimnet sizes its Coulomb neighbor matrix by the batch's total atoms. Both now log a warning once per batch job; docs and skill recommend fire.
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.
Adds AIMNet2 as a fourth backend:
model_type: "aimnet"(alias"aimnet2") withaimnet2,aimnet2-nse(open-shell) andaimnet2-2025(B97-3c), ensemble member 0.What changes
aimnet[ase,torchsim]==0.2.5. The lock only addsaimnet; nothing else moves (warp stays 1.17.0, torch-sim 0.6.2).models/aimnet.pyfollows the existing loader pattern:AIMNet2ASEfor the ASE path,AIMNet2TorchSimwrapped in sevenn's genericFloat64Wrapperfor float64 batch states (AIMNet2 is float32-only, like SevenNet).check_structure_supported:aimnet2/aimnet2-2025are closed-shell: multiplicity > 1 points toaimnet2-nse;aimnet2/aimnet2-2025reject H–H distances < 0.8 Å with heavy atoms present (spurious geminal-H collapse, aimnetcentral#139); free H2 is fine.d3_correctionandmodel_pathare rejected for AIMNet2 (D3 is built in; only registry names load).model_cache_dirworks viaAIMNET_CACHE_DIR.memory_scales_with: auto→n_atomsfor AIMNet2 (see below).examples/config_aimnet.json, AIMNet examples in the two example scripts, workflow-benchmark entries (aimnet2 joins the default set).Memory metric: n_atoms
AIMNet2's gas-phase Coulomb builds an int32 neighbour matrix of (total batch atoms)². Forward peak at equal total atoms is identical across the 4k, amine and kraken sets although their edges/atom differ (22 vs 30): 14.4–14.5 GB at 60k atoms, ≈ 4 B × N² above ~20k atoms. So memory follows atoms, not edges. With
n_edges, the amine set (few edges per atom) packed batches up to 23.9 of 24 GB; withn_atomsit peaked at 2.6 GB. Wall times are similar (53–73 s for ~1.6k–4.3k structures, all converged, both models).The N² sizing is upstream (
calculator.py:max_neighbors = Nfor infinite Coulomb cutoff); it could be sized by the largest molecule. Not addressed here.Optimizer memory: warnings for BFGS and AIMNet2 + L-BFGS
torch-sim's autobatcher sizes batches from forward passes only; optimizer state on top is not counted. Overnight stress tests (9.7k and 29k structures from the bundled amine/kraken sets, plus 140–423-atom molecules, without gpuma's per-structure retry):
gpuma now logs a warning once per batch job for
bfgs(any backend) and forlbfgswith AIMNet2; docs and skill recommendfirefor AIMNet2. The AIMNet2 warning can go once a released aimnet has the fix.Testing
tests/models/test_aimnet.py: registry vs. model metadata, NSE multiplicity, float64 torch-sim output matching ASE, per-system charge in one batch, cache dir, batch vs. sequential on mixed charges, all input checks; CLI dry-run and API pre-load checks.mkdocs build --strictpasses.