SeFMol: Steering Semi-flexible Molecular Diffusion Model for Structure-Based Drug Design with Reinforcement Learning
May 2, 2026 ยท View on GitHub
Official repository for the paper "Steering Semi-flexible Molecular Diffusion Model for Structure-Based Drug Design with Reinforcement Learning" (Science Advances).
News ๐ฉ
-
๐ March 2026: The SeFMol platform officially went live, enabling no-code online access to our molecular design tools.
-
๐ March 2026: SeFMol was accepted by Science Advances.
-
๐ May 2025: We released SeFMol, a tool for rapidly generating high-affinity molecules with desired properties for specific protein pockets.
Key Features
-
Two-Stage Rigid Training: Combines property-biased pretraining on Molecule3D dataset with target-aware fine-tuning on protein-ligand pairs
-
RL-Optimized Semi-Flexibility: Models denoising as Markov decision process with KL-constrained policy network for semi-flexible conformation exploration
-
20x Faster Sampling: Revolutionary fast training-free sampling strategy reducing steps to 1/20th of conventional diffusion models
-
Sparse Reward Solution: Addresses sparse affinity signals through property-conditioned reinforcement learning
-
User-friendly Platform: Integrated visualization interface
Platform Preview
The SeFMol web platform is now live for no-code molecular design and visualization workflows. The figures below show key interface modules.
Installation
Create Environment
conda create -n SeFMol python=3.9
conda activate SeFMol
Install Dependencies
# Install PyTorch with CUDA 11.7
conda install pytorch==1.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
# Install molecular modeling dependencies
conda install -c conda-forge pdbfixer
conda install conda-forge::openbabel
conda install pyyaml easydict python-lmdb -c conda-forge
# Install Python packages
pip install protobuf==5.27.1
pip install networkx==3.2.1
pip install rdkit==2023.9.6
pip install biopython==1.83
# For Vina Docking
pip install meeko==0.1.dev3 scipy pdb2pqr vina==1.2.2
python -m pip install git+https://github.com/Valdes-Tresanco-MS/AutoDockTools_py3
# For EDeN
pip install git+https://github.com/fabriziocosta/EDeN.git --user
Data Preparation
We provide data in two forms:
-
Raw data โ obtain the original CrossDocked-derived datasets and related splits following the data preparation instructions in the TargetDiff repository: https://github.com/guanjq/targetdiff.
-
Preprocessed training pack โ LMDB and split files used for pre-training and fine-tuning. Download https://zenodo.org/records/17790890/files/data.tar.gz?download=1.
For training:
crossdocked_v1.1_rmsd1.0_pocket10_processed_final.lmdbcrossdocked_pocket10_pose_split.pt
For evaluation:
test_set.zip(unzip before use)
Checkpoints and Results Downloads
- Pre-trained checkpoint: https://zenodo.org/records/17790890/files/checkpoint.tar.gz?download=1
- Baseline and model sampling results (including docked results): We provide sampling results for SeFMol, AR, Pocket2Mol, ResGen, FLAG, TargetDiff, DecompDiff, MolCRAFT, and IPDiff baselines: https://zenodo.org/records/17790890/files/eval_results.tar.gz?download=1
Training
1. Rigid Pre-training
python train_rigid_pt.py
2. Rigid Fine-tuning
python train_rigid_ft.py
3. Semi-flexible Training
python train_sfrl.py
Sampling
python sample.py \
--config configs/rl.yml \
--start_index 0 \
--end_index 99 \
--timesteps 50
--timesteps Argument
| Property | Value |
|---|---|
| Range | 10 to 1000 (controls diffusion steps) |
| Recommendation | 50 (optimal speed/quality balance) |
| Performance | 20x faster than default (1000 steps) No detectable quality loss |
Evaluation
Evaluate generated molecules:
python eval_split_diff.py
Citation
If you find our work helpful, please cite:
@article{zhang2026sefmol,
title = {Steering Semi-Flexible Molecular Diffusion Model for Structure-Based Drug Design with Reinforcement Learning},
author = {Zhang, Xudong and Qu, Sanqing and Lu, Fan and Wang, Jianmin and Tian, Zhixin and Gu, Shangding and Zhang, Yanping and Knoll, Alois and Gao, Shaorong and Chen, Guang and Jiang, Changjun},
journal = {Science Advances},
volume = {12},
number = {16},
year = {2026},
doi = {10.1126/sciadv.ady9955},
url = {https://www.science.org/doi/10.1126/sciadv.ady9955}
}