| Property | Value |
|---|---|
| Difficulty | Advanced |
| Time | 30-45 minutes |
| Prerequisites | Understanding of NEB, ASE, catalysis |
| Goal | Find transition states using CatTsunami tools |
FAIR chemistry models can be used to enumerate and study reaction pathways via transition state search tools built into ASE or in packages like Sella via the ASE interface.
Since the NEB calculations here can be a bit time consuming, we’ll use a small number of steps during the documentation testing, and otherwise use a reasonable guess.
import os
# Use a small number of steps here to keep the docs fast during CI, but otherwise do quite reasonable settings.
fast_docs = os.environ.get("FAST_DOCS", "false").lower() == "true"
if fast_docs:
optimization_steps = 20
else:
optimization_steps = 300Need to install fairchem-core or get UMA access or getting permissions/401 errors?
Install the necessary packages using pip, uv etc
! pip install fairchem-core fairchem-data-oc fairchem-applications-cattsunamiGet access to any necessary huggingface gated models
Get and login to your Huggingface account
Request access to https://
huggingface .co /facebook /UMA Create a Huggingface token at https://
huggingface .co /settings /tokens/ with the permission “Permissions: Read access to contents of all public gated repos you can access” Add the token as an environment variable using
huggingface-cli loginor by setting the HF_TOKEN environment variable.
# Login using the huggingface-cli utility
! huggingface-cli login
# alternatively,
import os
os.environ['HF_TOKEN'] = 'MY_TOKEN'Do enumerations in an AdsorbML style¶
from __future__ import annotations
import matplotlib.pyplot as plt
from ase.io import read
from ase.mep import DyNEB
from ase.optimize import BFGS
from fairchem.applications.cattsunami.core import Reaction
from fairchem.applications.cattsunami.core.autoframe import AutoFrameDissociation
from fairchem.applications.cattsunami.databases import DISSOCIATION_REACTION_DB_PATH
from fairchem.core import FAIRChemCalculator, pretrained_mlip
from fairchem.data.oc.core import Adsorbate, AdsorbateSlabConfig, Bulk, Slab
from fairchem.data.oc.databases.pkls import ADSORBATE_PKL_PATH, BULK_PKL_PATH
from x3dase.x3d import X3D
# Instantiate the reaction class for the reaction of interest
reaction = Reaction(
reaction_str_from_db="*CH -> *C + *H",
reaction_db_path=DISSOCIATION_REACTION_DB_PATH,
adsorbate_db_path=ADSORBATE_PKL_PATH,
)/home/runner/work/_tool/Python/3.12.14/x64/lib/python3.12/site-packages/fairchem/applications/cattsunami/core/reaction.py:29: UserWarning: Loading data from a pickle file. Pickle files can execute arbitrary code and should only be loaded from trusted sources. Consider migrating to a safer format such as Parquet, CSV, or JSON.
reaction_db = safe_pickle_load(reaction_db_path)
/home/runner/work/_tool/Python/3.12.14/x64/lib/python3.12/site-packages/fairchem/applications/cattsunami/core/reaction.py:30: UserWarning: Loading data from a pickle file. Pickle files can execute arbitrary code and should only be loaded from trusted sources. Consider migrating to a safer format such as Parquet, CSV, or JSON.
adsorbate_db = safe_pickle_load(adsorbate_db_path)
# Instantiate our adsorbate class for the reactant and product
reactant = Adsorbate(
adsorbate_id_from_db=reaction.reactant1_idx, adsorbate_db_path=ADSORBATE_PKL_PATH
)
product1 = Adsorbate(
adsorbate_id_from_db=reaction.product1_idx, adsorbate_db_path=ADSORBATE_PKL_PATH
)
product2 = Adsorbate(
adsorbate_id_from_db=reaction.product2_idx, adsorbate_db_path=ADSORBATE_PKL_PATH
)/home/runner/work/_tool/Python/3.12.14/x64/lib/python3.12/site-packages/fairchem/data/oc/core/adsorbate.py:79: UserWarning: Loading data from a pickle file. Pickle files can execute arbitrary code and should only be loaded from trusted sources. Consider migrating to a safer format such as Parquet, CSV, or JSON.
adsorbate_db = safe_pickle_load(fp)
# Grab the bulk and cut the slab we are interested in
bulk = Bulk(bulk_src_id_from_db="mp-33", bulk_db_path=BULK_PKL_PATH)
slab = Slab.from_bulk_get_specific_millers(bulk=bulk, specific_millers=(0, 0, 1))/home/runner/work/_tool/Python/3.12.14/x64/lib/python3.12/site-packages/fairchem/data/oc/core/bulk.py:66: UserWarning: Loading data from a pickle file. Pickle files can execute arbitrary code and should only be loaded from trusted sources. Consider migrating to a safer format such as Parquet, CSV, or JSON.
bulk_db = safe_pickle_load(fp)
# Perform site enumeration
# For AdsorbML num_sites = 100, but we use 5 here for brevity. This should be increased for practical use.
reactant_configs = AdsorbateSlabConfig(
slab=slab[0],
adsorbate=reactant,
mode="random_site_heuristic_placement",
num_sites=10,
).atoms_list
product1_configs = AdsorbateSlabConfig(
slab=slab[0],
adsorbate=product1,
mode="random_site_heuristic_placement",
num_sites=10,
).atoms_list
product2_configs = AdsorbateSlabConfig(
slab=slab[0],
adsorbate=product2,
mode="random_site_heuristic_placement",
num_sites=10,
).atoms_list# Instantiate the calculator
predictor = pretrained_mlip.get_predict_unit("uma-s-1p2")
calc = FAIRChemCalculator(predictor, task_name="oc20")WARNING:root:device was not explicitly set, using device='cuda'.
# Relax the reactant systems
reactant_energies = []
for config in reactant_configs:
config.calc = calc
config.pbc = True
opt = BFGS(config)
opt.run(fmax=0.05, steps=optimization_steps)
reactant_energies.append(config.get_potential_energy())WARNING:root:Model is being compiled this might take a while for the first time
W0820 00:02:47.535000 10195 site-packages/torch/_logging/_internal.py:1345] [0/0] Profiler record function <class 'torch.autograd.profiler.record_function'> will be ignored
Step Time Energy fmax
BFGS: 0 00:03:24 -301.105673 4.105871
BFGS: 1 00:03:26 -301.488884 3.585813
BFGS: 2 00:03:26 -302.511852 3.140089
BFGS: 3 00:03:26 -302.519220 5.104161
BFGS: 4 00:03:26 -302.805333 2.418534
BFGS: 5 00:03:26 -302.949532 1.077845
BFGS: 6 00:03:27 -303.023398 1.656588
BFGS: 7 00:03:27 -303.081199 1.036533
BFGS: 8 00:03:27 -303.180055 1.559007
BFGS: 9 00:03:27 -303.226820 0.987210
BFGS: 10 00:03:28 -303.265765 0.468434
BFGS: 11 00:03:28 -303.286483 0.552860
BFGS: 12 00:03:28 -303.346619 1.024881
BFGS: 13 00:03:28 -303.415252 1.544183
BFGS: 14 00:03:28 -303.494447 1.867366
BFGS: 15 00:03:28 -303.593381 1.842960
BFGS: 16 00:03:29 -303.865118 2.119588
BFGS: 17 00:03:29 -303.767997 2.192460
BFGS: 18 00:03:29 -304.020627 1.133949
BFGS: 19 00:03:29 -304.081520 1.218593
BFGS: 20 00:03:29 -304.125233 0.793415
Step Time Energy fmax
BFGS: 0 00:03:30 -302.525464 3.806511
BFGS: 1 00:03:30 -302.882043 2.777923
BFGS: 2 00:03:30 -303.718571 3.131024
BFGS: 3 00:03:30 -303.870769 2.622716
BFGS: 4 00:03:30 -304.024197 4.073793
BFGS: 5 00:03:30 -304.151561 0.855855
BFGS: 6 00:03:30 -304.190864 0.701819
BFGS: 7 00:03:31 -304.310885 0.515750
BFGS: 8 00:03:31 -304.320846 0.487709
BFGS: 9 00:03:31 -304.341449 0.314331
BFGS: 10 00:03:31 -304.349381 0.177822
BFGS: 11 00:03:31 -304.350814 0.067110
BFGS: 12 00:03:31 -304.351296 0.072891
BFGS: 13 00:03:31 -304.352025 0.083064
BFGS: 14 00:03:32 -304.352298 0.058631
BFGS: 15 00:03:32 -304.352390 0.026054
Step Time Energy fmax
BFGS: 0 00:03:32 -301.426332 4.059312
BFGS: 1 00:03:32 -301.807625 3.164682
BFGS: 2 00:03:32 -302.804938 3.386344
BFGS: 3 00:03:32 -302.940242 3.695972
BFGS: 4 00:03:32 -303.219491 2.109998
BFGS: 5 00:03:32 -303.364616 3.578014
BFGS: 6 00:03:33 -303.477131 1.830344
BFGS: 7 00:03:33 -303.671926 1.218670
BFGS: 8 00:03:33 -303.937514 2.148690
BFGS: 9 00:03:33 -303.995516 1.963283
BFGS: 10 00:03:33 -304.122387 1.062902
BFGS: 11 00:03:33 -304.145024 0.836681
BFGS: 12 00:03:33 -304.238087 0.685512
BFGS: 13 00:03:33 -304.256871 0.592182
BFGS: 14 00:03:33 -304.307985 0.801623
BFGS: 15 00:03:34 -304.348320 0.906754
BFGS: 16 00:03:34 -304.394350 1.400413
BFGS: 17 00:03:34 -304.452369 0.877347
BFGS: 18 00:03:34 -304.489678 0.781564
BFGS: 19 00:03:34 -304.537443 0.903000
BFGS: 20 00:03:34 -304.563369 0.449216
Step Time Energy fmax
BFGS: 0 00:03:34 -300.773012 4.031338
BFGS: 1 00:03:34 -301.219956 3.669759
BFGS: 2 00:03:35 -302.547700 3.587939
BFGS: 3 00:03:35 -302.397056 8.297725
BFGS: 4 00:03:35 -302.853988 2.989856
BFGS: 5 00:03:35 -303.018245 1.924243
BFGS: 6 00:03:35 -303.100381 1.900679
BFGS: 7 00:03:36 -303.124887 0.541060
BFGS: 8 00:03:36 -303.132852 0.345652
BFGS: 9 00:03:36 -303.150522 0.685270
BFGS: 10 00:03:36 -303.162680 0.627126
BFGS: 11 00:03:36 -303.169836 0.309662
BFGS: 12 00:03:36 -303.171966 0.166831
BFGS: 13 00:03:37 -303.175042 0.387364
BFGS: 14 00:03:37 -303.179830 0.565371
BFGS: 15 00:03:37 -303.185953 0.573414
BFGS: 16 00:03:37 -303.190635 0.365158
BFGS: 17 00:03:37 -303.193095 0.142659
BFGS: 18 00:03:37 -303.194547 0.184684
BFGS: 19 00:03:37 -303.196487 0.268650
BFGS: 20 00:03:37 -303.199368 0.312020
Step Time Energy fmax
BFGS: 0 00:03:37 -300.935328 4.122166
BFGS: 1 00:03:38 -301.352607 3.332456
BFGS: 2 00:03:38 -302.520556 3.499997
BFGS: 3 00:03:38 -302.478764 6.834756
BFGS: 4 00:03:38 -302.860033 2.719137
BFGS: 5 00:03:38 -303.028196 1.151951
BFGS: 6 00:03:38 -303.080889 1.455469
BFGS: 7 00:03:39 -303.105192 0.752728
BFGS: 8 00:03:39 -303.140111 1.042723
BFGS: 9 00:03:39 -303.166893 0.978585
BFGS: 10 00:03:39 -303.189008 0.534297
BFGS: 11 00:03:39 -303.194611 0.236970
BFGS: 12 00:03:40 -303.197481 0.282401
BFGS: 13 00:03:40 -303.201290 0.470472
BFGS: 14 00:03:40 -303.205958 0.480718
BFGS: 15 00:03:40 -303.209062 0.314141
BFGS: 16 00:03:41 -303.211064 0.199033
BFGS: 17 00:03:41 -303.213811 0.297900
BFGS: 18 00:03:41 -303.219780 0.593367
BFGS: 19 00:03:41 -303.237209 1.072592
BFGS: 20 00:03:41 -303.277842 1.679748
Step Time Energy fmax
BFGS: 0 00:03:41 -302.065775 4.178858
BFGS: 1 00:03:41 -302.447355 3.194271
BFGS: 2 00:03:42 -303.346152 3.229507
BFGS: 3 00:03:42 -303.521693 3.016576
BFGS: 4 00:03:42 -303.798779 1.833258
BFGS: 5 00:03:42 -303.936334 2.231157
BFGS: 6 00:03:43 -304.003557 1.262122
BFGS: 7 00:03:43 -304.129775 0.803140
BFGS: 8 00:03:43 -304.174302 0.952905
BFGS: 9 00:03:43 -304.227971 0.823894
BFGS: 10 00:03:43 -304.292716 0.714908
BFGS: 11 00:03:43 -304.335652 0.812202
BFGS: 12 00:03:43 -304.363669 0.965864
BFGS: 13 00:03:44 -304.421080 1.289955
BFGS: 14 00:03:44 -304.451536 1.444583
BFGS: 15 00:03:44 -304.515537 0.938558
BFGS: 16 00:03:44 -304.547550 0.670842
BFGS: 17 00:03:44 -304.581159 0.583708
BFGS: 18 00:03:44 -304.590841 0.436103
BFGS: 19 00:03:44 -304.611925 0.506452
BFGS: 20 00:03:44 -304.625196 0.409774
Step Time Energy fmax
BFGS: 0 00:03:44 -302.141639 4.126196
BFGS: 1 00:03:45 -302.523631 3.078103
BFGS: 2 00:03:45 -303.396379 3.235598
BFGS: 3 00:03:45 -303.554997 2.901903
BFGS: 4 00:03:45 -303.861440 1.667021
BFGS: 5 00:03:45 -303.921612 1.198622
BFGS: 6 00:03:45 -304.098550 0.740782
BFGS: 7 00:03:45 -304.138743 0.882667
BFGS: 8 00:03:46 -304.212265 1.031636
BFGS: 9 00:03:46 -304.334604 1.146741
BFGS: 10 00:03:46 -304.409364 1.029292
BFGS: 11 00:03:46 -304.457877 1.173350
BFGS: 12 00:03:46 -304.505999 1.122535
BFGS: 13 00:03:47 -304.567166 0.600007
BFGS: 14 00:03:47 -304.584743 0.454147
BFGS: 15 00:03:47 -304.598544 0.346684
BFGS: 16 00:03:48 -304.607125 0.348002
BFGS: 17 00:03:48 -304.617596 0.441305
BFGS: 18 00:03:48 -304.631398 0.390991
BFGS: 19 00:03:48 -304.641981 0.296350
BFGS: 20 00:03:48 -304.648510 0.256045
Step Time Energy fmax
BFGS: 0 00:03:49 -301.243525 4.004726
BFGS: 1 00:03:49 -301.633661 3.011067
BFGS: 2 00:03:49 -302.697066 3.529742
BFGS: 3 00:03:49 -302.820233 3.787548
BFGS: 4 00:03:50 -303.107663 1.933485
BFGS: 5 00:03:50 -303.169609 2.296653
BFGS: 6 00:03:50 -303.218648 0.796752
BFGS: 7 00:03:50 -303.250329 0.679354
BFGS: 8 00:03:51 -303.510579 1.393784
BFGS: 9 00:03:51 -303.664848 1.851881
BFGS: 10 00:03:51 -303.800371 1.810295
BFGS: 11 00:03:51 -304.011105 1.634163
BFGS: 12 00:03:52 -304.147342 1.358219
BFGS: 13 00:03:52 -304.234829 0.890261
BFGS: 14 00:03:52 -304.326757 0.799160
BFGS: 15 00:03:52 -304.360975 0.891445
BFGS: 16 00:03:52 -304.420630 0.960318
BFGS: 17 00:03:52 -304.463246 0.770603
BFGS: 18 00:03:53 -304.543785 0.546999
BFGS: 19 00:03:53 -304.560114 0.345508
BFGS: 20 00:03:53 -304.573164 0.293004
Step Time Energy fmax
BFGS: 0 00:03:53 -300.639632 4.045076
BFGS: 1 00:03:54 -301.080519 3.635576
BFGS: 2 00:03:54 -302.382873 3.494492
BFGS: 3 00:03:54 -301.909525 11.212434
BFGS: 4 00:03:55 -302.631224 3.222989
BFGS: 5 00:03:55 -302.766791 2.797273
BFGS: 6 00:03:55 -302.979602 2.518485
BFGS: 7 00:03:55 -303.063389 0.944703
BFGS: 8 00:03:56 -303.083681 0.782028
BFGS: 9 00:03:56 -303.152609 0.315220
BFGS: 10 00:03:56 -303.167588 0.219507
BFGS: 11 00:03:56 -303.169436 0.188186
BFGS: 12 00:03:57 -303.172410 0.191214
BFGS: 13 00:03:57 -303.174864 0.155569
BFGS: 14 00:03:57 -303.176338 0.074626
BFGS: 15 00:03:57 -303.176903 0.057912
BFGS: 16 00:03:58 -303.177266 0.106214
BFGS: 17 00:03:58 -303.177719 0.129952
BFGS: 18 00:03:58 -303.178240 0.109788
BFGS: 19 00:03:58 -303.178617 0.055155
BFGS: 20 00:03:59 -303.178793 0.041737
Step Time Energy fmax
BFGS: 0 00:03:59 -300.862278 4.081775
BFGS: 1 00:03:59 -301.284945 3.405011
BFGS: 2 00:03:59 -302.498662 3.470789
BFGS: 3 00:03:59 -302.355690 8.069346
BFGS: 4 00:03:59 -302.815307 2.830963
BFGS: 5 00:04:00 -302.976179 1.747571
BFGS: 6 00:04:00 -303.067856 1.932078
BFGS: 7 00:04:00 -303.098020 0.762318
BFGS: 8 00:04:00 -303.121084 0.636035
BFGS: 9 00:04:00 -303.154442 1.000485
BFGS: 10 00:04:00 -303.172931 0.778150
BFGS: 11 00:04:01 -303.183341 0.311024
BFGS: 12 00:04:01 -303.185953 0.185873
BFGS: 13 00:04:01 -303.188407 0.342731
BFGS: 14 00:04:01 -303.192527 0.416266
BFGS: 15 00:04:01 -303.195523 0.305788
BFGS: 16 00:04:02 -303.197273 0.170288
BFGS: 17 00:04:02 -303.198623 0.154503
BFGS: 18 00:04:02 -303.200613 0.223539
BFGS: 19 00:04:02 -303.204135 0.331850
BFGS: 20 00:04:03 -303.208895 0.339668
# Relax the product systems
product1_energies = []
for config in product1_configs:
config.calc = calc
config.pbc = True
opt = BFGS(config)
opt.run(fmax=0.05, steps=optimization_steps)
product1_energies.append(config.get_potential_energy())WARNING:root:The UMA fast path (merge_mole + compile) is only available for fixed composition, task, charge, and spin. This is optimized for MD applications. Falling back to a less optimized version for subsequent evaluations. Reason: 'Compositions differ from merged model'.
Use inference_settings='batch' for heterogeneous batched evaluations.
Step Time Energy fmax
BFGS: 0 00:04:08 -297.797491 4.381828
BFGS: 1 00:04:08 -298.251289 4.380583
BFGS: 2 00:04:09 -299.364335 2.689327
BFGS: 3 00:04:09 -299.377217 3.843793
BFGS: 4 00:04:09 -299.642460 1.121117
BFGS: 5 00:04:09 -299.716151 0.966666
BFGS: 6 00:04:10 -299.958188 0.606962
BFGS: 7 00:04:10 -299.978305 0.492163
BFGS: 8 00:04:10 -300.013614 0.321712
BFGS: 9 00:04:11 -300.030693 0.210047
BFGS: 10 00:04:11 -300.037176 0.151322
BFGS: 11 00:04:11 -300.038540 0.109033
BFGS: 12 00:04:11 -300.039283 0.076867
BFGS: 13 00:04:12 -300.040378 0.100015
BFGS: 14 00:04:12 -300.041404 0.115252
BFGS: 15 00:04:12 -300.042161 0.108938
BFGS: 16 00:04:12 -300.042672 0.084970
BFGS: 17 00:04:12 -300.043114 0.052844
BFGS: 18 00:04:13 -300.043484 0.026954
Step Time Energy fmax
BFGS: 0 00:04:13 -297.189180 4.387400
BFGS: 1 00:04:13 -297.638718 4.518504
BFGS: 2 00:04:13 -298.897139 3.401651
BFGS: 3 00:04:14 -299.007544 5.623032
BFGS: 4 00:04:14 -299.295713 1.756533
BFGS: 5 00:04:14 -299.397600 1.548342
BFGS: 6 00:04:14 -299.656439 1.551594
BFGS: 7 00:04:15 -299.695916 1.064419
BFGS: 8 00:04:15 -299.773396 1.150462
BFGS: 9 00:04:15 -299.821459 1.338336
BFGS: 10 00:04:16 -299.900366 1.207924
BFGS: 11 00:04:16 -299.945897 0.758632
BFGS: 12 00:04:16 -299.977011 0.504314
BFGS: 13 00:04:16 -299.985805 0.470049
BFGS: 14 00:04:17 -300.003415 0.401151
BFGS: 15 00:04:17 -300.021146 0.392087
BFGS: 16 00:04:17 -300.031267 0.268986
BFGS: 17 00:04:18 -300.033639 0.210431
BFGS: 18 00:04:18 -300.035949 0.165999
BFGS: 19 00:04:18 -300.038690 0.173881
BFGS: 20 00:04:18 -300.040642 0.157459
Step Time Energy fmax
BFGS: 0 00:04:19 -296.711396 4.412020
BFGS: 1 00:04:19 -297.167253 4.605265
BFGS: 2 00:04:19 -298.494888 3.565385
BFGS: 3 00:04:19 -298.533698 6.800625
BFGS: 4 00:04:19 -298.885849 1.994609
BFGS: 5 00:04:20 -298.991262 1.742137
BFGS: 6 00:04:20 -299.373668 2.240374
BFGS: 7 00:04:20 -299.593609 2.327952
BFGS: 8 00:04:20 -299.679824 1.641487
BFGS: 9 00:04:21 -299.839969 0.993417
BFGS: 10 00:04:21 -299.887109 1.082478
BFGS: 11 00:04:21 -299.934426 1.140138
BFGS: 12 00:04:21 -300.031925 1.242851
BFGS: 13 00:04:21 -300.113305 1.335008
BFGS: 14 00:04:22 -300.195445 1.427098
BFGS: 15 00:04:22 -300.305173 1.523063
BFGS: 16 00:04:22 -300.430229 1.146451
BFGS: 17 00:04:22 -300.462635 0.894417
BFGS: 18 00:04:23 -300.489198 0.585504
BFGS: 19 00:04:23 -300.508143 0.517337
BFGS: 20 00:04:23 -300.537102 0.368088
Step Time Energy fmax
BFGS: 0 00:04:23 -297.029174 4.454740
BFGS: 1 00:04:23 -297.489368 4.604367
BFGS: 2 00:04:24 -298.745695 3.693859
BFGS: 3 00:04:24 -299.107496 4.164690
BFGS: 4 00:04:24 -299.283737 1.724168
BFGS: 5 00:04:24 -299.438186 1.659343
BFGS: 6 00:04:25 -299.713706 1.093186
BFGS: 7 00:04:25 -299.738666 0.676277
BFGS: 8 00:04:25 -299.798675 0.730760
BFGS: 9 00:04:25 -299.826313 0.631192
BFGS: 10 00:04:26 -299.860937 0.396833
BFGS: 11 00:04:26 -299.873572 0.312106
BFGS: 12 00:04:26 -299.880787 0.358915
BFGS: 13 00:04:26 -299.888649 0.401353
BFGS: 14 00:04:26 -299.899368 0.468012
BFGS: 15 00:04:27 -299.913408 0.646463
BFGS: 16 00:04:27 -299.944886 1.078598
BFGS: 17 00:04:27 -299.981261 1.549678
BFGS: 18 00:04:27 -300.040684 1.530737
BFGS: 19 00:04:27 -300.197775 1.343047
BFGS: 20 00:04:28 -300.342249 0.851047
Step Time Energy fmax
BFGS: 0 00:04:28 -296.663642 4.358418
BFGS: 1 00:04:28 -297.117476 4.556413
BFGS: 2 00:04:28 -298.456416 3.404041
BFGS: 3 00:04:29 -298.298627 8.025704
BFGS: 4 00:04:29 -298.774448 1.943764
BFGS: 5 00:04:29 -298.862576 1.522256
BFGS: 6 00:04:29 -299.096321 2.508253
BFGS: 7 00:04:30 -299.356537 2.879217
BFGS: 8 00:04:30 -299.457569 2.096665
BFGS: 9 00:04:30 -299.584616 1.533595
BFGS: 10 00:04:30 -299.707399 0.831031
BFGS: 11 00:04:30 -299.786729 0.837064
BFGS: 12 00:04:30 -299.820237 0.821021
BFGS: 13 00:04:31 -299.843521 0.613822
BFGS: 14 00:04:31 -299.864610 0.406204
BFGS: 15 00:04:31 -299.875778 0.418391
BFGS: 16 00:04:31 -299.888231 0.400839
BFGS: 17 00:04:31 -299.900028 0.429265
BFGS: 18 00:04:32 -299.906807 0.362120
BFGS: 19 00:04:32 -299.912347 0.331338
BFGS: 20 00:04:32 -299.923665 0.492020
Step Time Energy fmax
BFGS: 0 00:04:32 -297.294874 4.666021
BFGS: 1 00:04:32 -297.750674 4.802613
BFGS: 2 00:04:32 -298.988834 4.005570
BFGS: 3 00:04:33 -299.474196 3.704423
BFGS: 4 00:04:33 -299.649205 2.197062
BFGS: 5 00:04:33 -300.076511 1.728870
BFGS: 6 00:04:33 -300.163226 1.531294
BFGS: 7 00:04:34 -300.221696 1.245694
BFGS: 8 00:04:34 -300.399880 1.712446
BFGS: 9 00:04:34 -300.448110 0.925886
BFGS: 10 00:04:34 -300.471154 0.817154
BFGS: 11 00:04:35 -300.557426 0.386677
BFGS: 12 00:04:35 -300.564339 0.302347
BFGS: 13 00:04:35 -300.569013 0.188888
BFGS: 14 00:04:35 -300.571568 0.126873
BFGS: 15 00:04:36 -300.574226 0.121465
BFGS: 16 00:04:36 -300.576037 0.128312
BFGS: 17 00:04:36 -300.577210 0.090041
BFGS: 18 00:04:36 -300.577770 0.055781
BFGS: 19 00:04:36 -300.578009 0.036696
Step Time Energy fmax
BFGS: 0 00:04:36 -297.011909 4.532709
BFGS: 1 00:04:36 -297.456364 4.701411
BFGS: 2 00:04:37 -298.701069 3.923945
BFGS: 3 00:04:37 -299.118875 4.169757
BFGS: 4 00:04:37 -299.309041 2.085939
BFGS: 5 00:04:37 -299.604616 2.428635
BFGS: 6 00:04:37 -300.102314 2.293060
BFGS: 7 00:04:38 -300.277325 1.528138
BFGS: 8 00:04:38 -300.346119 1.270933
BFGS: 9 00:04:38 -300.519916 0.598646
BFGS: 10 00:04:38 -300.548143 0.337043
BFGS: 11 00:04:39 -300.554690 0.385070
BFGS: 12 00:04:39 -300.562927 0.302580
BFGS: 13 00:04:39 -300.568463 0.159839
BFGS: 14 00:04:39 -300.571518 0.132818
BFGS: 15 00:04:40 -300.573076 0.101189
BFGS: 16 00:04:40 -300.574085 0.123476
BFGS: 17 00:04:40 -300.575261 0.129304
BFGS: 18 00:04:40 -300.576422 0.100107
BFGS: 19 00:04:40 -300.577114 0.058872
BFGS: 20 00:04:41 -300.577449 0.066584
Step Time Energy fmax
BFGS: 0 00:04:41 -296.162569 4.403296
BFGS: 1 00:04:41 -296.680771 4.686411
BFGS: 2 00:04:41 -298.245891 2.961645
BFGS: 3 00:04:41 -297.069574 15.099770
BFGS: 4 00:04:41 -298.423093 1.799002
BFGS: 5 00:04:41 -298.484045 1.022488
BFGS: 6 00:04:42 -298.522700 0.744900
BFGS: 7 00:04:42 -298.529875 0.526470
BFGS: 8 00:04:42 -298.548384 0.387204
BFGS: 9 00:04:42 -298.552023 0.419391
BFGS: 10 00:04:42 -298.560710 0.459065
BFGS: 11 00:04:42 -298.587041 0.673288
BFGS: 12 00:04:43 -298.646759 1.331234
BFGS: 13 00:04:43 -298.669400 2.208290
BFGS: 14 00:04:43 -298.771445 1.246951
BFGS: 15 00:04:43 -298.833904 1.443450
BFGS: 16 00:04:44 -299.039806 2.376866
BFGS: 17 00:04:44 -299.225538 2.652489
BFGS: 18 00:04:44 -299.281502 3.026416
BFGS: 19 00:04:44 -299.489458 2.588529
BFGS: 20 00:04:45 -299.592038 2.402267
Step Time Energy fmax
BFGS: 0 00:04:45 -297.345727 4.696989
BFGS: 1 00:04:45 -297.802803 4.829844
BFGS: 2 00:04:45 -299.032301 4.062646
BFGS: 3 00:04:45 -299.565132 3.414471
BFGS: 4 00:04:46 -299.747332 2.435325
BFGS: 5 00:04:46 -300.227127 1.076484
BFGS: 6 00:04:46 -300.296226 1.085856
BFGS: 7 00:04:46 -300.356174 0.828356
BFGS: 8 00:04:47 -300.468736 1.088214
BFGS: 9 00:04:47 -300.504277 0.937755
BFGS: 10 00:04:47 -300.556275 0.442822
BFGS: 11 00:04:47 -300.568101 0.178497
BFGS: 12 00:04:48 -300.570377 0.170693
BFGS: 13 00:04:48 -300.573682 0.177862
BFGS: 14 00:04:48 -300.576375 0.137029
BFGS: 15 00:04:48 -300.577444 0.062357
BFGS: 16 00:04:48 -300.577713 0.038646
Step Time Energy fmax
BFGS: 0 00:04:48 -296.861717 4.467019
BFGS: 1 00:04:49 -297.303864 4.651129
BFGS: 2 00:04:49 -298.575673 3.783420
BFGS: 3 00:04:49 -298.837104 5.252242
BFGS: 4 00:04:49 -299.068797 2.037168
BFGS: 5 00:04:49 -299.211558 2.069394
BFGS: 6 00:04:50 -299.742673 2.287121
BFGS: 7 00:04:50 -300.142252 1.806710
BFGS: 8 00:04:50 -300.255881 1.402446
BFGS: 9 00:04:50 -300.335295 1.202630
BFGS: 10 00:04:51 -300.461169 0.880269
BFGS: 11 00:04:51 -300.530352 0.539795
BFGS: 12 00:04:51 -300.544870 0.377173
BFGS: 13 00:04:51 -300.552785 0.287472
BFGS: 14 00:04:52 -300.562378 0.211339
BFGS: 15 00:04:52 -300.568651 0.148813
BFGS: 16 00:04:52 -300.571268 0.128061
BFGS: 17 00:04:52 -300.572717 0.127169
BFGS: 18 00:04:52 -300.574009 0.126517
BFGS: 19 00:04:52 -300.575385 0.105157
BFGS: 20 00:04:52 -300.576341 0.064618
product2_energies = []
for config in product2_configs:
config.calc = calc
config.pbc = True
opt = BFGS(config)
opt.run(fmax=0.05, steps=optimization_steps)
product2_energies.append(config.get_potential_energy()) Step Time Energy fmax
BFGS: 0 00:04:53 -295.613445 0.739571
BFGS: 1 00:04:53 -295.663517 0.655864
BFGS: 2 00:04:53 -295.842097 0.328929
BFGS: 3 00:04:53 -295.853019 0.373645
BFGS: 4 00:04:53 -295.857328 0.370418
BFGS: 5 00:04:54 -295.883368 0.281694
BFGS: 6 00:04:54 -295.886589 0.256399
BFGS: 7 00:04:54 -295.897302 0.217681
BFGS: 8 00:04:54 -295.901045 0.259936
BFGS: 9 00:04:55 -295.904779 0.286603
BFGS: 10 00:04:55 -295.907854 0.279760
BFGS: 11 00:04:55 -295.913070 0.235098
BFGS: 12 00:04:55 -295.917676 0.166029
BFGS: 13 00:04:55 -295.921351 0.200905
BFGS: 14 00:04:55 -295.923498 0.213433
BFGS: 15 00:04:56 -295.925882 0.191878
BFGS: 16 00:04:56 -295.928940 0.126388
BFGS: 17 00:04:56 -295.931197 0.080612
BFGS: 18 00:04:56 -295.932024 0.048324
Step Time Energy fmax
BFGS: 0 00:04:56 -295.464888 1.014396
BFGS: 1 00:04:56 -295.527507 0.938571
BFGS: 2 00:04:57 -295.739060 0.843361
BFGS: 3 00:04:57 -295.756223 0.510999
BFGS: 4 00:04:57 -295.767269 0.474379
BFGS: 5 00:04:57 -295.800452 0.497124
BFGS: 6 00:04:58 -295.808909 0.435671
BFGS: 7 00:04:58 -295.821847 0.383939
BFGS: 8 00:04:58 -295.830526 0.248340
BFGS: 9 00:04:58 -295.836679 0.155170
BFGS: 10 00:04:59 -295.838581 0.142722
BFGS: 11 00:04:59 -295.839535 0.111188
BFGS: 12 00:04:59 -295.840713 0.081728
BFGS: 13 00:05:00 -295.841866 0.058590
BFGS: 14 00:05:00 -295.842495 0.058451
BFGS: 15 00:05:00 -295.842734 0.054001
BFGS: 16 00:05:00 -295.842928 0.050702
BFGS: 17 00:05:01 -295.843243 0.051230
BFGS: 18 00:05:01 -295.843633 0.050444
BFGS: 19 00:05:01 -295.843950 0.052401
BFGS: 20 00:05:01 -295.844140 0.057793
Step Time Energy fmax
BFGS: 0 00:05:01 -295.536461 0.947601
BFGS: 1 00:05:02 -295.592465 0.892686
BFGS: 2 00:05:02 -295.803954 0.621894
BFGS: 3 00:05:02 -295.819388 0.529031
BFGS: 4 00:05:02 -295.830633 0.542882
BFGS: 5 00:05:03 -295.879625 0.540371
BFGS: 6 00:05:03 -295.895944 0.620660
BFGS: 7 00:05:03 -295.917120 0.648380
BFGS: 8 00:05:03 -295.933397 0.426140
BFGS: 9 00:05:04 -295.944872 0.282378
BFGS: 10 00:05:04 -295.950393 0.273762
BFGS: 11 00:05:04 -295.953450 0.242478
BFGS: 12 00:05:04 -295.956407 0.196394
BFGS: 13 00:05:04 -295.959876 0.136007
BFGS: 14 00:05:05 -295.962336 0.121566
BFGS: 15 00:05:05 -295.963535 0.119946
BFGS: 16 00:05:05 -295.964344 0.099525
BFGS: 17 00:05:05 -295.965335 0.067641
BFGS: 18 00:05:05 -295.966265 0.043735
Step Time Energy fmax
BFGS: 0 00:05:05 -295.157940 1.562816
BFGS: 1 00:05:06 -295.256544 1.414109
BFGS: 2 00:05:06 -295.450851 2.108408
BFGS: 3 00:05:06 -295.519486 0.498213
BFGS: 4 00:05:06 -295.532987 0.586306
BFGS: 5 00:05:07 -295.558451 0.525178
BFGS: 6 00:05:07 -295.567636 0.277757
BFGS: 7 00:05:07 -295.573153 0.275606
BFGS: 8 00:05:07 -295.577749 0.305021
BFGS: 9 00:05:07 -295.583253 0.262425
BFGS: 10 00:05:08 -295.586925 0.185398
BFGS: 11 00:05:08 -295.588434 0.149917
BFGS: 12 00:05:08 -295.589190 0.176962
BFGS: 13 00:05:08 -295.590994 0.243004
BFGS: 14 00:05:09 -295.596100 0.381148
BFGS: 15 00:05:09 -295.625593 0.672167
BFGS: 16 00:05:09 -295.696776 0.679706
BFGS: 17 00:05:09 -295.777293 0.539362
BFGS: 18 00:05:10 -295.805716 0.897625
BFGS: 19 00:05:10 -295.831898 0.616930
BFGS: 20 00:05:10 -295.875767 0.330623
Step Time Energy fmax
BFGS: 0 00:05:10 -295.351458 1.219373
BFGS: 1 00:05:10 -295.422629 1.116152
BFGS: 2 00:05:11 -295.634669 1.191229
BFGS: 3 00:05:11 -295.660039 0.595737
BFGS: 4 00:05:11 -295.671642 0.454456
BFGS: 5 00:05:11 -295.710446 0.549301
BFGS: 6 00:05:11 -295.717985 0.531895
BFGS: 7 00:05:11 -295.782908 0.574168
BFGS: 8 00:05:12 -295.819583 0.734712
BFGS: 9 00:05:12 -295.840560 0.710913
BFGS: 10 00:05:12 -295.866702 0.606229
BFGS: 11 00:05:12 -295.887382 0.440397
BFGS: 12 00:05:13 -295.906082 0.255005
BFGS: 13 00:05:13 -295.914578 0.306108
BFGS: 14 00:05:13 -295.917708 0.299553
BFGS: 15 00:05:13 -295.920313 0.260741
BFGS: 16 00:05:13 -295.924923 0.170483
BFGS: 17 00:05:14 -295.929224 0.083247
BFGS: 18 00:05:14 -295.931099 0.057254
BFGS: 19 00:05:14 -295.931654 0.049687
Step Time Energy fmax
BFGS: 0 00:05:14 -295.180757 1.513492
BFGS: 1 00:05:14 -295.275245 1.370447
BFGS: 2 00:05:15 -295.474623 1.968090
BFGS: 3 00:05:15 -295.535168 0.520382
BFGS: 4 00:05:15 -295.547813 0.576925
BFGS: 5 00:05:15 -295.574907 0.439160
BFGS: 6 00:05:15 -295.582369 0.250078
BFGS: 7 00:05:16 -295.587959 0.308146
BFGS: 8 00:05:16 -295.593622 0.323541
BFGS: 9 00:05:16 -295.600142 0.294584
BFGS: 10 00:05:16 -295.604705 0.212052
BFGS: 11 00:05:17 -295.607067 0.247445
BFGS: 12 00:05:17 -295.609342 0.317777
BFGS: 13 00:05:17 -295.617598 0.528883
BFGS: 14 00:05:17 -295.658552 0.994977
BFGS: 15 00:05:17 -295.736850 0.915673
BFGS: 16 00:05:18 -295.745377 1.075273
BFGS: 17 00:05:18 -295.776923 0.670069
BFGS: 18 00:05:18 -295.793166 0.552313
BFGS: 19 00:05:18 -295.832727 0.358157
BFGS: 20 00:05:19 -295.837790 0.400079
Step Time Energy fmax
BFGS: 0 00:05:19 -295.129031 1.627282
BFGS: 1 00:05:19 -295.233671 1.470927
BFGS: 2 00:05:19 -295.423035 2.288690
BFGS: 3 00:05:19 -295.501999 0.479589
BFGS: 4 00:05:19 -295.516863 0.600971
BFGS: 5 00:05:19 -295.541901 0.602998
BFGS: 6 00:05:20 -295.553227 0.357643
BFGS: 7 00:05:20 -295.559473 0.255843
BFGS: 8 00:05:20 -295.563711 0.297899
BFGS: 9 00:05:20 -295.569007 0.270007
BFGS: 10 00:05:20 -295.572434 0.174043
BFGS: 11 00:05:20 -295.573668 0.085293
BFGS: 12 00:05:21 -295.573950 0.090636
BFGS: 13 00:05:21 -295.574267 0.105145
BFGS: 14 00:05:21 -295.574991 0.132828
BFGS: 15 00:05:21 -295.576637 0.173493
BFGS: 16 00:05:22 -295.580471 0.217652
BFGS: 17 00:05:22 -295.590460 0.373320
BFGS: 18 00:05:22 -295.602904 0.647909
BFGS: 19 00:05:22 -295.600645 1.000056
BFGS: 20 00:05:23 -295.613127 0.748114
Step Time Energy fmax
BFGS: 0 00:05:23 -295.696116 0.722671
BFGS: 1 00:05:23 -295.742799 0.644296
BFGS: 2 00:05:23 -295.898970 0.313587
BFGS: 3 00:05:23 -295.907041 0.283888
BFGS: 4 00:05:23 -295.908462 0.270336
BFGS: 5 00:05:23 -295.919613 0.170794
BFGS: 6 00:05:23 -295.920894 0.153425
BFGS: 7 00:05:23 -295.928000 0.096177
BFGS: 8 00:05:23 -295.928526 0.089176
BFGS: 9 00:05:23 -295.930013 0.084764
BFGS: 10 00:05:23 -295.930857 0.066633
BFGS: 11 00:05:23 -295.931309 0.054007
BFGS: 12 00:05:23 -295.931554 0.059781
BFGS: 13 00:05:24 -295.931887 0.062667
BFGS: 14 00:05:24 -295.932357 0.054193
BFGS: 15 00:05:24 -295.932777 0.035566
Step Time Energy fmax
BFGS: 0 00:05:24 -295.260844 1.364725
BFGS: 1 00:05:24 -295.343218 1.241260
BFGS: 2 00:05:24 -295.554958 1.569014
BFGS: 3 00:05:24 -295.595462 0.579936
BFGS: 4 00:05:24 -295.606663 0.535124
BFGS: 5 00:05:24 -295.640201 0.403631
BFGS: 6 00:05:24 -295.645042 0.411880
BFGS: 7 00:05:24 -295.675287 0.567011
BFGS: 8 00:05:24 -295.689756 0.556328
BFGS: 9 00:05:24 -295.713053 0.719591
BFGS: 10 00:05:24 -295.732799 0.908808
BFGS: 11 00:05:24 -295.755796 0.994693
BFGS: 12 00:05:24 -295.794621 0.831831
BFGS: 13 00:05:25 -295.827668 0.547829
BFGS: 14 00:05:25 -295.847918 0.245176
BFGS: 15 00:05:25 -295.851811 0.247990
BFGS: 16 00:05:25 -295.855470 0.285860
BFGS: 17 00:05:25 -295.859462 0.269887
BFGS: 18 00:05:25 -295.863702 0.183241
BFGS: 19 00:05:25 -295.866710 0.188456
BFGS: 20 00:05:25 -295.868764 0.181455
Step Time Energy fmax
BFGS: 0 00:05:25 -295.142939 1.592844
BFGS: 1 00:05:25 -295.244639 1.440866
BFGS: 2 00:05:25 -295.436598 2.207835
BFGS: 3 00:05:25 -295.510957 0.488757
BFGS: 4 00:05:25 -295.525193 0.594647
BFGS: 5 00:05:25 -295.550285 0.568638
BFGS: 6 00:05:25 -295.560608 0.320396
BFGS: 7 00:05:25 -295.566440 0.263690
BFGS: 8 00:05:26 -295.570807 0.300276
BFGS: 9 00:05:26 -295.576107 0.266144
BFGS: 10 00:05:26 -295.579615 0.178969
BFGS: 11 00:05:26 -295.580957 0.116648
BFGS: 12 00:05:26 -295.581413 0.131805
BFGS: 13 00:05:26 -295.582218 0.165566
BFGS: 14 00:05:26 -295.584184 0.231772
BFGS: 15 00:05:26 -295.590644 0.367148
BFGS: 16 00:05:26 -295.613358 0.527216
BFGS: 17 00:05:26 -295.677955 0.722013
BFGS: 18 00:05:26 -295.743570 0.577828
BFGS: 19 00:05:26 -295.719415 1.115986
BFGS: 20 00:05:26 -295.778408 0.482968
Enumerate NEBs¶

af = AutoFrameDissociation(
reaction=reaction,
reactant_system=reactant_configs[reactant_energies.index(min(reactant_energies))],
product1_systems=product1_configs,
product1_energies=product1_energies,
product2_systems=product2_configs,
product2_energies=product2_energies,
r_product1_max=2, # r1 in the above fig
r_product2_max=3, # r3 in the above fig
r_product2_min=1, # r2 in the above fig
)import random
nframes = 10
random.seed(
42
) # set the seed to make the random generation deterministic for the tutorial!
frame_sets, mapping_idxs = af.get_neb_frames(
calc,
n_frames=nframes,
n_pdt1_sites=4, # = 5 in the above fig (step 1)
n_pdt2_sites=4, # = 5 in the above fig (step 2)
) Step Time Energy fmax
BFGS: 0 00:05:27 -303.900999 0.345066
BFGS: 1 00:05:27 -303.906888 0.268250
BFGS: 2 00:05:27 -303.920483 0.156595
BFGS: 3 00:05:27 -303.922974 0.132527
BFGS: 4 00:05:27 -303.924801 0.113300
BFGS: 5 00:05:27 -303.926058 0.104145
BFGS: 6 00:05:27 -303.927128 0.077684
BFGS: 7 00:05:27 -303.927702 0.067666
BFGS: 8 00:05:27 -303.927975 0.050843
BFGS: 9 00:05:27 -303.928150 0.035664
Step Time Energy fmax
BFGS: 0 00:05:27 -303.122315 1.036444
BFGS: 1 00:05:27 -303.152672 0.793146
BFGS: 2 00:05:27 -303.221005 0.668980
BFGS: 3 00:05:27 -303.251064 0.666776
BFGS: 4 00:05:28 -303.283622 0.711430
BFGS: 5 00:05:28 -303.312499 0.569737
BFGS: 6 00:05:28 -303.354825 0.520967
BFGS: 7 00:05:28 -303.365746 0.322041
BFGS: 8 00:05:28 -303.370199 0.200399
BFGS: 9 00:05:28 -303.377603 0.183587
BFGS: 10 00:05:28 -303.380605 0.172058
BFGS: 11 00:05:28 -303.383148 0.199278
BFGS: 12 00:05:28 -303.385521 0.167953
BFGS: 13 00:05:28 -303.387821 0.150694
BFGS: 14 00:05:28 -303.390110 0.178506
BFGS: 15 00:05:28 -303.392029 0.158763
BFGS: 16 00:05:28 -303.393891 0.144912
BFGS: 17 00:05:28 -303.396634 0.147455
BFGS: 18 00:05:28 -303.400214 0.217108
BFGS: 19 00:05:28 -303.404122 0.265729
BFGS: 20 00:05:29 -303.408130 0.238989
BFGS: 21 00:05:29 -303.412911 0.291447
BFGS: 22 00:05:29 -303.420174 0.397934
BFGS: 23 00:05:29 -303.434928 0.711455
BFGS: 24 00:05:29 -303.460215 0.935310
BFGS: 25 00:05:29 -303.495408 0.918881
BFGS: 26 00:05:29 -303.529905 0.660549
BFGS: 27 00:05:29 -303.562396 0.787378
BFGS: 28 00:05:29 -303.610340 0.763356
BFGS: 29 00:05:29 -303.661275 0.785048
BFGS: 30 00:05:29 -303.733131 0.754076
BFGS: 31 00:05:29 -303.802195 0.695844
BFGS: 32 00:05:29 -303.841634 0.412512
BFGS: 33 00:05:29 -303.861986 0.575426
BFGS: 34 00:05:29 -303.886037 0.502686
BFGS: 35 00:05:29 -303.909852 0.263787
BFGS: 36 00:05:30 -303.917330 0.193972
BFGS: 37 00:05:30 -303.920677 0.133223
BFGS: 38 00:05:30 -303.922973 0.101487
BFGS: 39 00:05:30 -303.925205 0.074742
BFGS: 40 00:05:30 -303.926505 0.071341
BFGS: 41 00:05:30 -303.927189 0.059033
BFGS: 42 00:05:30 -303.927553 0.046867
/home/runner/work/_tool/Python/3.12.14/x64/lib/python3.12/site-packages/fairchem/applications/cattsunami/core/autoframe.py:1551: UserWarning: torch.range is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin. Instead, use torch.arange, which produces values in [start, end).
alpha = torch.range(0, num_frames - 1, device=device) / (num_frames - 1)
Run NEBs¶
## This will run all NEBs enumerated - to just run one, run the code cell below.
# On GPU, each NEB takes an average of ~1 minute so this could take around a half hour on GPU
# But much longer on CPU
# Remember that not all NEBs will converge -- the k, nframes would be adjusted to achieve convergence
fmax = 0.05 # [eV / ang**2]
delta_fmax_climb = 0.4
converged_idxs = []
for idx, frame_set in enumerate(frame_sets):
neb = DyNEB(frame_set, k=1)
for image in frame_set:
image.calc = FAIRChemCalculator(predictor, task_name="oc20")
optimizer = BFGS(
neb,
trajectory=f"ch_dissoc_on_Ru_{idx}.traj",
)
conv = optimizer.run(fmax=fmax + delta_fmax_climb, steps=optimization_steps)
if conv:
neb.climb = True
conv = optimizer.run(fmax=fmax, steps=optimization_steps)
if conv:
converged_idxs.append(idx)
print(converged_idxs)This cell will run a shorter calculations for just a single one of the enumerated transition state pathways. You can adapt this code to run transition state searches via nudged elastic band (NEB) calculations for any reaction.
# If you run the above cell -- dont run this one
fmax = 0.05 # [eV / ang**2]
delta_fmax_climb = 0.4
images = frame_sets[0]
neb = DyNEB(images, k=1)
for image in images:
image.calc = FAIRChemCalculator(predictor, task_name="oc20")
optimizer = BFGS(
neb,
trajectory="ch_dissoc_on_Ru_0.traj",
)
conv = optimizer.run(fmax=fmax + delta_fmax_climb, steps=optimization_steps)
if conv:
neb.climb = True
conv = optimizer.run(fmax=fmax, steps=optimization_steps)/home/runner/work/_tool/Python/3.12.14/x64/lib/python3.12/site-packages/ase/mep/neb.py:329: UserWarning: The default method has changed from 'aseneb' to 'improvedtangent'. The 'aseneb' method is an unpublished, custom implementation that is not recommended as it frequently results in very poor bands. Please explicitly set method='improvedtangent' to silence this warning, or set method='aseneb' if you strictly require the old behavior (results may vary). See: https://gitlab.com/ase/ase/-/merge_requests/3952
warnings.warn(
Step Time Energy fmax
BFGS: 0 00:05:36 -301.705859 3.140072
BFGS: 1 00:05:37 -301.925645 2.541880
BFGS: 2 00:05:37 -302.420069 3.957417
BFGS: 3 00:05:38 -302.616761 2.029228
BFGS: 4 00:05:39 -303.141336 2.917841
BFGS: 5 00:05:39 -303.164034 1.724574
BFGS: 6 00:05:40 -303.309682 1.502316
BFGS: 7 00:05:40 -303.448646 2.284023
BFGS: 8 00:05:41 -303.465806 1.602874
BFGS: 9 00:05:42 -303.479015 1.065156
BFGS: 10 00:05:42 -303.519123 1.112335
BFGS: 11 00:05:43 -303.557460 1.395208
BFGS: 12 00:05:44 -303.566641 1.067791
BFGS: 13 00:05:44 -303.576070 0.611604
BFGS: 14 00:05:45 -303.596245 0.747466
BFGS: 15 00:05:45 -303.629604 0.785305
BFGS: 16 00:05:46 -303.657177 1.041858
BFGS: 17 00:05:47 -303.675775 0.785744
BFGS: 18 00:05:47 -303.695566 0.709467
BFGS: 19 00:05:48 -303.721445 0.735786
BFGS: 20 00:05:48 -303.734417 0.597759
Visualize the results¶
Finally, let’s visualize the results!
optimized_neb = read("ch_dissoc_on_Ru_0.traj", ":")[-1 * nframes :]es = []
for frame in optimized_neb:
frame.set_calculator(calc)
es.append(frame.get_potential_energy())/tmp/ipykernel_10195/3247994494.py:3: FutureWarning: Please use atoms.calc = calc
frame.set_calculator(calc)
# Plot the reaction coordinate
es = [e - es[0] for e in es]
plt.plot(es)
plt.xlabel("frame number")
plt.ylabel("relative energy [eV]")
plt.title(f"CH dissociation on Ru(0001), Ea = {max(es):1.2f} eV")
plt.savefig("CH_dissoc_on_Ru_0001.png")
To generalize an interactive visualization, use ase gui from the command line or the X3D package
# Make an interative html file of the optimized neb trajectory
x3d = X3D(optimized_neb)
x3d.write("optimized_neb_ch_disoc_on_Ru0001.html")