DEV Community

Kwaku Ansah
Kwaku Ansah

Posted on

Predicting Materials Band Gaps from Chemical Composition

🔬 I just open-sourced my Materials Informatics project: predicting electronic band gaps of inorganic materials purely from their chemical composition.

The idea is simple but powerful. Instead of running expensive DFT calculations that take hours per material, we featurize a chemical formula (like SrTiO3 or GaN) into 132 Magpie descriptors and train ML regressors to predict the band gap in seconds.

Here's what the pipeline does:

  1. Pulls 15,537 thermodynamically stable compounds from the Materials Project database
  2. Converts each formula into compositional descriptors (electronegativity stats, atomic radii, valence electron counts, etc.)
  3. Trains Random Forest and XGBoost models on an 80/20 split
  4. Achieves R² = 0.91 and MAE = 0.32 eV with XGBoost

Why does this matter? Band gap determines whether a material is a metal, semiconductor, or insulator. Being able to screen thousands of candidate materials computationally (before ever synthesizing them) is how we accelerate the discovery of next-gen photovoltaics, LEDs, and power electronics.

The repo includes:

  • A full 6-stage Jupyter notebook (data ingestion through evaluation)
  • A CLI tool so you can predict band gaps from the terminal: python predict.py GaN ZnO CdTe
  • Pre-trained model artifacts ready to use out of the box
  • Contribution paths for anyone who wants to extend it (new models, new featurizers, experimental data)

Everything is reproducible, documented, and MIT-licensed.

Check it out: https://github.com/neweracy/Prediction-model

If you're working in materials science, computational chemistry, or ML for physical sciences, I'd love to hear your thoughts. PRs and issues welcome.

MaterialsInformatics #MachineLearning #MaterialsScience #BandGap #OpenSource #XGBoost #Python #ComputationalChemistry #DataScience #Research

Top comments (0)