Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

alt textcodecovPyPI versionGitHub tag (latest by date)GitHub code size in bytesGitHub commit activityDownloads

📖 Full documentation:https://atomgptlab.github.io/alignn/

Table of Contents

ALIGNN & ALIGNN-FF (Introduction)

The Atomistic Line Graph Neural Network (paper) introduces a graph convolution layer that explicitly models both two- and three-body interactions in atomistic systems. The ALIGNN-FF variant (paper) extends this to a force-field for structurally and chemically diverse systems across 89 elements.

ALIGNN layer schematic

Pure PyTorch — DGL is no longer required. ALIGNN now runs fully in native PyTorch. Neighbor lists, line graphs, and batched readout are all built with plain torch tensor/scatter ops via alignn/torch_graph_builder.py, so you can train and run inference without installing DGL. To use the pure path, set the model name to the *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy to "pure_torch" in your config. The example configs and tests in this repository already default to this pure-PyTorch path.

Installation

See docs/installation.md for conda, GitHub, and pip installation methods.

Examples — train every model type

All training recipes live on this page. Each one ships a self-contained, runnable example under alignn/examples/recipes/ with a make_toy_dataset.py (generates a tiny synthetic id_prop.json), a config_example.json, and its own detailed README.md. Every recipe below runs in ~1–2 minutes on CPU.

⚠️The toy datasets are smoke tests, not real models. They are 40 rattled Si cells with synthetic labels, meant only to prove the pipeline runs. For a usable model, replace the structures/labels with real DFT data (thousands → millions of entries), raise epochs to 100–300 and batch_size to 32–64, and expect to use a GPU. See each recipe's README.

RecipeTaskGraphExample dir
kNNscalar propertykNN (cutoff 8)recipes/knn
Radiusscalar property (MD-compatible)radius (cutoff 5)recipes/radius
TensorD-dim response tensorkNNrecipes/tensor
SpectraDOS / Raman curvekNNrecipes/spectra
Force fieldenergy + forces + stressradiusrecipes/forcefield
Atomwiseper-atom charge / momentkNNrecipes/atomwise

Every recipe reads an id_prop.json: a JSON list where each entry has a jid, an inline jarvis Atoms dict, and the target(s). See Dataset format for the full spec.

1. kNN graph — scalar property (formation energy, band gap, Tc, …)

Wider k-nearest-neighbour graph (cutoff: 8.0, max_neighbors: 12) — the more accurate choice for property prediction.

cd alignn/examples/recipes/knn
python make_toy_dataset.py # -> id_prop.json (40 toy entries)
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 8.0, model.output_features: 1, graphwise_weight: 1.0, calculate_gradient: false. More: recipes/knn/README.md.

2. Radius graph — scalar property (MD-compatible neighbour list)

Same scalar task, but the fixed-radius graph (cutoff: 5.0) that is continuous under displacement — use it when you need MD-consistency.

cd alignn/examples/recipes/radius
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: cutoff: 5.0 (vs 8.0 for kNN). More: recipes/radius/README.md.

3. Tensor property (dielectric D=9, piezo D=18, elastic D=36)

Predict a fixed-length response tensor per structure. Target is a length-D list.

cd alignn/examples/recipes/tensor
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: set model.output_features to your tensor dimension (9/18/36) and match D in make_toy_dataset.py. More: recipes/tensor/README.md.

4. Spectra / multi-output curve (eDOS 300, pDOS 200, Raman 200)

Predict a full curve on a fixed grid. Target is a length-D list (one per bin).

cd alignn/examples/recipes/spectra
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid

Key knobs: model.output_features = number of bins (200/300); match D in the toy script. More: recipes/spectra/README.md.

5. Force field (energy + forces + stress, ALIGNN-FF)

Train an interatomic potential with energy-conserving (gradient) forces and stress — usable for relaxation, MD, and LAMMPS (pair_alignn).

cd alignn/examples/recipes/forcefield
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key energy_per_atom --force_key forces --id_key jid

Key knobs: model.calculate_gradient: true, and the loss mixture graphwise_weight (energy) / gradwise_weight (forces) / stresswise_weight (stress). Energy must be per atom. More: recipes/forcefield/README.md.

6. Atomwise property (per-atom charges, magnetic moments)

Predict one value per atom. Target is a length-Natoms list under a per-atom key.

cd alignn/examples/recipes/atomwise
python make_toy_dataset.py
train_alignn.py --root_dir . --config_name config_example.json \
--output_dir toy_out --target_key target --id_key jid --atomwise_key charges

Key knobs: model.atomwise_output_features: 1, atomwise_weight: 1.0, graphwise_weight: 0.0; pass --atomwise_key charges. More: recipes/atomwise/README.md.

For the historical per-topic docs see also docs/training/ (dataset format, classification, multi-GPU).

Reproducing a JARVIS-Leaderboard contribution

Every ALIGNN entry on the JARVIS-Leaderboard ships the exact config, split, and run.sh used to produce it, so any result can be reproduced end to end:

# 1) install ALIGNN (pure-PyTorch, no DGL needed)
pip install alignn
# or from source:
git clone https://github.com/atomgptlab/alignn.git
cd alignn && pip install -e .&&cd ..
# 2) get the leaderboard (holds every contribution's config + data split + run.sh)
git clone https://github.com/atomgptlab/jarvis_leaderboard.git
cd jarvis_leaderboard
pip install -e .# 3) pick a contribution and re-run it# contributions live under jarvis_leaderboard/contributions/<name>/
ls jarvis_leaderboard/contributions/alignn_model/
# each folder has: the benchmark CSV, metadata.json, and run.sh
cat jarvis_leaderboard/contributions/alignn_model/run.sh
bash jarvis_leaderboard/contributions/alignn_model/run.sh

run.sh downloads the benchmark's train/val/test split (from the matching jarvis_leaderboard/benchmarks/.../*.json.zip), writes the id_prop/config, and calls train_alignn.py with the same settings that produced the leaderboard number — so you reproduce the published MAE exactly. To submit a new ALIGNN result, copy an existing contribution folder, drop in your predictions CSV + metadata.json, and open a PR (see the leaderboard's CONTRIBUTING).

Colab notebooks

Ready-to-run notebooks covering property prediction, force-field training, and pretrained-model usage. Click a badge to open in Colab.

NotebookOpen in ColabDescription
Regression task (graph-wise prediction)Open In ColabSingle-output regression for 2D-material exfoliation energies.
ML force-field training from scratchOpen In ColabTrain an ALIGNN-FF force field for Silicon.
ALIGNN-FF: relaxation, EV curve, phonons, interfacesOpen In ColabPretrained ALIGNN-FF for relaxation, EV curves, phonons, and interfaces.
Scaling / timing comparisonOpen In ColabScaling/timing analysis of universal MLFFs.
Melt-Quench MDOpen In ColabGenerate amorphous structures via molecular dynamics.
Miscellaneous training tasksOpen In ColabSingle-output, multi-output (phonon/electron DOS), classification, and pretrained usage.
Superconductor TcOpen In ColabTrain a model for superconductor transition temperature.
Build id_prop.json from VASP runsOpen In ColabCompile vasprun.xml files into id_prop.json for ALIGNN-FF training.
LAMMPS MD with ALIGNN-FF (pair_alignn)Open In ColabBuild LAMMPS with the native pair_alignn style and run NVE / melt-quench MD with the default ALIGNN-FF mps force field.

Using pre-trained models

See docs/pretrained/:

Web-apps

See docs/usage/webapps.md. Direct links: AtomGPT ALIGNN app, ALIGNN-FF app.

ALIGNN-FF ASE Calculator

fromase.buildimportbulkfromalignn.ff.unified_calculatorimport (
AlignnUnifiedCalculator, AlignnUnifiedConfig)
cfg=AlignnUnifiedConfig(
energy=True, forces=True, stress=True,
properties=["formation_energy_peratom", "optb88vdw_bandgap"],
)
calc=AlignnUnifiedCalculator(cfg) # models loaded once, reusedsi=bulk("Si", "diamond", a=5.43); si.calc=calcsi.get_potential_energy(); si.get_forces(); si.get_stress()
print(calc.predictions()) # extra property predictors

A single pydantic config selects the outputs (force-field energy/forces/stress plus any pretrained ALIGNN 2.0 property predictors — scalar, spectra, or D-dim tensor; radius or kNN graph). See docs/usage/ase-calculator.md for more, and the ASE docs page Calculators → ALIGNN.

Performances

ALIGNN 2.0 benchmarked across single-property, multi-property (spectra / per-atom / tensor), and interatomic-force-field tasks. Columns compare ALIGNN 2.0 on the radius and 8 Å kNN graphs against the original ALIGNN and CGCNN; bold marks the row best. Skill is 100 · (1 − MAE / MAD) vs the mean-absolute-deviation baseline. For the live, continually-updated numbers see the JARVIS-Leaderboard.

Full benchmark table (54 tasks)

(a) Single-property prediction — test MAE

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
1formation_energy (eV/atom)44569/5572/55720.03160.03070.03310.05510.87696.5
2optb88vdw_total_energy (eV/atom)44569/5572/55720.03210.03140.03670.05841.78698.2
3optb88vdw_bandgap (eV)44569/5572/55720.13140.13060.14230.18570.99986.9
4mbj_bandgap (eV)14535/1817/18150.27210.27300.31040.32611.76584.6
5QM9 HOMO–LUMO gap (eV)110,000/10,000/10,8290.0310.03450.83496.3
6QMOF bandgap (eV)16,340/2042/20420.2080.2020.94678.7
7ehull (eV/atom)44290/5537/55370.05760.05900.07630.05901.14895.0
8bulk_modulus_kv (GPa)15744/1968/19689.8859.30210.39911.01553.7682.7
9shear_modulus_gv (GPa)15744/1968/19689.0638.8259.47610.07927.0667.4
10magmom_oszicar (μ_B)41766/5222/52220.26080.25670.25740.30651.25479.5
11slme (%)7250/906/9064.4934.4474.5215.01411.2160.3
12spillage9101/1137/11370.35270.34560.35100.38440.51833.3
13kpoint_length_unit (Å)44313/5540/55399.6999.3429.5159.87517.9447.9
14encut (eV)44308/5539/5539131.81128.08133.80134.83262.651.2
15epsx35592/4449/444920.70520.13920.39422.19957.4564.9
16epsy35592/4449/444920.08819.82919.99921.78757.3265.4
17epsz35592/4449/444919.63319.45319.56821.12155.7965.1
18mepsx13447/1681/168124.64623.84724.04626.92963.3962.4
19mepsy13447/1681/168123.82324.04423.64826.55663.6862.6
20mepsz13447/1681/168123.24723.53123.73126.62960.7161.7
21dfpt_piezo_max_dij (pC/N)2677/334/33412.60312.49820.57018.39222.6944.9
22dfpt_piezo_max_dielectric3764/470/47026.82324.30528.15130.96143.9144.7
23exfoliation_energy (meV/atom)650/81/8140.27237.62852.70345.76261.0338.3
24max_efg (10²¹V/m^2)9493/1186/118619.80219.24819.12122.95744.4656.7
25avg_elec_mass (m_e)14114/1764/17640.08370.08100.08530.09210.22564.1
26avg_hole_mass (m_e)14114/1764/17640.12990.12400.12390.14060.39968.9
27n_Seebeck (\muV/K)18568/2321/232141.52440.34640.92145.660111.563.8
28n_powerfact (\muW/mK^2)18568/2321/2321469.07451.90442.30485.59709.236.3
29ph_heat_capacity (J/mol/K)9644/1205/12059.5779.60612.93640.1676.2
30Thermal Cond. (log₁₀κ_L)3227/–/4040.3760.3620.59739.4
31Tc_supercon (K)556/30/301.6371.4902.0322.72345.3
32Tc_supercon_hydride (K)763/95/959.9379.42533.5671.9
33Tc_supercon_ hydride_plus_bulk (K)1595/199/1998.6708.40722.3362.3
34alex_supercon Tc (K)6592/824/8250.8832.81868.7
35alex_supercon N(E_F) (states/eV)6592/824/8250.8211.55947.3
36alex_supercon θ_D (K)6592/824/82511.3380.3085.9
37alex_supercon λ6592/824/8250.07070.19463.6
38alex_supercon ω_log (K)6592/824/82520.3155.3763.3

(b) Multi-property — spectra / per-atom / tensor; held-out MAE (col. "radius")

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
39eDOS, electronic DOS (D=300)4103/227/2290.01380.021335.2
40pDOS, phonon DOS (D=200)4103/227/2290.08190.11729.8
41Raman spectrum (D=200)4059/507/5080.03780.03260.049734.4
42Bader charge, per atom (e)75,028/3000/30000.01922.12499.1
43Net charge, per atom (e)75,033/3000/30000.0167
44Magnetic moment, per atom (μ_B)89,231/3000/30000.02562.06398.8
45Dielectric tensor (D=9)4103/227/2291.6903.40150.3
46Born effective charge (e)4472/248/2490.234
47Piezoelectric tensor, C/m^2 (D=18)4513/250/2520.0770.08913.9
48Elastic C_{ij} tensor, GPa (D=36)15,936/885/8865.59318.7370.1

(c) Interatomic force fields — mlearn per-element energy/force; large sets energy / force

#Task (unit)N tr/val/teALIGNN 2.0 (radius)ALIGNN 2.0 (kNN)orig. ALIGNNCGCNNBaseline (MAD)Skill %
49mlearn-Si, energy (meV/atom)214/–/2513.88‡
50mlearn-Si, force (eV/Å)214/–/250.0872‡
51ALIGNN-FF-DB (E/F)276,401/–/15,35532.4† / 0.0564†
52MATPES-PBE (E/F)391,241/21,736/–40.4 / 0.1475
53FD-FF, 1.1 M (E/F)1,097,227/60,957/60,95828.9† / 0.0445†
54MPtrj (E/F)~1.5 M56.7† / 0.0707†
*Blank cells: not run for that graph/model. : baseline unavailable or ill-defined.
† still training. ‡ mlearn MAE pending re-verification against a consistent per-atom
energy convention.*

Useful notes

Tips & FAQ

Pure-PyTorch path (no DGL)

  • ALIGNN 2.0 runs fully in native PyTorch — set the model name to a *_pure variant (e.g. alignn_atomwise_pure) and neighbor_strategy: "pure_torch". DGL is optional.
  • If you do use the legacy DGL path, install a DGL build matching your CUDA runtime; mismatched builds are the most common install failure.

Structure file parsing

  • Simple .cif/.pdb are handled by jarvis-tools directly.
  • For complex CIFs: pip install cif2cell==2.0.0a3. For complex PDBs: conda install -c ambermd pytraj.

Training hyperparameters

  • Example configs ship with a small batch_size/epochs so tests run fast. Use batch_size: 3264 and epochs: 100300 for real trainings — otherwise training is slow and under-performing.
  • pandas >= 1.2.3 required. Since March 2024, pytorch-ignite is no longer a dependency.

CLIs are importable scripts

  • train_alignn.py, pretrained.py, and run_alignn_ff.py install as executables in your environment's bin/ — just run them by name, no absolute path needed.

Known dataset issues

  • QM9: see issue #54 for a data-split discrepancy affecting reproducibility.

Getting help

References

If ALIGNN or ALIGNN-FF contributed to your work, please cite the relevant papers.

Publication list

Core

  1. Choudhary, K. & DeCost, B. Atomistic Line Graph Neural Network for improved materials property predictions.npj Computational Materials 7, 185 (2021). Link
  2. Choudhary, K., DeCost, B., Major, L., Butler, K., Thiyagalingam, J., Tavazza, F. Unified graph neural network force-field for the periodic table.Digital Discovery (2023). Link

Applications

  1. Prediction of the Electron Density of States for Crystalline Compounds with ALIGNN.Link
  2. Recent advances and applications of deep learning methods in materials science.Link
  3. Designing High-Tc Superconductors with BCS-inspired Screening, DFT, and Deep-learning.Link
  4. A Deep-learning Model for Fast Prediction of Vacancy Formation in Diverse Materials.Link
  5. Graph neural network predictions of MOF CO₂ adsorption properties.Link
  6. Rapid Prediction of Phonon Structure and Properties using ALIGNN.Link
  7. Large Scale Benchmark of Materials Design Methods.Link
  8. Prediction of Magnetic Properties in van der Waals Magnets using GNNs.Link
  9. CHIPS-FF: Benchmarking universal force-fields.Link

A complete list is maintained at jarvis-tools publications.

How to contribute

See Contribution instructions and docs/contributing.md.

Correspondence

Please report bugs as GitHub issues or email drkamal@jhu.edu.

Funding support

Code of conduct

Please see Code of conduct.

Releases

Packages

Contributors

Languages