Code supporting the paper Refining machine learning potentials through thermodynamic theory of phase transitions.
This repository contains the following files:
examples/titanium/
| data/ -- Refererence data (properties)
| ...
| model/ -- Trained and refined model
| ...
| notebooks/ -- Evaluation of training and simulations
| ...
| scripts/ -- Training scripts
| eval_utils.py -- Evaluate free energy computations
| export.py -- Export model to LAMMPS
| predict.py -- Predict U, F, etc. on DFT samples
| train_all_parallel.py -- Refine model on phase diagram/
| train_utils.py -- Model definition, optimizer, etc.
| train.py -- Pretrain model with Force Matching
| visualize.py -- Visualize results from multiple simulations
| simulations/
| lammps/ -- Simulation input scripts
| ...
| mace-mp/ -- MACE-MP-0b3 foundational model files
| ..
| scripts/ -- Run multiple bundled lammps simulations
| ...
| external/ -- Dependencies to be installed
| chemtrain/ -- Modified version of chemtrain
| ...
| chemutils/ -- MACE model and dataset loader
| ...
| lammps/ -- Used LAMMPS version (subrepo)
| ...
| juwels/ -- Extra scripts to run on HPC cluster
| ...
First, install the external dependencies in the following order:
pip install -e "./external/chemtrain[all]"
pip install -e "./external/chemutils"
pip install "jax[cuda12]==0.4.37" --force-reinstallTo pretrain a model with the given hyperparameter on the CUDA device 0, run the following command:
cd examples/titanium/scripts
python train.py "0"To refine the provided pretrained model via DiffTTC on the prepared setup, run the following command:
cd examples/titanium/scripts
python train_all_parallel.py "0"To install the LAMMPS plugin, please refer to the documentation.
First, train an MLP using the command given in Quickstart.
This command will create a model folder titanium__train* in the parent directory examples/titanium/scripts/output.
The model can be copied into the models folder examples/titanium/models.
Then, the LAMMPS simulations can be run by specifying the model in the run_*.sh scripts located in the folder examples/titanium/simulations by executing them outside their parent directory.
For example, to run the coexistence simulations, enter the command:
cd examples/titanium/simulations
bash scripts/run_coexistence.shSome simulations have to be run in a specific order, including postprocessing scripts.
For the HCP-BCC transition:
run_prepare.shand computehcp_constants.txtandbcc_constants.txt.run_ti_bcc.shandrun_ti_hcp.shrun_rs_bcc-hcp.shrun_create_bcc_box.shandrun_create_hcp_box.shand convert to pdb
For the BCC-Liquid transition:
run_coexistence.shand computetemps.txtrun_prepare_liquid.shand computebcc_constants.txtandliquid_constants.txtrun_rs_bcc-liquid.shrun_create_bcc_box.shandrun_create_liquid_box.shand convert to pdb
The thermal expansion, MSD and VACF have to be computed last:
run_thermal_expansion.shrun_compute_msd.shandrun_compute_vacf.sh
The prepared free energy targets and simulation boxes have to be defined in the training script train_all_parallel.py. Then, the script can be run via the instructions given in Quickstart.
If you use DiffTTC, please cite:
@article{fuchsDiffTTC2026,
title = {Refining Machine Learning Potentials through Thermodynamic Theory of Phase Transitions},
author = {Fuchs, Paul and Zavadlav, Julija},
date = {2026-06-22},
journaltitle = {npj Computational Materials},
shortjournal = {npj Comput Mater},
issn = {2057-3960},
doi = {10.1038/s41524-026-02195-7},
url = {https://doi.org/10.1038/s41524-026-02195-7},
}