Random Forest Model to predict the work function of surfaces
Project description
Work Function Random Forest Model
The module contains the random forest ML model to predict the work function of metallic surfaces
with physics-based descriptors accompanying the publication.
The ML model was trained on a work function database generated by high-throughput density
functional theory, which can be found here:
Please, cite the following paper if you use the model in your research:
@article{Schindler2024,
author = {Schindler, Peter and Antoniuk, Evan R. and Cheon, Gowoon and Zhu, Yanbing and Reed, Evan J.},
title = {{Discovery of Stable Surfaces with Extreme Work Functions by High-Throughput Density Functional Theory and Machine Learning}},
journal = {Adv. Funct. Mater.},
volume = {34},
number = {19},
pages = {2401764},
year = {2024},
month = may,
issn = {1616-301X},
publisher = {John Wiley {\&} Sons, Ltd},
doi = {10.1002/adfm.202401764}
}
Installation
The Python module can be installed by following these steps:
pip install wfrfmodel(or by usinguv)
Alternatively: Clone the repository and runpip install .in the repository base folder.- Run the command
python -c "import wfrfmodel; wfrfmodel.download_model_file()"to download the ML model joblib file.
Alternatively: Download fileRF_1748260280.629787.joblibfromand move it to the
src/wfrfmodelfolder (same folder as filemain.py).
Usage
The model can be easily initialized and used to predict the work functions
(of the top and bottom surface of the slab) as follows (assuming,
you have a slab stored in file slab.cif):
from wfrfmodel import WFRFModel
from pymatgen.core import Structure
slab = Structure.from_file('slab.cif')
WFModel = WFRFModel()
print(WFModel.predict_work_functions_from_slab(slab))
Or from a bulk structure stored in file bulk.cif and by specifying the Miller index:
from wfrfmodel import WFRFModel
from pymatgen.core import Structure
bulk = Structure.from_file('bulk.cif')
WFModel = WFRFModel()
print(WFModel.predict_work_functions_from_bulk_and_miller(bulk, (1, 0, 0)))
Code Documentation
Below find a detailed documentation of all WFRFModel functions and description of variables.
Function download_model_file
def download_model_file(model_filename: str = 'RF_1748260280.629787.joblib') -> None
Download the pre-trained Random Forest model file from Zenodo.
Arguments:
model_filename: (str) Name of the joblib file containing the pre-trained Random Forest model
Returns:
None
Class WFRFModel
Class for predicting work functions using a pre-trained Random Forest model.
__init__
def __init__() -> None
Initialize the WFRFModel class and load the pre-trained model and scaler.
Arguments:
model_filename: (str) Name of the joblib file containing the pre-trained Random Forest model
Returns:
None
predict_work_functions_from_slab
def predict_work_functions_from_slab(slab: Structure,
tol: float = 0.4,
ignificant_digits: int = 4) ->
tuple[float, float]
Predict the work functions (of top and bottom surface) from a single slab structure.
Arguments:
slab: (Structure) Slab structure as a pymatgen Structure objecttol: (float) Tolerance in Angstroms to determine which atoms belong to the same layer (default 0.4 A)significant_digits: (int) Number of significant digits to round the predicted work function (default 4)
Returns:
(tuple[float, float]) Predicted work function of the top and bottom surfaces of the slab
predict_work_functions_from_bulk_and_miller
def predict_work_functions_from_bulk_and_miller(bulk: Structure,
miller: tuple[int, int, int],
tol: float = 0.4,
significant_digits: int = 4) ->
dict[str, float]
Predict the work functions from a bulk structure and a Miller index.
Arguments:
bulk: (Structure) Bulk structure as a pymatgen Structure objectmiller: (tuple[int, int, int]) Miller index of slab to generatetol: (float) Tolerance in Angstroms to determine which atoms belong to the same layer (default 0.4 A)
Returns:
(dict[str, float]) Dictionary with keys as '<termination number (i.e., 0, 1, 2,...)>, <bottom/top>, <terminating chemical species (e.g., Cs-Hg)>' and the values are the respective predicted WFs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wfrfmodel-2.3.3.tar.gz.
File metadata
- Download URL: wfrfmodel-2.3.3.tar.gz
- Upload date:
- Size: 100.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d427a1f751185b81e42f2d4a1e49a405a140c61af097c8edd265f06d3b42f8ea
|
|
| MD5 |
d4197e016ad7821882adb04fedcd142c
|
|
| BLAKE2b-256 |
b00e1b2192c9579b4606d40fb0ad8950552e9081e8e8615795d697137078f0b8
|
File details
Details for the file wfrfmodel-2.3.3-py3-none-any.whl.
File metadata
- Download URL: wfrfmodel-2.3.3-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
770236d3c3a30fae97b88e05e2f535b3eb703e777e9093d3b8887ff70f9ca7de
|
|
| MD5 |
9db81397740ba7562f5f0faee75ee749
|
|
| BLAKE2b-256 |
799b7bcd8ceab7c880021441f97012bbd03916480c00b7b5d57a62946d590939
|