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
Metadata
Release files for wfrfmodel 2.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wfrfmodel-2.3.3.tar.gz | 100.0 kB | Without provenance | Details for wfrfmodel-2.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wfrfmodel-2.3.3-py3-none-any.whl | Python 3 | none | any | Details for wfrfmodel-2.3.3-py3-none-any.whl |
Total release size: 112.5 kB
Release files / wfrfmodel-2.3.3.tar.gz
| Download URL | wfrfmodel-2.3.3.tar.gz |
|---|---|
| Size | 100.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d427a1f751185b81e42f2d4a1e49a405a140c61af097c8edd265f06d3b42f8ea
|
|
BLAKE2b-256 checksum How to use checksums |
b00e1b2192c9579b4606d40fb0ad8950552e9081e8e8615795d697137078f0b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.10
|
Release files / wfrfmodel-2.3.3-py3-none-any.whl
| Download URL | wfrfmodel-2.3.3-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
770236d3c3a30fae97b88e05e2f535b3eb703e777e9093d3b8887ff70f9ca7de
|
|
BLAKE2b-256 checksum How to use checksums |
799b7bcd8ceab7c880021441f97012bbd03916480c00b7b5d57a62946d590939
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.10
|
Security for wfrfmodel 2.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.