Nudge elastic bands with MLIPS#
janus-core
contains various machine learnt interatomic potentials (MLIPs), including MACE based models (MACE-MP, MACE-OFF), CHGNet, SevenNet and more, full list on stfc/janus-core.
Other will be added as their utility is proven beyond a specific material.
Aim#
We showcase the use of NEB with janus and MLIPs by stuing Ethanol oxidation reactions catalyzed by water molecules, the full study was carried out in this paper Chemical Physics Letters 363 (2002) 80–86
Set up environment (optional)#
These steps are required for Google Colab, but may work on other systems too:
# import locale
# locale.getpreferredencoding = lambda: "UTF-8"
# ! pip uninstall torch torchaudio torchvision numpy -y
# ! uv pip install janus-core[all] data-tutorials torch==2.5.1 --system
# get_ipython().kernel.do_shutdown(restart=True)
Use data_tutorials
to get the data required for this tutorial:
from data_tutorials.data import get_data
get_data(
url="https://gitlab.com/cam-ml/tutorials/-/raw/main/notebooks/day-4/data/",
filename=["ethanol_reactants.extxyz", "ethanol_products.extxyz","ethanol_reactants_1water.extxyz","ethanol_products_1water.extxyz","ethanol_reactants_2water.extxyz","ethanol_products_2water.extxyz"],
folder="data",
)
Command-line help and options#
Once janus-core
is installed, the janus
CLI command should be available:
! janus neb --help
run a simple Nudge Elastic Bands#
0 water molecules case#
%%writefile neb.yml
init_struct: data/ethanol_reactants.extxyz
final_struct: data/ethanol_products.extxyz
n_images: 11
device: cuda
arch: mace_mp
minimize: True
plot_band: True
write_band: True
calc_kwargs:
dispersion: True
model: medium-omat-0
tracker: False
visualise the inputs
from ase.io import read
from weas_widget import WeasWidget
r = read("data/ethanol_reactants.extxyz")
p = read("data/ethanol_products.extxyz")
v=WeasWidget()
v.from_ase([r,p])
v.avr.model_style = 1
v.avr.show_hydrogen_bonds = True
v
!janus neb --config neb.yml
!ls janus_results/
from IPython.display import SVG, display
display(SVG("janus_results/ethanol_reactants-neb-plot.svg"))
nebp = read("janus_results/ethanol_reactants-neb-band.extxyz", index=":")
w=WeasWidget()
w.from_ase(nebp)
w.avr.model_style = 1
w.avr.show_hydrogen_bonds = True
w
is the barrier realistic? compare with the numbers from the paper.
1 water molecule#
we can use the previous config and just overwrite the init and final structures
! janus neb --config neb.yml --init-struct data/ethanol_reactants_1water.extxyz --final-struct data/ethanol_products_1water.extxyz
!ls janus_results/
display(SVG("janus_results/ethanol_reactants_1water-neb-plot.svg"))
from ase.io import read
from weas_widget import WeasWidget
nebp = read("janus_results/ethanol_reactants_1water-neb-band.extxyz", index=":")
w1=WeasWidget()
w1.from_ase(nebp)
w1.avr.model_style = 1
w1.avr.show_hydrogen_bonds = True
w1
2 water molecules#
! janus neb --config neb.yml --init-struct data/ethanol_reactants_2water.extxyz --final-struct data/ethanol_products_2water.extxyz
display(SVG("janus_results/ethanol_reactants_2water-neb-plot.svg"))
from ase.io import read
from weas_widget import WeasWidget
nebp = read("janus_results/ethanol_reactants_2water-neb-band.extxyz", index=":")
w2=WeasWidget()
w2.from_ase(nebp)
w2.avr.model_style = 1
w2.avr.show_hydrogen_bonds = True
w2
extra bits#
analyse the barrier height trend and compare it with the paper.
consider redoing the same exercise with a different potential… remember if you use mace-off dispersion needs to be off. set arch to mace_off and model to large.
other potentials to consider, medium-mpa-0 (trained on MPTrj+alexandria) andd medium-0b3(trained on MPTrj only)