Skala
repository·main·Indexed 42 days ago
https://github.com/microsoft/skalaA neural network-based exchange-correlation functional for density functional theory (DFT) that predicts exchange-correlation energies with accuracy comparable to hybrid functionals at semi-local DFT computational costs. It provides integrations for PySCF (CPU and GPU via GPU4PySCF), ASE calculators, and C++ applications via LibTorch. Includes the skala-benchmark package (v2026.9) for running DFT benchmarks and generating performance reports.
What's inside Skala
- Skala is a deep-learning exchange-correlation functional designed to achieve chemical accuracy (less than 1 kcal/mol) across diverse chemical systems. Unlike traditional methods, it avoids expensive non-local features such as exact exchange or hand-crafted density convolutions. The model is trained on high-accuracy datasets including total atomization energies, thermochemical properties (ionization potentials, proton affinities), conformer energies, reaction paths, and non-covalent interactions.
Understand the Skala model package
mainTheskala-modelpackage contains the trainable model definitions used to document and test the architecture behind Skala's published traced model checkpoints. It serves as the source of truth for the model architecture used in Skala's exchange-correlation functionals.Skala 1.1 Benchmark Results Summary
mainThe Skala 1.1 functional demonstrates the following performance characteristics:
- Atomization Energies (W4-17): Achieves chemical accuracy ($\sim$ 1 kcal/mol MAE).
- Thermochemistry (GMTKN55): Achieves a WTMAD-2 of 2.72 kcal/mol, outperforming many range-separated hybrid functionals while maintaining the runtime efficiency of semi-local DFT.
- Geometry Optimization: Converges to equilibrium structures with errors comparable to range-separated hybrid functionals.
- Dipole Moments: Provides better prediction accuracy than state-of-the-art range-separated hybrid functionals.
- Scaling: Exhibits asymptotic scaling behavior similar to a meta-GGA functional, with an approximate prefactor of 3 relative to r2SCAN.
Run Skala DFT benchmarks with the skala-benchmark CLI
mainThe
skala-benchmarkpackage is used to run Skala Density Functional Theory (DFT) benchmarks, collect performance measurements, and generate offline reports.If you are using the default Pixi environment, the package is installed as an editable package and provides the
skala-benchmarkcommand line interface.For detailed instructions on dataset setup, executing benchmarks, collecting results, and generating reports, refer to the official benchmark documentation.
skala-benchmarkIntegrate Skala into electronic structure packages via GauXC
mainSkala is provided as an extension to the
GauXClibrary. To use Skala, you must use theGauXCinterface, which implements the evaluation of exchange-correlation functionals from an input density matrix. If your electronic structure package already interfaces withGauXC, you can integrate Skala by installing the version ofGauXCthat includes Skala support.For specific implementation details, refer to the following integration paths:
- Python/Standalone: For high-level usage.
- C++/C/Fortran Libraries: For low-level integration into compiled electronic structure codes.
- API Reference: For detailed functional interface specifications.
Configure Molecular Grid Settings
mainWhen creating a
MolGrid, you can configure several parameters to control the accuracy and performance of numerical integration:Pruning Schemes (
GauXC::PruningScheme)Determines how molecular grid weights are constructed from atomic grids.
Unpruned: No pruning applied.Robust: Robust pruning scheme from Psi4.Treutler: The Treutler pruning scheme.
Radial Quadrature Schemes (
GauXC::RadialQuad)BeckeMuraKnowlesTreutlerAhlrichsMurrayHandyLaming
Default Atomic Grid Sizes (
GauXC::AtomicGridSizeDefault)FineGrid: 75 angular, 302 radial points.UltraFineGrid: 99 angular, 590 radial points.SuperFineGrid: 250 angular, 974 radial points.GM3: 35 angular, 110 radial points.GM5: 50 angular, 302 radial points.
Batch Size (
GauXC::BatchSize)Defines the number of grid points processed in parallel. While the default is 512, values around
10000are recommended for better performance.Evaluate Skala-1.0 performance metrics and benchmarks
mainSkala-1.0 has been evaluated across five distinct benchmark types to measure different performance aspects of the exchange-correlation functional:
- Reaction Energies (W4-17 & GMTKN55): Measures accuracy of predicted reaction energies.
- W4-17 Metric: Mean Absolute Error (MAE) in kcal/mol.
- GMTKN55 Metric: Weighted total mean absolute deviations 2 (WTMAD-2) in kcal/mol.
- Geometry Optimization (CCse21, HMGB11, LMGB35): Evaluates convergence to reference equilibrium structures.
- Metric: Absolute error in bond lengths (Angstrom) and bond angles.
- Dipole Moments (hait2018): Measures the quality of the self-consistent electron density.
- Metric: Root Mean Square Error (RMSE) of percentage errors in dipole magnitude or vector.
- Computational Cost Scaling: Assesses how cost increases with system size.
- Metric: Scaling power $k$ derived from a power law fit $C(M) = (n(M)/A)^k$, where $n(M)$ is the number of atoms.
Performance Summary
- W4-17: Predicts atomization energies at chemical accuracy ($\sim$ 1 kcal/mol MAE).
- GMTKN55: Achieves a WTMAD-2 of 3.89 kcal/mol (competitive with range-separated hybrids but with semi-local DFT runtimes).
- Geometry: Errors comparable to a GGA functional.
- Dipole: Errors comparable to state-of-the-art range-separated hybrid functionals.
- Scaling: Exhibits asymptotic scaling behavior of a meta-GGA functional (approx. 3x prefactor relative to r2SCAN).
- Reaction Energies (W4-17 & GMTKN55): Measures accuracy of predicted reaction energies.
Risks and Limitations of Skala-1.0
mainUsers should be aware of the following limitations:
- Expertise Required: Interpretation of results requires expertise in quantum chemistry.
- Generalization: While benchmarked on W4-17 and GMTKN55, users should test the functional further before applying it to new research.
- Elemental Coverage: The model was trained on data containing elements H–Ar (excluding Li and Be) and Br, Kr, I, Xe. It has been tested on H–Ca, Ge–Kr, Sn–I, Pb, and Bi.
- Not Production Ready: This is not a production model; it is intended for research purposes.
Model checkpoints for Skala
mainPre-trained Skala model checkpoints are hosted on Hugging Face (microsoft/skala-1.0). TheskalaPython package downloads these checkpoints automatically when running calculations.Fortran bindings for Skala via FTorch
mainInteroperability between Skala (C++) and Fortran is achieved through custom extensions in the
src/directory. The bindings are implemented using C++/Fortran interoperability:skala_ftorch.cxx: Contains the C++ code defining the interface.skala_ftorch.f90: Contains the Fortran code providing the high-level bindings.
These bindings allow Fortran applications to:
- Load Skala models.
- Prepare input features.
- Compute exchange-correlation energies and potentials.
Intended and Out-of-Scope Uses for Skala-1.0
mainIntended Uses
- Research Reproduction: Facilitating the reproduction of evaluations presented in the Skala paper.
- Reaction Energy Evaluation: Computing total energy of all compounds in a reaction using a self-consistent field (SCF) calculation.
- Molecular Total Energy: Evaluating total energy of a molecule via SCF. Note that energy differences are predicted much more reliably than absolute total energies.
- Integration: The provided SCF implementation uses PySCF (CPU). A traced version is available for integration into optimized or GPU-enabled SCF codes (e.g., via GauXC).
Out-of-Scope Uses
- Single-pass Evaluation: Evaluating the functional with a single pass given a fixed density is not the intended use. The model must be used as part of an SCF procedure.
- Training: This repository does not include the training pipeline for the Skala-1.0 functional.
Securely load .fun model files
mainSkala model files (
.fun) use TorchScript serialization, which can execute arbitrary code. Never load.funfiles from untrusted sources.When using official models via
load_functional("skala-1.1")orload_functional("skala-1.0"), integrity is automatically verified. If loading files directly withTracedFunctional.load(), you must provide anexpected_hashto enable verification.TracedFunctional.load("model.fun", expected_hash="<sha256-hex-digest>")