Implemetation guided diffusion using property embedding and classifier free guidance
Clone this repo, cd into its directory, and run
pip install -e .
or
pip install git+https://github.com/paprakash/GuidedMatDiffusion.git
The former is the preferred way, as one will still need scripts and configuration files which are present in this repo if installing directly.
torch-scatter and torch-sparse should also be installed. Their installation will depend on the version of PyTorch which is installed. For example, to install the binaries for PyTorch 2.3.0, simply run
pip install torch_scatter torch_sparse -f https://data.pyg.org/whl/torch-2.3.0+${CUDA}.html
where ${CUDA} should be replaced by either cpu, cu118, or cu121 depending on your PyTorch installation.
cpu |
cu118 |
cu121 |
|
|---|---|---|---|
| Linux | ✅ | ✅ | ✅ |
| Windows | ✅ | ✅ | ✅ |
| macOS | ✅ |
Rename the .env.template file into .env , specify the below variables and source it.
PROJECT_ROOT: the absolute path of this repo
HYDRA_JOBS: the absolute path to save hydra outputs
WABDB_DIR: the absolute path to save wabdb outputs
Fine-tuning a pre-trained foundation model for the Ab Initio Generation task
python diffcsp/run.py data=supccomb_12 model=diffusion_w_type expname=<expname> train.ckpt_path=<path_to_pretrained_checkpoint>
The <dataset> tag for fine_tuning for superconductivity is supcomb_12 but other dataset can be selected from perov_5, mp_20, mpts_52 and carbon_24, and the <expname> tag can be an arbitrary name to identify each experiment. Trained checkpoint to generates superconductors as well as a pre-trained foundation model used for fine-tunning is provided at hugging_face.
If one does not want to use WandB during training, comment out the "wandb" section in conf/logging/<your_config>.yaml.
python scripts/generation.py --model_path <model_path> --dataset supccomb_12 --save_path <path_to_save_gen_structures> --band_gap <scaled/normalized_Tc> --guide_w <Guidace_weight> --batch_size <batch_size> --num_batch_to_sample <samples_in_each_batch>
To-do: changing the band_gap tag to property
Note: To scale the property, here T_c value (Tc_actual) you want to give the model use -
scaler = torch.load(Path(scaler_path) / 'prop_scaler.pt')
Tc = scaler.transform(Tc_actual)
Details of pre-training a foundation model, with alexandria dataset can be found in the pre_training branch.
The main framework of this codebase is build upon DiffCSP.Fine-tuning superconductivity dataset is from combining Cerqueira et al and Gibson et al. For pre-training alexandria dataset is from Alexandria.
@misc{prakash2025guidediff,
title={Guided Diffusion for the Discovery of New Superconductors},
author={Pawan Prakash and Jason B. Gibson and Zhongwei Li and Gabriele Di Gianluca and Juan Esquivel and Eric Fuemmeler and Benjamin Geisler and Jung Soo Kim and Adrian Roitberg and Ellad B. Tadmor and Mingjie Liu and Stefano Martiniani and Gregory R. Stewart and James J. Hamlin and Peter J. Hirschfeld and Richard G. Hennig},
year={2025},
eprint={2509.25186},
archivePrefix={arXiv},
primaryClass={cond-mat.supr-con},
url={https://arxiv.org/abs/2509.25186},
}

