DeepMech is an interpretable graph-based deep learning framework for predicting complete chemical reaction mechanisms (CRMs).
# Clone repository
git clone https://github.com/alhqlearn/DeepMech.git
cd DeepMech
# Create and activate virtual environment
conda create -c conda-forge -n deepmech python=3.6 -y
conda activate deepmech
pip install rdkit-pypi
conda install pytorch cudatoolkit=11.3 -c pytorch -y
conda install -c conda-forge rdkit -y #not required
conda install -c dglteam dgl-cuda11.3 -y
pip install dgllife
# You can also set up the environment using the environment.yml file by running:
`conda env create --name deepmech -f environment.yml`Download the dataset and model from the following link, and place them in the respective folders:
- Dataset →
./data/ID_Split42 - Model →
./models
If you want to create a new dataset, prepare the .txt files and place them in e.g., ./data/my_data
Required files:
train.txtval.txttest.txt
Each file should contain atom-mapped elementary steps in SMILES format, one per line.
Run preprocessing scripts inside ./preprocessing:
# Step 1: Extract information from training data
python preprocessing/Extract_from_train_data.py -d ID_Split42
# Step 2: Preprocess dataset
python preprocessing/Run_preprocessing.py -d ID_Split42Train your model using:
python scripts/TrainWithAcc.py -d ID_Split42 -m Split42Run:
python SingleStepPred.py-
Train the Reaction Classifier
Reaction_Classifier/Training_Reaction_Classifier.ipynb
-
Load the Trained Model
- Update the file
reactivity_classifier_AttentiveFP.pywith the trained model path.
- Update the file
-
Run Inference
python AttFP_ID_CRM_infer.py
To predict complete CRMs, specify the input SMILES in the NewCRM_Prediction.py script and execute
python NewCRM_Prediction.pyIf you use DeepMech in your research, please cite it as:
@misc{deepmech2025,
title = {DeepMech: A Machine Learning Framework for Chemical Reaction Mechanism Prediction},
author = {},
year = {2025},
howpublished = {\url{https://github.com/alhqlearn/DeepMech}},
}