CBGBench

September 14, 2025 ยท View on GitHub

CBGBench Logo

PyTorch Paper DeepModeling

CBGBench: Complex Binding Graph Benchmark is a benchmark for generative target-aware molecule design.

Paper [DiffBP] | Paper [D3FG] | Benchmark

Note

  • Feb. 2025: Accepted by ICLR2025 as spotlight presentation. Congrats! Some of pretrained checkpoints of the edge-cutting methods have been released, pls download from Google Drive for further usage.
  • Dec. 2024: We have uploaded the molecules generated by the SOTA Methods for de novo design (LiGAN, Pocket2Mol, TargetDiff, D3FG, DecomptDiff, VoxBind, and MolCraft) for evaluation. For most of them, the generated number is 100/pockets, while for some 200 (2 times) in order to check if it is necessary to report multi-seeds' results. If it is useful for your research, pls download from the Google Drive and cite the paper.
  • Oct. 2024: CBGBench paper v3 has just integrated the state-of-the-art MolCraft and VoxBind into evaluation, and the integration of their codes is in process.
  • Sep. 2024: CBGBench has joined the DeepModeling community, a community devoted to AI for science, as a sandbox-level project. Learn more about DeepModeling

Introduction

This is the official code repository of the paper 'CBGBench: Fill in the Blank of Protein-Molecule Binding Graph', which aims to unify target-aware molecule design with single code implementation. Until now, we have included 7 methods as shown below:

ModelPaper linkGithub
Pocket2Molhttps://arxiv.org/abs/2205.07249https://github.com/pengxingang/Pocket2Mol
GraphBPhttps://arxiv.org/abs/2204.09410https://github.com/divelab/GraphBP
DiffSBDDhttps://arxiv.org/abs/2210.13695https://github.com/arneschneuing/DiffSBDD
DiffBPhttps://arxiv.org/abs/2211.11214Here is the official implementation.
TargetDiffhttps://arxiv.org/abs/2303.03543https://github.com/guanjq/targetdiff
FLAGhttps://openreview.net/forum?id=Rq13idF0F73https://github.com/zaixizhang/FLAG
D3FGhttps://arxiv.org/abs/2306.13769Here is the official implementation.

These models are initially established for de novo molecule generation, and we extend more tasks including linker design, fragment growing, scaffold hopping, and side chain decoration.

Extend Tasks

Installation

Create environment with basic packages.

conda env create -f environment.yml
conda activate cbgbench

Install pytorch and torch_geometric

conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia
conda install pyg pytorch-scatter pytorch-cluster -c pyg

Install tools for chemistry

# install rdkit, efgs, obabel, etc.
pip install --use-pep517 EFGs
pip install biopython
pip install lxml
conda install rdkit openbabel tensorboard tqdm pyyaml easydict python-lmdb -c conda-forge

# install plip
mkdir tools
cd tools
git clone https://github.com/pharmai/plip.git
cd plip
python setup.py install
alias plip='python plip/plip/plipcmd.py'
cd ..

### Note that if there is an error in setup.py, it can be ignored as long as openbabel is installed.

# install docking tools
conda install -c conda-forge numpy swig boost-cpp sphinx sphinx_rtd_theme
python -m pip install git+https://github.com/Valdes-Tresanco-MS/AutoDockTools_py3
pip install meeko==0.1.dev3 scipy pdb2pqr vina

# If you are unable to install vina, you can try: conda install vina
# If you encounter the following error:
# ImportError: libtiff.so.5: cannot open shared object file: No such file or directory
# Please try the following steps to resolve it:
pip uninstall pillow
pip install pillow

Prepare Dataset

CrossDocked2020

1. Download processed datasets

(i) Download the processed dataset from Google Drive. For each dataset, it corresponds to different methods and tasks. Please refer to the Table below to find the processed data that you need to use. Note that to train D3FG, it is a two-stage model that firstly generates functional groups and then generates linker atoms, so we named the two-stage model 'D3FG_fg' and 'D3FG_linker', and the training data is different for them.

Table: The data file name corresponding to different methods and tasks.

modeltaskfile name
Pocket2Molde novodata/pl/crossdocked_v1.1_rmsd1.0_pocket10_processed_fullatom.lmdb
GraphBPde novodata/pl/crossdocked_v1.1_rmsd1.0_pocket10_processed_fullatom.lmdb
DiffSBDDde novodata/pl/crossdocked_v1.1_rmsd1.0_pocket10_processed_fullatom.lmdb
DiffBPde novodata/pl/crossdocked_v1.1_rmsd1.0_pocket10_processed_fullatom.lmdb
TargetDiffde novodata/pl/crossdocked_v1.1_rmsd1.0_pocket10_processed_fullatom.lmdb
FLAGde novodata/pl_arfg/crossdocked_v1.1_rmsd1.0_pocket10_processed_arfuncgroup.lmdb
D3FGde novodata/pl_fg/crossdocked_v1.1_rmsd1.0_pocket10_processed_funcgroup.lmdb
Pocket2Molfragmentdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_frag.lmdb
GraphBPfragmentdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_frag.lmdb
DiffSBDDfragmentdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_frag.lmdb
DiffBPfragmentdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_frag.lmdb
TargetDifffragmentdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_frag.lmdb
Pocket2Mollinkerdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
GraphBPlinkerdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
DiffSBDDlinkerdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
DiffBPlinkerdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
TargetDifflinkerdata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
Pocket2Molscaffolddata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_scaffold.lmdb
GraphBPscaffolddata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_scaffold.lmdb
DiffSBDDscaffolddata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_scaffold.lmdb
DiffBPscaffolddata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_scaffold.lmdb
TargetDiffscaffolddata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_scaffold.lmdb
Pocket2Molside chaindata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_sidechain.lmdb
GraphBPside chaindata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_sidechain.lmdb
DiffSBDDside chaindata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_sidechain.lmdb
DiffBPside chaindata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_sidechain.lmdb
TargetDiffside chaindata/pl_decomp/crossdocked_v1.1_rmsd1.0_pocket10_processed_sidechain.lmdb

(ii) Copy the datasets to ./data dir, in which the complete data file directory will look like

- CGBBench
    - data
        - pl
            - crossdocked_name2id.pt
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_fullatom.lmdb
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
        - pl_arfg
            - crossdocked_name2id_arfuncgroup.pt
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_arfuncgroup.lmdb
        - pl_decomp
            - crossdocked_name2id_frag.pt
            - crossdocked_name2id_linker.pt
            - crossdocked_name2id_scaffold.pt
            - crossdocked_name2id_sidechain.pt
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_frag.lmdb
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_linker.lmdb
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_scaffold.lmdb
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_sidechain.lmdb
        - pl_fg
            - crossdocked_name2id_funcgroup.pt
            - crossdocked_v1.1_rmsd1.0_pocket10_processed_funcgroup.lmdb

2. Download raw data and prepare from scratch

(i) Download crossdocked_v1.1_rmsd1.0.tar.gz from TargetDiff Drive, and copy it to ./raw_data/ with

mkdir raw_data
tar -xzvf crossdocked_v1.1_rmsd1.0.tar.gz ./raw_data

(ii) Run the following:

python ./scripts/extract_pockets.py --source raw_data/crossdocked_v1.1_rmsd1.0 --dest raw_data/crossdocked_v1.1_rmsd1.0_pocket10

(iii) In training, the Dataset will be prepared for each task. Please refer to Training.

ADRB1 and DRD3 Targets

Download processed targets.

Also, you can download the processes targets file case_study from Google Drive, and copy it to the ./data directory, which will lead the dir to

- CGBBench
    - data
        - case_study
            - processed
                - case_study_processed_fullatom.lmdb
                - case_study_processed_funcgroup.lmdb
                - case_study_name2id.pt
                ...

Training

1. If you want to train from scratch, you can run the following

python train.py --config ./configs/{task}/train/{method}.yml --logdir ./logs/{task}/{method}

{task} can be replaced with denovo, linker, frag, scaffold and sidechain, and {method} can be replaced with the model name. The following table gives the detailed method-task pairs and the replacement.

Table: method-task pairs used to train from scratch.

MethodTask{method} + {task}
Pocket2Molde novopocket2mol + denovo
GraphBPde novographbp + denovo
DiffSBDDde novodiffsbdd + denovo
DiffBPde novodiffbp + denovo
TargetDiffde novotargetdiff + denovo
FLAGde novoflag + denovo
D3FGde novod3fg_fg + denovo ; d3fg_linker + denovo
Pocket2Mollinker designpocket2mol + linker
GraphBPlinker designgraphbp + linker
DiffSBDDlinker designdiffsbdd + linker
DiffBPlinker designdiffbp + linker
TargetDifflinker designtargetdiff + linker
Pocket2Molfragment growingpocket2mol + frag
GraphBPfragment growinggraphbp + frag
DiffSBDDfragment growingdiffsbdd + frag
DiffBPfragment growingdiffbp + frag
TargetDifffragment growingtargetdiff + frag
Pocket2Molscaffold hoppingpocket2mol + scaffold
GraphBPscaffold hoppinggraphbp + scaffold
DiffSBDDscaffold hoppingdiffsbdd + scaffold
DiffBPscaffold hoppingdiffbp + scaffold
TargetDiffscaffold hoppingtargetdiff + scaffold
Pocket2Molside chain decorationpocket2mol + sidechain
GraphBPside chain decorationgraphbp + sidechain
DiffSBDDside chain decorationdiffsbdd + sidechain
DiffBPside chain decorationdiffbp + sidechain
TargetDiffside chain decorationtargetdiff + sidechain

Note that D3FG and FLAG are not compatible with the extended tasks, and D3FG utilizes 2-stage-training strategies, so if you want to train D3FG yourself, you need to run:

python train.py --config ./configs/denovo/train/d3fg_fg.yml --logdir ./logs/denovo/d3fg_fg
python train.py --config ./configs/denovo/train/d3fg_linker.yml --logdir ./logs/denovo/d3fg_linker

2. Also, you can use our pretrained ones from Google Drive, the corresponding pretrained data file names to different tasks and models are provided in the form below:

{task}/{method}/pretrained.pt

Download the pretrained .pt checkpoints that you need, and copy them into ./logs/, which will lead to the following directory structure:

- CBGBench
    - logs
        - denovo
            - d3fg_fg
                - pretrain
                    - checkpoints
                        - pretrained.pt
            - d3fg_linker
                - pretrain
                    - checkpoints
                        - pretrained.pt
            - diffbp
                - pretrain
                    - checkpoints
                        - pretrained.pt
            ...
        - frag
            - diffbp
                - pretrain
                    - checkpoints
                        - pretrained.pt
            ...
        ...

Generation on test sets

Once the model is trained, you can draw samples from them on the test pockets, with the following:

bash generate.sh --method {method} --task {task} --tag {tag} --checkpoint {ckpt_number}

In the command, {method} and {task} pair can be found in the former Table on method-task pairs. {tag} should be replaced with selftrain or pretrain, according to the checkpoints you use. If the --checkpoint parameter is provided without a number, it will automatically find the latest .pt file. If a number is provided, it will use the specified checkpoint file.

For example, if you want to generate samples on the test set for de novo design with the downloaded pretrained targetdiff model, you can run:

bash generate.sh --method targetdiff --task denovo --tag pretrain --checkpoint pretrained

If you want to generate samples on the test set for de novo design with self-trained targetdiff model, you can run:

bash generate.sh --method targetdiff --task denovo --tag selftrain --checkpoint

Or if you want to test the checkpoint of the 100000-th.

bash generate.sh --method targetdiff --task denovo --tag selftrain --checkpoint 100000

Note that D3FG uses a two-step generation strategy, so the command should be

bash generate.sh --method d3fg_fg --task denovo --tag {tag} --checkpoint  # generate the functional groups
bash generate.sh --method d3fg_linker --task denovo --tag {tag} --checkpoint # generate the linkers

We give the selected generated molecules by state-of-the-art methods in our benchmark for the de novo task, which can be downloaded from the Google Drive. You can directly download them for evaluation. Besides, in each directory, there are metrics files ending with .pt as the raw evaluation results.

Evaluation

Run the following:

cd evaluate_scripts
bash evaluate.sh --method {method} --task {task} --tag {tag}

For example, if you have trained TargetDiff by yourself, run

bash evaluate.sh --method targetdiff --task denovo --tag selftrain
bash evaluate.sh --method targetdiff --task frag --tag selftrain
bash evaluate.sh --method targetdiff --task linker --tag selftrain
bash evaluate.sh --method targetdiff --task scaffold --tag selftrain
bash evaluate.sh --method targetdiff --task sidechain --tag selftrain

Or if you have downloaded pretrained models, please run

cd evaluate_scripts
bash bash evaluate.sh --method {method} --task {task} --tag pretrained

TODO List

  1. Use the pretrained models to generate molecules on real-world targets flexibly.

  2. Include more models, such as 3DSBDD, DecompDiff, VoxMol, and LiGAN.

3. Release the pretrained models, and test the feasibility and reproducibility once the paper is published.

Contribution

The codebase is initialized by Haitao Lin and Odin Zhang, with the CBGbench v1 as our motivation; The subsequent running of the code repository will be managed by Haitao Lin, Guojiang Zhao and his team of DP Technology.

If you find the repository is helpful to your research or projects, please cite our benchmark paper as reference:

@inproceedings{
lin2025cbgbench,
title={{CBGB}ench: Fill in the Blank of Protein-Molecule Complex Binding Graph},
author={Haitao Lin and Guojiang Zhao and Odin Zhang and Yufei Huang and Lirong Wu and Cheng Tan and Zicheng Liu and Zhifeng Gao and Stan Z. Li},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=mOpNrrV2zH}
}

And our former works of DiffBP and D3FG:

@Article{lin2025diffbp,
author ="Lin, Haitao and Huang, Yufei and Zhang, Odin and Ma, Siqi and Liu, Meng and Li, Xuanjing and Wu, Lirong and Wang, Jishui and Hou, Tingjun and Li, Stan Z.",
title  ="DiffBP: generative diffusion of 3D molecules for target protein binding",
journal  ="Chem. Sci.",
year  ="2025",
volume  ="16",
issue  ="3",
pages  ="1417-1431",
publisher  ="The Royal Society of Chemistry",
doi  ="10.1039/D4SC05894A",
url  ="http://dx.doi.org/10.1039/D4SC05894A",
}

@inproceedings{
lin2023functionalgroupbased,
title={Functional-Group-Based Diffusion for Pocket-Specific Molecule Generation and Elaboration},
author={Haitao Lin and Yufei Huang and Odin Zhang and Yunfan Liu and Lirong Wu and Siyuan Li and Zhiyuan Chen and Stan Z. Li},
booktitle={Thirty-seventh Conference on Neural Information Processing Systems},
year={2023},
url={https://openreview.net/forum?id=lRG11M91dx}
}

Licence

This project is licensed under the terms of the GPL-3.0 license.