smact.property_prediction.convenience module

smact.property_prediction.convenience module#

Convenience wrapper functions for common property predictions, allowing users to predict properties with minimal setup.

Convenience functions for property prediction.

This module provides simple wrapper functions for common property predictions, allowing users to predict properties with minimal setup.

smact.property_prediction.convenience.predict_band_gap(compositions: str | list[str], model_path: str | Path | None = None, return_uncertainty: bool = False, device: str = 'cpu') ndarray | PredictionResult[source]#

Predict band gap for given compositions using ROOST.

Uses a pre-trained ROOST model (0.28 eV MAE on Materials Project 103K DFT band gaps) to predict band gaps from composition alone.

Parameters:
  • compositions – Single composition string or list of composition strings (e.g., “NaCl”, [“TiO2”, “GaN”]).

  • model_path – Path to a local model checkpoint. If None, uses the default pre-trained model.

  • return_uncertainty – If True, return PredictionResult with uncertainty estimates.

  • device – Device to run the model on (“cpu” or “cuda”).

Returns:

Band gap predictions in eV as numpy array, or PredictionResult if return_uncertainty is True.

Example

>>> predict_band_gap("GaN")
array([1.59])
>>> result = predict_band_gap(["NaCl", "TiO2"], return_uncertainty=True)
>>> print(result.predictions, result.uncertainties)