Before you start
- This part is for students who needs MACE for their research. If you don't use MACE, then you can ignore this page.
- You should finish the orientation before proceed this tutorial. Make sure that you have installed MACE in Python venv.
Fine-tuning a MACE model¶
Why fine-tuning?¶
Foundation model are not accurate enough to solve our problem.
-
It is known (http://arxiv.org/abs/2405.07105) that foundation model (MACE-MP-0) will underestimate the activation energy barrier. The reason is because the training data are mostly coming from the region near the energy minimum.
-
If your calculation used different input parameters compared to Materials Project, the energy and forces might not be comparable.
Tips¶
- You must supply your DFT computed atomic energies of your system. For example, for \(\ce{Al(HCOO)3}\), you need to supply energies of Al, H, C, O in a large empty box (at least \(10\times 10\times 10 Å^3\)) as
--E0s. - You should use
--multiheads_finetuning=Truefor better fine tuning results. - You should use
--enable_cueq=Truefor better performance.
How to fine tune a model¶
You should refer to the official documentation of MACE: https://mace-docs.readthedocs.io/en/latest/guide/finetuning.html. An example of the trainig script is shown below:
mace_run_train \
--name="name" \
--multiheads_finetuning=True \
--foundation_model="mace_agnesi_medium.model"\
--train_file="data.xyz" \
--valid_fraction=0.1 \
--energy_weight=1 \
--forces_weight=10 \
--compute_stress=True \
--stress_weight=1 \
--stress_key='stress' \
--swa \
--swa_forces_weight=100\
--E0s="{32:-13.928397,3:-0.40914546,8:-0.62290835,15:-4.5251547,16:-5.1361696}"\
--model="MACE" \
--scaling='rms_forces_scaling' \
--lr=0.01 \
--ema \
--ema_decay=0.99 \
--batch_size=24 \
--max_num_epochs=100 \
--amsgrad \
--device="cuda" \
--seed=1234 \
--scheduler_patience=5 \
--patience=50 \
--enable_cueq=True \
--default_dtype="float64" > train.log