NOTE: This branch is for the Comment published on Chemistry of Materials (doi: 10.1021/acs.chemmater.2c02434). For code behind the paper on ChemiRxiv, see the ChemRxiv branch.
In a recent paper by Twyman et al. (Chem. Mater. 2022, 34, 2545-2552), the environmental stability of crystals is investigated by determining the most favored oxidation reaction (lowest reaction enthalpy). This is done using a greedy heuristic algorithm.
In whygreedy.ipynb, we demonstrate that the environmental stability problem can be solved exactly using linear programming, which gives solutions always better than or equivalent to the approximations by greedy algorithms.
The content of both notebooks should be self-explanatory. To reproduce the notebooks:
- Clone this repository and add the root folder to
$PYTHONPATH$
- Create a virtual environment and install dependencies:
pip install -r requirements.txt
- Start a Jupyter server and run the notebooks.
The *.pkl
files in data folder are precomputed results
to save computation time in notebooks. To reproduce them:
- download materials project as
mp.json.gz
usingpymatgen
as described in downloader.py - extract reactions from
mp.json.gz
using pairs.py - calculate reaction enthalpies with calculate.py,
commands can be found in calculate.sh, and results will be saved as
*_records_*.pkl
. - combine.py combines
*_records_*.pkl
tomp_oxidation_records.pkl
that will be used in notebooks.