Variational free energy method source code for hydrogen Hugoniot
- Pretrain and train models for warm dense hydrogen or deuterium
- Compute equation of state for hydrogen in warm dense matter region
- Visualize results and compute Hugoniot curves
Clone this repository and install the dependencies:
git clone https://github.com/fermiflow/Hugoniot.git
cd Hugoniot
pip install -r requirements.txtInstall hqc
cd hqc
pip install -e .Install cfgmanager
cd cfgmanager
pip install -e .Then you can train your own hydrogen model.
- Use
pretrainflow.pyto pretrain nucleus flow model. - Change
config_pathandconfig_nameinpretrainflow.pyl.31 to change the config file to load. - Change the parameters in config file, like
conf/pretrain/flow/config.yaml, or override values in the loaded config from the command line to pretrain your model (we use hydra to manage our config files):
python pretrainflow.py num=16 rs=1.86 T=10000 batchsize=256- Use
folderparameter to specify the directory to save data and checkpoint files.
- Use
main.pyto train all of the three neural networks. - Change
config_pathandconfig_nameinmain.pyl.36 to change the config file to load. - Change the parameters in config file, like
conf/train/config.yaml, or override values in the loaded config from the command line to pretrain your model.:
python main.py \
num=16 \
rs=1.86 \
T=10000 \
batchsize=256 \
load_pretrain.flow=/your/pretrain/checkpoint/path/epoch_001000.pkl- Use
load_pretrain.flowparameter to specify the pretrained flow to load (if None, it will train from uniform distribution). - Use
loadparameter to specify the checkpoint file to load and continue training. - Use
folderparameter to specify the directory to save data and checkpoint files.
Dataset including equation of states, training parameters, network checkpoints, nucleus and electron snapshots are published on Hugging Face
If you use this code in your research, please cite our article:
@article{8zn5-6dnt,
title = {Deep variational free energy calculation of hydrogen Hugoniot},
author = {Li, Zihang, Xie, Hao, Dong, Xinyang, and Wang, Lei},
journal = {Phys. Rev. Lett.},
pages = {--},
year = {2026},
month = {Jan},
publisher = {American Physical Society},
doi = {10.1103/8zn5-6dnt},
url = {https://link.aps.org/doi/10.1103/8zn5-6dnt}
}
Contributions are welcome! 🎉
If you’d like to contribute, open a Pull Request (PR).
This project is licensed under the MIT License. See the LICENSE file for details.
