[Paper]
- If you are interested in generating molecules based on the protein pocket structure, please refer to our new paper 'PMDM' which is recently accepted by Nature Communications !!
- RDKit
- PyTorch
- Scipy
- torch-scatter
- torch-geometric
You can also clone our environment file.
# Clone the environment
conda env create -f MDM.yml
# Activate the environment
conda activate MDMDownload the dataset and split it.
cd ./qm9/data/prepare/
python ./qm9/data/prepare/download.pyYou can also download the data from https://drive.google.com/file/d/1JZ_Z5bjS0RsX_BRWtrplMN9vZpL78-T7/view?usp=drive_link and put it under data/QM9/qm9/raw.
- 
Download the file at https://dataverse.harvard.edu/file.xhtml?fileId=4360331&version=2.0 (Warning: 50gb): wget https://dataverse.harvard.edu/api/access/datafile/4360331
- 
Untar it and move it to data/geom/ tar -xzvf 4360331
- 
pip install msgpack
- 
python3 build_geom_dataset.py --conformations 1
python train.py --config './configs/qm9_full_epoch.yml'python train.py --config './configs/geom_full.yml'python test_eval.py --ckpt <checkpoint> --sampling_type generalized --w_global_pos 1 -- w_global_node 1 --w_local_pos 4 --w_local_node 5python train_qm9_condition.py --config './configs/qm9_full_epoch.yml' --context {property name} --config_name {config_name}The property name includes homo | lumo | alpha | gap | mu | Cv. For example, you could set --context alpha to train MDM conditioned on alpha. MDM also supports multiple properties conditioned generation. For example, you could set --context alpha gap to train MDM conditioned on alpha and gap.
python eval_qm9_condition_quality.py --ckpt {saved_chekpoint} --num_samples {num_samples} You should use the saved checkpoint of train_qm9_condition.py as {saved_checkpoint}
If you would like to train the classifier by yourself
cd qm9/property_predictionpython main_qm9_prop.py --num_workers 2 --lr 5e-4 --property alpha --exp_name exp_class_alpha --model_name egnnpython eval_qm9_condition.py --ckpt {saved_chekpoint} --classifiers_path {saved_cls_checkpoint}You should use the saved checkpoint of train_qm9_condition.py as {saved_checkpoint} and the saved checkpoint of main_qm9_prop.py as {saved_cls_checkpoint}
@article{huang2022mdm,
  title={MDM: Molecular Diffusion Model for 3D Molecule Generation},
  author={Huang, Lei and Zhang, Hengtong and Xu, Tingyang and Wong, Ka-Chun},
  journal={arXiv preprint arXiv:2209.05710},
  year={2022}
}