| 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.13/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.13/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.13/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.13/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()) Step Time Energy fmax
BFGS: 0 20:14:36 -300.911413 4.090142
BFGS: 1 20:14:36 -301.322479 3.522588
BFGS: 2 20:14:36 -302.485497 3.363681
BFGS: 3 20:14:37 -302.314174 8.157625
BFGS: 4 20:14:37 -302.792069 2.768219
BFGS: 5 20:14:38 -302.938928 1.848867
BFGS: 6 20:14:38 -303.050720 1.991283
BFGS: 7 20:14:38 -303.086796 0.776681
BFGS: 8 20:14:39 -303.118571 0.735333
BFGS: 9 20:14:39 -303.164192 1.168869
BFGS: 10 20:14:40 -303.183440 0.801116
BFGS: 11 20:14:40 -303.198002 0.281198
BFGS: 12 20:14:40 -303.201390 0.240391
BFGS: 13 20:14:41 -303.206404 0.361033
BFGS: 14 20:14:41 -303.210884 0.331574
BFGS: 15 20:14:41 -303.214139 0.252435
BFGS: 16 20:14:41 -303.216376 0.203486
BFGS: 17 20:14:42 -303.218813 0.216473
BFGS: 18 20:14:42 -303.223705 0.321375
BFGS: 19 20:14:42 -303.236837 0.562300
BFGS: 20 20:14:42 -303.266699 1.061714
Step Time Energy fmax
BFGS: 0 20:14:43 -300.732028 3.972632
BFGS: 1 20:14:43 -301.191726 3.853829
BFGS: 2 20:14:43 -302.576535 3.595614
BFGS: 3 20:14:43 -302.385363 8.531092
BFGS: 4 20:14:44 -302.839877 3.158298
BFGS: 5 20:14:44 -302.984572 2.409360
BFGS: 6 20:14:44 -303.093318 2.271442
BFGS: 7 20:14:45 -303.129693 0.533227
BFGS: 8 20:14:45 -303.135413 0.340171
BFGS: 9 20:14:45 -303.144217 0.414926
BFGS: 10 20:14:45 -303.152016 0.531625
BFGS: 11 20:14:46 -303.163009 0.486647
BFGS: 12 20:14:46 -303.167944 0.314510
BFGS: 13 20:14:46 -303.172111 0.201750
BFGS: 14 20:14:46 -303.179916 0.221123
BFGS: 15 20:14:47 -303.188861 0.319266
BFGS: 16 20:14:47 -303.196499 0.270800
BFGS: 17 20:14:47 -303.200207 0.136424
BFGS: 18 20:14:47 -303.201307 0.096030
BFGS: 19 20:14:47 -303.202030 0.106895
BFGS: 20 20:14:48 -303.203801 0.201199
Step Time Energy fmax
BFGS: 0 20:14:48 -300.626741 4.090571
BFGS: 1 20:14:48 -301.105888 3.958318
BFGS: 2 20:14:48 -302.511510 3.681430
BFGS: 3 20:14:49 -302.406862 7.881263
BFGS: 4 20:14:49 -302.816393 3.153387
BFGS: 5 20:14:49 -303.007941 2.009979
BFGS: 6 20:14:50 -303.097828 2.071601
BFGS: 7 20:14:50 -303.126620 0.602607
BFGS: 8 20:14:50 -303.135069 0.382718
BFGS: 9 20:14:50 -303.145900 0.556832
BFGS: 10 20:14:51 -303.157417 0.605685
BFGS: 11 20:14:51 -303.164536 0.352956
BFGS: 12 20:14:51 -303.166193 0.179813
BFGS: 13 20:14:51 -303.167419 0.206364
BFGS: 14 20:14:52 -303.169544 0.333066
BFGS: 15 20:14:52 -303.172382 0.374384
BFGS: 16 20:14:52 -303.175061 0.274410
BFGS: 17 20:14:52 -303.176478 0.115055
BFGS: 18 20:14:53 -303.177024 0.117937
BFGS: 19 20:14:53 -303.177503 0.152426
BFGS: 20 20:14:53 -303.178335 0.179307
Step Time Energy fmax
BFGS: 0 20:14:53 -300.937300 4.053498
BFGS: 1 20:14:53 -301.358365 3.348083
BFGS: 2 20:14:53 -302.560359 3.565572
BFGS: 3 20:14:54 -302.581986 6.051511
BFGS: 4 20:14:54 -302.924721 2.580887
BFGS: 5 20:14:54 -303.083015 1.438980
BFGS: 6 20:14:55 -303.105151 0.804875
BFGS: 7 20:14:55 -303.131621 0.864520
BFGS: 8 20:14:55 -303.148507 0.931543
BFGS: 9 20:14:56 -303.182055 0.483165
BFGS: 10 20:14:56 -303.186889 0.224606
BFGS: 11 20:14:56 -303.191493 0.342622
BFGS: 12 20:14:56 -303.197708 0.557115
BFGS: 13 20:14:56 -303.205142 0.593519
BFGS: 14 20:14:57 -303.211019 0.434119
BFGS: 15 20:14:57 -303.215072 0.286983
BFGS: 16 20:14:57 -303.220002 0.378988
BFGS: 17 20:14:57 -303.230393 0.723206
BFGS: 18 20:14:58 -303.263949 1.368197
BFGS: 19 20:14:58 -303.315094 2.187846
BFGS: 20 20:14:58 -303.311684 2.635654
Step Time Energy fmax
BFGS: 0 20:14:58 -301.708088 4.130235
BFGS: 1 20:14:58 -302.096256 3.178091
BFGS: 2 20:14:59 -303.094249 3.363599
BFGS: 3 20:14:59 -303.267676 3.798698
BFGS: 4 20:14:59 -303.562536 2.332467
BFGS: 5 20:14:59 -303.773627 3.050268
BFGS: 6 20:15:00 -303.872756 1.138114
BFGS: 7 20:15:00 -303.938367 0.728571
BFGS: 8 20:15:00 -304.017629 1.020167
BFGS: 9 20:15:00 -304.049068 0.918650
BFGS: 10 20:15:01 -304.127666 0.845176
BFGS: 11 20:15:01 -304.169280 0.974844
BFGS: 12 20:15:01 -304.205261 0.526052
BFGS: 13 20:15:01 -304.213915 0.313104
BFGS: 14 20:15:02 -304.227543 0.598015
BFGS: 15 20:15:02 -304.252643 1.080838
BFGS: 16 20:15:02 -304.288960 1.534200
BFGS: 17 20:15:02 -304.320368 1.274162
BFGS: 18 20:15:02 -304.432262 1.247849
BFGS: 19 20:15:03 -304.436084 1.655584
BFGS: 20 20:15:03 -304.490995 0.530430
Step Time Energy fmax
BFGS: 0 20:15:03 -302.176154 4.157281
BFGS: 1 20:15:03 -302.551395 3.249534
BFGS: 2 20:15:03 -303.450183 3.154605
BFGS: 3 20:15:03 -303.641911 3.005829
BFGS: 4 20:15:03 -303.914749 2.098742
BFGS: 5 20:15:03 -304.160206 2.873536
BFGS: 6 20:15:03 -304.268049 1.541430
BFGS: 7 20:15:03 -304.434536 0.850013
BFGS: 8 20:15:04 -304.489675 1.079013
BFGS: 9 20:15:04 -304.543389 0.936336
BFGS: 10 20:15:04 -304.608451 0.755738
BFGS: 11 20:15:04 -304.638484 0.318962
BFGS: 12 20:15:04 -304.648078 0.277138
BFGS: 13 20:15:04 -304.652994 0.205790
BFGS: 14 20:15:04 -304.658324 0.217822
BFGS: 15 20:15:04 -304.662835 0.221701
BFGS: 16 20:15:05 -304.665194 0.152778
BFGS: 17 20:15:05 -304.666753 0.143135
BFGS: 18 20:15:05 -304.668926 0.159165
BFGS: 19 20:15:06 -304.671565 0.195837
BFGS: 20 20:15:06 -304.674138 0.165836
Step Time Energy fmax
BFGS: 0 20:15:06 -301.112375 4.033329
BFGS: 1 20:15:06 -301.515382 3.117852
BFGS: 2 20:15:06 -302.635071 3.556090
BFGS: 3 20:15:06 -302.727939 4.578597
BFGS: 4 20:15:06 -303.022567 2.251233
BFGS: 5 20:15:06 -303.097041 2.468721
BFGS: 6 20:15:07 -303.145052 0.523293
BFGS: 7 20:15:07 -303.159492 0.528144
BFGS: 8 20:15:07 -303.273493 0.569613
BFGS: 9 20:15:07 -303.292484 0.614813
BFGS: 10 20:15:08 -303.375954 1.121999
BFGS: 11 20:15:08 -303.460007 1.847420
BFGS: 12 20:15:08 -303.591548 2.567265
BFGS: 13 20:15:08 -303.725881 2.191743
BFGS: 14 20:15:09 -303.858036 1.467481
BFGS: 15 20:15:09 -304.030108 2.073687
BFGS: 16 20:15:09 -303.940371 3.226942
BFGS: 17 20:15:10 -304.143449 1.136044
BFGS: 18 20:15:10 -304.169685 0.852187
BFGS: 19 20:15:10 -304.220153 0.483598
BFGS: 20 20:15:10 -304.241249 0.790902
Step Time Energy fmax
BFGS: 0 20:15:10 -300.816725 4.118886
BFGS: 1 20:15:10 -301.251538 3.442368
BFGS: 2 20:15:11 -302.489215 3.566850
BFGS: 3 20:15:11 -302.439449 7.192441
BFGS: 4 20:15:11 -302.838611 2.788707
BFGS: 5 20:15:11 -303.026674 1.091441
BFGS: 6 20:15:11 -303.079254 1.472696
BFGS: 7 20:15:11 -303.103562 0.743747
BFGS: 8 20:15:12 -303.131493 0.903615
BFGS: 9 20:15:12 -303.154122 0.865167
BFGS: 10 20:15:12 -303.170370 0.478646
BFGS: 11 20:15:12 -303.174085 0.179064
BFGS: 12 20:15:12 -303.175588 0.195465
BFGS: 13 20:15:12 -303.177783 0.369952
BFGS: 14 20:15:12 -303.180774 0.421320
BFGS: 15 20:15:13 -303.182887 0.276235
BFGS: 16 20:15:13 -303.183880 0.110544
BFGS: 17 20:15:13 -303.184651 0.139313
BFGS: 18 20:15:13 -303.185823 0.213244
BFGS: 19 20:15:14 -303.187414 0.268668
BFGS: 20 20:15:14 -303.188669 0.174285
Step Time Energy fmax
BFGS: 0 20:15:14 -302.338214 4.008453
BFGS: 1 20:15:14 -302.720493 2.761706
BFGS: 2 20:15:14 -303.531926 3.263348
BFGS: 3 20:15:14 -303.680358 2.693161
BFGS: 4 20:15:15 -303.874966 2.306015
BFGS: 5 20:15:15 -303.943531 0.711549
BFGS: 6 20:15:15 -303.974087 0.627741
BFGS: 7 20:15:15 -304.088982 0.548490
BFGS: 8 20:15:15 -304.108413 0.535159
BFGS: 9 20:15:15 -304.135302 0.481255
BFGS: 10 20:15:15 -304.154500 0.237547
BFGS: 11 20:15:15 -304.162153 0.124589
BFGS: 12 20:15:15 -304.164441 0.114465
BFGS: 13 20:15:15 -304.165419 0.100027
BFGS: 14 20:15:16 -304.166530 0.080485
BFGS: 15 20:15:16 -304.167331 0.079609
BFGS: 16 20:15:16 -304.167804 0.077689
BFGS: 17 20:15:16 -304.168154 0.063694
BFGS: 18 20:15:16 -304.168477 0.045359
Step Time Energy fmax
BFGS: 0 20:15:16 -301.133233 3.982411
BFGS: 1 20:15:16 -301.533179 3.147500
BFGS: 2 20:15:17 -302.670215 3.483008
BFGS: 3 20:15:17 -302.715389 5.371305
BFGS: 4 20:15:17 -303.019377 2.446032
BFGS: 5 20:15:17 -303.150840 1.426873
BFGS: 6 20:15:17 -303.171847 0.795918
BFGS: 7 20:15:18 -303.212290 1.175807
BFGS: 8 20:15:18 -303.247563 1.387863
BFGS: 9 20:15:18 -303.322913 1.117992
BFGS: 10 20:15:19 -303.361006 0.846433
BFGS: 11 20:15:19 -303.554091 1.922622
BFGS: 12 20:15:19 -303.706772 2.466301
BFGS: 13 20:15:19 -303.875546 2.266269
BFGS: 14 20:15:19 -303.988790 1.465784
BFGS: 15 20:15:20 -304.048085 1.878922
BFGS: 16 20:15:20 -304.162114 1.683142
BFGS: 17 20:15:20 -304.193267 1.032126
BFGS: 18 20:15:20 -304.243025 0.551890
BFGS: 19 20:15:20 -304.278652 0.332283
BFGS: 20 20:15:20 -304.283711 0.349034
# 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()) Step Time Energy fmax
BFGS: 0 20:15:21 -296.075588 4.431478
BFGS: 1 20:15:21 -296.617499 4.740374
BFGS: 2 20:15:21 -298.245495 2.861025
BFGS: 3 20:15:21 -296.772630 17.272678
BFGS: 4 20:15:22 -298.405296 1.764376
BFGS: 5 20:15:22 -298.463545 1.001733
BFGS: 6 20:15:22 -298.499661 0.595244
BFGS: 7 20:15:22 -298.504541 0.341210
BFGS: 8 20:15:22 -298.512525 0.153006
BFGS: 9 20:15:23 -298.514272 0.168225
BFGS: 10 20:15:23 -298.514826 0.130274
BFGS: 11 20:15:23 -298.515435 0.107519
BFGS: 12 20:15:23 -298.517147 0.192849
BFGS: 13 20:15:23 -298.522358 0.379041
BFGS: 14 20:15:24 -298.546671 0.833456
BFGS: 15 20:15:24 -298.467863 2.018943
BFGS: 16 20:15:24 -298.647946 0.901112
BFGS: 17 20:15:24 -298.767573 1.235184
BFGS: 18 20:15:24 -298.885954 2.095440
BFGS: 19 20:15:24 -299.016222 2.989087
BFGS: 20 20:15:24 -299.136360 3.633150
Step Time Energy fmax
BFGS: 0 20:15:24 -296.357262 4.368355
BFGS: 1 20:15:24 -296.837889 4.609642
BFGS: 2 20:15:25 -298.288107 3.178946
BFGS: 3 20:15:25 -297.643249 11.378258
BFGS: 4 20:15:25 -298.514971 1.872587
BFGS: 5 20:15:25 -298.584199 1.155187
BFGS: 6 20:15:25 -298.646683 1.287456
BFGS: 7 20:15:25 -298.678064 1.294099
BFGS: 8 20:15:26 -298.865272 1.403245
BFGS: 9 20:15:26 -298.971272 2.084958
BFGS: 10 20:15:26 -299.113031 2.143632
BFGS: 11 20:15:26 -299.285302 1.946806
BFGS: 12 20:15:27 -299.743457 0.848718
BFGS: 13 20:15:27 -299.829506 0.962407
BFGS: 14 20:15:27 -299.844966 0.681175
BFGS: 15 20:15:27 -299.895521 0.678036
BFGS: 16 20:15:27 -299.941605 0.874806
BFGS: 17 20:15:28 -299.975790 0.930122
BFGS: 18 20:15:28 -300.039263 1.174381
BFGS: 19 20:15:28 -300.098759 1.350462
BFGS: 20 20:15:28 -300.189869 1.611548
Step Time Energy fmax
BFGS: 0 20:15:29 -295.972271 4.461185
BFGS: 1 20:15:29 -296.548880 4.809853
BFGS: 2 20:15:29 -298.264858 2.700040
BFGS: 3 20:15:29 -296.317492 20.486408
BFGS: 4 20:15:29 -298.403065 1.713778
BFGS: 5 20:15:30 -298.457227 1.016115
BFGS: 6 20:15:30 -298.493055 0.550380
BFGS: 7 20:15:30 -298.496986 0.277239
BFGS: 8 20:15:31 -298.502487 0.087776
BFGS: 9 20:15:31 -298.504138 0.086570
BFGS: 10 20:15:31 -298.504371 0.032266
Step Time Energy fmax
BFGS: 0 20:15:31 -296.431957 4.361240
BFGS: 1 20:15:31 -296.901682 4.592361
BFGS: 2 20:15:32 -298.315967 3.268044
BFGS: 3 20:15:32 -297.849005 10.182218
BFGS: 4 20:15:32 -298.569694 1.901847
BFGS: 5 20:15:32 -298.643997 1.249453
BFGS: 6 20:15:32 -298.732251 1.644033
BFGS: 7 20:15:33 -298.799239 1.869875
BFGS: 8 20:15:33 -299.046055 2.004794
BFGS: 9 20:15:33 -299.223660 1.880052
BFGS: 10 20:15:33 -299.284504 1.763887
BFGS: 11 20:15:34 -299.431087 1.468242
BFGS: 12 20:15:34 -299.869166 1.065941
BFGS: 13 20:15:34 -299.965560 0.831473
BFGS: 14 20:15:35 -299.990957 0.849108
BFGS: 15 20:15:35 -300.138907 1.291203
BFGS: 16 20:15:35 -300.178730 1.390982
BFGS: 17 20:15:35 -300.295825 1.281247
BFGS: 18 20:15:36 -300.372155 1.104990
BFGS: 19 20:15:36 -300.445195 0.727571
BFGS: 20 20:15:36 -300.468851 0.488844
Step Time Energy fmax
BFGS: 0 20:15:36 -296.665151 4.397200
BFGS: 1 20:15:37 -297.124542 4.593167
BFGS: 2 20:15:37 -298.466707 3.482093
BFGS: 3 20:15:37 -298.402695 7.478064
BFGS: 4 20:15:37 -298.819912 1.975968
BFGS: 5 20:15:37 -298.916918 1.641230
BFGS: 6 20:15:38 -299.245257 2.618189
BFGS: 7 20:15:38 -299.472442 2.818596
BFGS: 8 20:15:38 -299.579587 1.845707
BFGS: 9 20:15:38 -299.734372 0.848085
BFGS: 10 20:15:38 -299.782227 0.882536
BFGS: 11 20:15:38 -299.827462 0.827108
BFGS: 12 20:15:39 -299.858209 0.751393
BFGS: 13 20:15:39 -299.883891 0.567364
BFGS: 14 20:15:39 -299.904295 0.553079
BFGS: 15 20:15:39 -299.933858 0.866291
BFGS: 16 20:15:39 -299.994482 1.529386
BFGS: 17 20:15:39 -300.048568 1.798057
BFGS: 18 20:15:39 -300.118669 1.559261
BFGS: 19 20:15:40 -300.291311 1.251284
BFGS: 20 20:15:40 -300.348212 1.377604
Step Time Energy fmax
BFGS: 0 20:15:40 -297.334867 4.354313
BFGS: 1 20:15:40 -297.776851 4.463440
BFGS: 2 20:15:40 -298.992435 3.344679
BFGS: 3 20:15:41 -299.160178 4.978124
BFGS: 4 20:15:41 -299.402746 1.682519
BFGS: 5 20:15:41 -299.516679 1.587374
BFGS: 6 20:15:42 -299.848221 0.771883
BFGS: 7 20:15:42 -299.899228 1.104987
BFGS: 8 20:15:42 -299.938745 0.737170
BFGS: 9 20:15:43 -300.001502 0.676905
BFGS: 10 20:15:43 -300.021008 0.548113
BFGS: 11 20:15:43 -300.038594 0.179759
BFGS: 12 20:15:44 -300.040670 0.131576
BFGS: 13 20:15:44 -300.041585 0.134303
BFGS: 14 20:15:44 -300.042386 0.094050
BFGS: 15 20:15:45 -300.042796 0.064840
BFGS: 16 20:15:45 -300.043021 0.053085
BFGS: 17 20:15:45 -300.043158 0.049932
Step Time Energy fmax
BFGS: 0 20:15:45 -296.173178 4.396354
BFGS: 1 20:15:46 -296.687835 4.676106
BFGS: 2 20:15:46 -298.245366 2.970270
BFGS: 3 20:15:46 -297.098698 14.873576
BFGS: 4 20:15:46 -298.424541 1.802385
BFGS: 5 20:15:46 -298.485845 1.025311
BFGS: 6 20:15:47 -298.525003 0.768956
BFGS: 7 20:15:47 -298.532571 0.555101
BFGS: 8 20:15:47 -298.553077 0.416161
BFGS: 9 20:15:47 -298.557139 0.454419
BFGS: 10 20:15:48 -298.569384 0.534727
BFGS: 11 20:15:48 -298.609551 0.943318
BFGS: 12 20:15:48 -298.671956 1.745801
BFGS: 13 20:15:49 -298.710830 2.564108
BFGS: 14 20:15:49 -298.715344 2.729031
BFGS: 15 20:15:49 -298.724536 2.977975
BFGS: 16 20:15:50 -298.727904 3.072798
BFGS: 17 20:15:50 -298.732229 3.150784
BFGS: 18 20:15:50 -298.740285 3.219611
BFGS: 19 20:15:50 -298.750791 3.218643
BFGS: 20 20:15:51 -298.765220 3.135713
Step Time Energy fmax
BFGS: 0 20:15:51 -297.066568 4.555064
BFGS: 1 20:15:51 -297.513567 4.717215
BFGS: 2 20:15:52 -298.749742 3.960531
BFGS: 3 20:15:52 -299.215663 3.796750
BFGS: 4 20:15:52 -299.398815 2.073426
BFGS: 5 20:15:52 -299.836670 2.390066
BFGS: 6 20:15:53 -300.189667 1.747943
BFGS: 7 20:15:53 -300.267414 1.460654
BFGS: 8 20:15:53 -300.385702 1.243206
BFGS: 9 20:15:53 -300.510289 1.240040
BFGS: 10 20:15:53 -300.546753 0.272125
BFGS: 11 20:15:54 -300.551818 0.230881
BFGS: 12 20:15:54 -300.561817 0.245351
BFGS: 13 20:15:54 -300.566635 0.168231
BFGS: 14 20:15:54 -300.570925 0.173537
BFGS: 15 20:15:55 -300.572820 0.150351
BFGS: 16 20:15:55 -300.574303 0.101749
BFGS: 17 20:15:55 -300.575116 0.088147
BFGS: 18 20:15:55 -300.575866 0.105755
BFGS: 19 20:15:55 -300.576664 0.097791
BFGS: 20 20:15:56 -300.577507 0.087465
Step Time Energy fmax
BFGS: 0 20:15:56 -296.170797 4.407317
BFGS: 1 20:15:56 -296.688049 4.687601
BFGS: 2 20:15:56 -298.246770 2.971138
BFGS: 3 20:15:56 -297.093540 14.928987
BFGS: 4 20:15:57 -298.425004 1.802590
BFGS: 5 20:15:57 -298.485988 1.024132
BFGS: 6 20:15:57 -298.524527 0.741176
BFGS: 7 20:15:57 -298.531741 0.522239
BFGS: 8 20:15:57 -298.550183 0.380227
BFGS: 9 20:15:58 -298.553640 0.405581
BFGS: 10 20:15:58 -298.562049 0.430554
BFGS: 11 20:15:58 -298.584671 0.561535
BFGS: 12 20:15:58 -298.638168 1.060161
BFGS: 13 20:15:59 -298.686295 1.684336
BFGS: 14 20:15:59 -298.721655 2.334531
BFGS: 15 20:15:59 -298.763511 2.763874
BFGS: 16 20:15:59 -298.893108 2.662109
BFGS: 17 20:16:00 -299.343196 1.785509
BFGS: 18 20:16:00 -299.511972 2.706070
BFGS: 19 20:16:00 -299.678953 1.468132
BFGS: 20 20:16:00 -299.877231 1.053428
Step Time Energy fmax
BFGS: 0 20:16:00 -297.459682 4.364314
BFGS: 1 20:16:00 -297.905138 4.451767
BFGS: 2 20:16:00 -299.101510 3.250670
BFGS: 3 20:16:01 -299.269702 4.601089
BFGS: 4 20:16:01 -299.495790 1.499975
BFGS: 5 20:16:01 -299.599788 1.401355
BFGS: 6 20:16:01 -299.887204 0.941489
BFGS: 7 20:16:01 -299.924427 0.866870
BFGS: 8 20:16:01 -299.977584 0.642994
BFGS: 9 20:16:01 -300.008142 0.646262
BFGS: 10 20:16:01 -300.031233 0.339708
BFGS: 11 20:16:01 -300.037133 0.179037
BFGS: 12 20:16:01 -300.038704 0.165788
BFGS: 13 20:16:02 -300.040435 0.118956
BFGS: 14 20:16:02 -300.041345 0.104508
BFGS: 15 20:16:02 -300.041803 0.092333
BFGS: 16 20:16:02 -300.042136 0.080414
BFGS: 17 20:16:02 -300.042613 0.079239
BFGS: 18 20:16:02 -300.043179 0.081435
BFGS: 19 20:16:02 -300.043543 0.045741
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 20:16:02 -295.427507 1.095906
BFGS: 1 20:16:02 -295.493274 1.011766
BFGS: 2 20:16:03 -295.711193 0.965375
BFGS: 3 20:16:03 -295.731148 0.556835
BFGS: 4 20:16:03 -295.743398 0.500322
BFGS: 5 20:16:03 -295.782499 0.560116
BFGS: 6 20:16:03 -295.792738 0.514521
BFGS: 7 20:16:03 -295.814984 0.504368
BFGS: 8 20:16:03 -295.829315 0.351328
BFGS: 9 20:16:03 -295.840196 0.219801
BFGS: 10 20:16:03 -295.843218 0.201642
BFGS: 11 20:16:03 -295.845213 0.170980
BFGS: 12 20:16:03 -295.847596 0.133223
BFGS: 13 20:16:04 -295.850064 0.107489
BFGS: 14 20:16:04 -295.851466 0.106499
BFGS: 15 20:16:04 -295.852211 0.108992
BFGS: 16 20:16:04 -295.853084 0.114214
BFGS: 17 20:16:04 -295.854731 0.124903
BFGS: 18 20:16:04 -295.857425 0.146658
BFGS: 19 20:16:04 -295.860562 0.184834
BFGS: 20 20:16:04 -295.863675 0.229656
Step Time Energy fmax
BFGS: 0 20:16:04 -295.596815 0.716403
BFGS: 1 20:16:04 -295.648051 0.634683
BFGS: 2 20:16:05 -295.826816 0.297493
BFGS: 3 20:16:05 -295.837079 0.268753
BFGS: 4 20:16:05 -295.839502 0.264572
BFGS: 5 20:16:05 -295.852388 0.193080
BFGS: 6 20:16:06 -295.853568 0.168751
BFGS: 7 20:16:06 -295.856518 0.126815
BFGS: 8 20:16:06 -295.857836 0.148814
BFGS: 9 20:16:06 -295.858903 0.173060
BFGS: 10 20:16:07 -295.860192 0.190588
BFGS: 11 20:16:07 -295.863182 0.218069
BFGS: 12 20:16:07 -295.869321 0.315495
BFGS: 13 20:16:07 -295.882006 0.536317
BFGS: 14 20:16:08 -295.885691 0.657286
BFGS: 15 20:16:08 -295.907951 0.500736
BFGS: 16 20:16:08 -295.926916 0.458180
BFGS: 17 20:16:08 -295.945181 0.375185
BFGS: 18 20:16:08 -295.958238 0.209439
BFGS: 19 20:16:09 -295.962320 0.105571
BFGS: 20 20:16:09 -295.963795 0.118458
Step Time Energy fmax
BFGS: 0 20:16:09 -295.588499 0.741014
BFGS: 1 20:16:09 -295.640460 0.697893
BFGS: 2 20:16:09 -295.826472 0.428786
BFGS: 3 20:16:10 -295.838262 0.402269
BFGS: 4 20:16:10 -295.844041 0.403645
BFGS: 5 20:16:10 -295.872495 0.342246
BFGS: 6 20:16:10 -295.877341 0.303487
BFGS: 7 20:16:10 -295.886587 0.271814
BFGS: 8 20:16:11 -295.892411 0.222501
BFGS: 9 20:16:11 -295.897425 0.275847
BFGS: 10 20:16:11 -295.900435 0.284333
BFGS: 11 20:16:11 -295.904212 0.269609
BFGS: 12 20:16:12 -295.909524 0.227748
BFGS: 13 20:16:12 -295.914813 0.169742
BFGS: 14 20:16:12 -295.918821 0.235647
BFGS: 15 20:16:12 -295.921485 0.233572
BFGS: 16 20:16:13 -295.924308 0.192693
BFGS: 17 20:16:13 -295.927994 0.107378
BFGS: 18 20:16:13 -295.930602 0.067162
BFGS: 19 20:16:13 -295.931582 0.055968
BFGS: 20 20:16:13 -295.931902 0.049681
Step Time Energy fmax
BFGS: 0 20:16:13 -295.638521 0.708970
BFGS: 1 20:16:14 -295.687257 0.629529
BFGS: 2 20:16:14 -295.862123 0.298647
BFGS: 3 20:16:14 -295.872133 0.330949
BFGS: 4 20:16:14 -295.874682 0.322201
BFGS: 5 20:16:15 -295.897351 0.228667
BFGS: 6 20:16:15 -295.899170 0.232364
BFGS: 7 20:16:15 -295.916068 0.430994
BFGS: 8 20:16:15 -295.922521 0.489538
BFGS: 9 20:16:16 -295.931941 0.467200
BFGS: 10 20:16:16 -295.940953 0.345580
BFGS: 11 20:16:16 -295.952204 0.234962
BFGS: 12 20:16:16 -295.957381 0.244988
BFGS: 13 20:16:17 -295.960269 0.238492
BFGS: 14 20:16:17 -295.962712 0.201693
BFGS: 15 20:16:17 -295.965111 0.119695
BFGS: 16 20:16:17 -295.966367 0.056495
BFGS: 17 20:16:18 -295.966634 0.046235
Step Time Energy fmax
BFGS: 0 20:16:18 -295.412926 1.133654
BFGS: 1 20:16:18 -295.478915 1.046923
BFGS: 2 20:16:18 -295.698196 1.012594
BFGS: 3 20:16:18 -295.719493 0.567174
BFGS: 4 20:16:18 -295.731884 0.508092
BFGS: 5 20:16:18 -295.774821 0.598559
BFGS: 6 20:16:19 -295.786218 0.570104
BFGS: 7 20:16:19 -295.824042 0.667429
BFGS: 8 20:16:19 -295.848025 0.533039
BFGS: 9 20:16:19 -295.869261 0.394801
BFGS: 10 20:16:20 -295.875593 0.357270
BFGS: 11 20:16:20 -295.882415 0.299881
BFGS: 12 20:16:20 -295.889785 0.255164
BFGS: 13 20:16:20 -295.897658 0.254879
BFGS: 14 20:16:21 -295.902514 0.270652
BFGS: 15 20:16:21 -295.906769 0.289018
BFGS: 16 20:16:21 -295.913913 0.302396
BFGS: 17 20:16:21 -295.926296 0.308353
BFGS: 18 20:16:21 -295.938816 0.274241
BFGS: 19 20:16:22 -295.948705 0.219340
BFGS: 20 20:16:22 -295.953802 0.189950
Step Time Energy fmax
BFGS: 0 20:16:22 -295.161955 1.550163
BFGS: 1 20:16:22 -295.259826 1.403083
BFGS: 2 20:16:23 -295.455225 2.085091
BFGS: 3 20:16:23 -295.522570 0.500958
BFGS: 4 20:16:23 -295.535905 0.584026
BFGS: 5 20:16:24 -295.561518 0.512764
BFGS: 6 20:16:24 -295.570455 0.266203
BFGS: 7 20:16:24 -295.575963 0.281011
BFGS: 8 20:16:25 -295.580726 0.308472
BFGS: 9 20:16:25 -295.586389 0.263965
BFGS: 10 20:16:25 -295.590211 0.190903
BFGS: 11 20:16:26 -295.591858 0.167512
BFGS: 12 20:16:26 -295.592796 0.200857
BFGS: 13 20:16:26 -295.595245 0.285651
BFGS: 14 20:16:26 -295.602885 0.475469
BFGS: 15 20:16:27 -295.637381 0.805325
BFGS: 16 20:16:27 -295.707537 0.779436
BFGS: 17 20:16:27 -295.746647 0.794733
BFGS: 18 20:16:27 -295.765355 0.654572
BFGS: 19 20:16:28 -295.792182 0.568237
BFGS: 20 20:16:28 -295.824939 0.290953
Step Time Energy fmax
BFGS: 0 20:16:28 -295.089358 1.749204
BFGS: 1 20:16:28 -295.203292 1.576133
BFGS: 2 20:16:29 -295.386132 2.496353
BFGS: 3 20:16:29 -295.476386 0.461479
BFGS: 4 20:16:29 -295.493028 0.621539
BFGS: 5 20:16:30 -295.519787 0.688268
BFGS: 6 20:16:30 -295.534575 0.462382
BFGS: 7 20:16:30 -295.543025 0.259960
BFGS: 8 20:16:31 -295.547644 0.314217
BFGS: 9 20:16:31 -295.554382 0.300323
BFGS: 10 20:16:31 -295.558395 0.183465
BFGS: 11 20:16:31 -295.559770 0.060059
BFGS: 12 20:16:32 -295.559933 0.015105
Step Time Energy fmax
BFGS: 0 20:16:32 -295.638666 0.736796
BFGS: 1 20:16:32 -295.687017 0.653944
BFGS: 2 20:16:33 -295.858255 0.319676
BFGS: 3 20:16:33 -295.868504 0.351747
BFGS: 4 20:16:33 -295.871713 0.345052
BFGS: 5 20:16:33 -295.896279 0.230627
BFGS: 6 20:16:34 -295.898652 0.214639
BFGS: 7 20:16:34 -295.910565 0.262732
BFGS: 8 20:16:34 -295.912330 0.262616
BFGS: 9 20:16:34 -295.917415 0.227908
BFGS: 10 20:16:35 -295.920723 0.178669
BFGS: 11 20:16:35 -295.923820 0.133607
BFGS: 12 20:16:35 -295.925511 0.165917
BFGS: 13 20:16:36 -295.927090 0.174732
BFGS: 14 20:16:36 -295.929175 0.152635
BFGS: 15 20:16:36 -295.931248 0.103984
BFGS: 16 20:16:37 -295.932281 0.049371
Step Time Energy fmax
BFGS: 0 20:16:37 -295.126084 1.636439
BFGS: 1 20:16:37 -295.231334 1.478588
BFGS: 2 20:16:38 -295.420287 2.297333
BFGS: 3 20:16:38 -295.499569 0.478218
BFGS: 4 20:16:38 -295.514524 0.602090
BFGS: 5 20:16:39 -295.539710 0.608957
BFGS: 6 20:16:39 -295.551222 0.364207
BFGS: 7 20:16:39 -295.557584 0.255588
BFGS: 8 20:16:40 -295.561818 0.298357
BFGS: 9 20:16:40 -295.567167 0.270556
BFGS: 10 20:16:40 -295.570582 0.172160
BFGS: 11 20:16:40 -295.571775 0.076715
BFGS: 12 20:16:40 -295.572025 0.079693
BFGS: 13 20:16:41 -295.572269 0.091128
BFGS: 14 20:16:41 -295.572819 0.112464
BFGS: 15 20:16:41 -295.573981 0.140633
BFGS: 16 20:16:41 -295.576232 0.163030
BFGS: 17 20:16:42 -295.580041 0.192413
BFGS: 18 20:16:42 -295.589188 0.444320
BFGS: 19 20:16:42 -295.596612 0.794957
BFGS: 20 20:16:42 -295.599729 0.883148
Step Time Energy fmax
BFGS: 0 20:16:43 -295.094602 1.729823
BFGS: 1 20:16:43 -295.207233 1.559407
BFGS: 2 20:16:43 -295.390962 2.469463
BFGS: 3 20:16:43 -295.479804 0.462991
BFGS: 4 20:16:44 -295.496214 0.618484
BFGS: 5 20:16:44 -295.522583 0.677756
BFGS: 6 20:16:44 -295.536823 0.447747
BFGS: 7 20:16:45 -295.544854 0.256760
BFGS: 8 20:16:45 -295.549354 0.309860
BFGS: 9 20:16:45 -295.555720 0.294585
BFGS: 10 20:16:46 -295.559578 0.180502
BFGS: 11 20:16:46 -295.560903 0.059143
BFGS: 12 20:16:46 -295.561063 0.015781
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 20:16:46 -302.917653 3.659656
BFGS: 1 20:16:47 -303.308487 2.411118
BFGS: 2 20:16:47 -303.652402 2.085804
BFGS: 3 20:16:47 -303.741667 1.206520
BFGS: 4 20:16:48 -303.869338 0.511402
BFGS: 5 20:16:48 -303.890315 0.356355
BFGS: 6 20:16:48 -303.899228 0.279136
BFGS: 7 20:16:48 -303.907635 0.274240
BFGS: 8 20:16:49 -303.917319 0.190141
BFGS: 9 20:16:49 -303.921695 0.157472
BFGS: 10 20:16:49 -303.923931 0.150392
BFGS: 11 20:16:50 -303.926506 0.129129
BFGS: 12 20:16:50 -303.928792 0.086626
BFGS: 13 20:16:50 -303.929840 0.067462
BFGS: 14 20:16:50 -303.930169 0.043320
Step Time Energy fmax
BFGS: 0 20:16:51 -302.844183 3.872545
BFGS: 1 20:16:51 -303.246814 2.602552
BFGS: 2 20:16:51 -303.623171 1.877427
BFGS: 3 20:16:52 -303.709839 1.174868
BFGS: 4 20:16:52 -303.829704 0.517635
BFGS: 5 20:16:52 -303.855845 0.516873
BFGS: 6 20:16:53 -303.878308 0.526044
BFGS: 7 20:16:53 -303.895002 0.371602
BFGS: 8 20:16:53 -303.907389 0.230500
BFGS: 9 20:16:53 -303.914809 0.197523
BFGS: 10 20:16:53 -303.918997 0.175008
BFGS: 11 20:16:54 -303.923246 0.204473
BFGS: 12 20:16:54 -303.926584 0.155927
BFGS: 13 20:16:54 -303.928133 0.076258
BFGS: 14 20:16:55 -303.928775 0.061377
BFGS: 15 20:16:55 -303.929202 0.065085
BFGS: 16 20:16:55 -303.929824 0.054100
BFGS: 17 20:16:55 -303.930378 0.046171
Step Time Energy fmax
BFGS: 0 20:16:56 -302.319978 3.210339
BFGS: 1 20:16:56 -302.616774 2.208719
BFGS: 2 20:16:56 -302.974735 1.710692
BFGS: 3 20:16:56 -303.060896 1.133569
BFGS: 4 20:16:57 -303.223742 0.702171
BFGS: 5 20:16:57 -303.249229 0.647101
BFGS: 6 20:16:57 -303.276539 0.630234
BFGS: 7 20:16:58 -303.310866 0.604698
BFGS: 8 20:16:58 -303.344757 0.438524
BFGS: 9 20:16:58 -303.360869 0.309457
BFGS: 10 20:16:59 -303.367372 0.325889
BFGS: 11 20:16:59 -303.374409 0.285027
BFGS: 12 20:16:59 -303.380435 0.164903
BFGS: 13 20:17:00 -303.384367 0.177649
BFGS: 14 20:17:00 -303.387600 0.211792
BFGS: 15 20:17:00 -303.391796 0.246178
BFGS: 16 20:17:01 -303.398098 0.266854
BFGS: 17 20:17:01 -303.405299 0.256146
BFGS: 18 20:17:01 -303.411808 0.246378
BFGS: 19 20:17:01 -303.418752 0.279640
BFGS: 20 20:17:02 -303.427759 0.349672
BFGS: 21 20:17:02 -303.445497 0.539751
BFGS: 22 20:17:02 -303.466428 0.602044
BFGS: 23 20:17:02 -303.492974 0.585314
BFGS: 24 20:17:03 -303.521876 0.559695
BFGS: 25 20:17:03 -303.548970 0.501407
BFGS: 26 20:17:03 -303.579771 0.605979
BFGS: 27 20:17:03 -303.629932 0.755430
BFGS: 28 20:17:03 -303.693392 0.738157
BFGS: 29 20:17:04 -303.769205 0.988476
BFGS: 30 20:17:04 -303.826101 0.845921
BFGS: 31 20:17:04 -303.860184 0.596315
BFGS: 32 20:17:04 -303.886977 0.332465
BFGS: 33 20:17:04 -303.902497 0.298506
BFGS: 34 20:17:05 -303.911288 0.251761
BFGS: 35 20:17:05 -303.917046 0.214858
BFGS: 36 20:17:05 -303.919950 0.177615
BFGS: 37 20:17:05 -303.923847 0.091126
BFGS: 38 20:17:06 -303.925555 0.083330
BFGS: 39 20:17:06 -303.926271 0.080904
BFGS: 40 20:17:06 -303.926808 0.067954
BFGS: 41 20:17:06 -303.927515 0.045793
Step Time Energy fmax
BFGS: 0 20:17:06 -302.520845 3.956904
BFGS: 1 20:17:06 -302.939251 2.706587
BFGS: 2 20:17:07 -303.402327 2.226722
BFGS: 3 20:17:07 -303.520392 1.526700
BFGS: 4 20:17:07 -303.716452 0.593148
BFGS: 5 20:17:07 -303.738978 0.568191
BFGS: 6 20:17:08 -303.762832 0.515446
BFGS: 7 20:17:08 -303.787383 0.491974
BFGS: 8 20:17:08 -303.817237 0.461312
BFGS: 9 20:17:09 -303.842967 0.483876
BFGS: 10 20:17:09 -303.862878 0.473060
BFGS: 11 20:17:09 -303.880778 0.504774
BFGS: 12 20:17:10 -303.896054 0.344568
BFGS: 13 20:17:10 -303.904666 0.227258
BFGS: 14 20:17:10 -303.910203 0.207148
BFGS: 15 20:17:10 -303.915431 0.166830
BFGS: 16 20:17:11 -303.919410 0.170103
BFGS: 17 20:17:11 -303.922000 0.142228
BFGS: 18 20:17:11 -303.923638 0.123635
BFGS: 19 20:17:12 -303.924915 0.131304
BFGS: 20 20:17:12 -303.926233 0.120468
BFGS: 21 20:17:12 -303.927218 0.073950
BFGS: 22 20:17:13 -303.927622 0.042877
/home/runner/work/_tool/Python/3.12.13/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.13/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 20:17:35 -302.036471 3.502288
BFGS: 1 20:17:36 -302.196299 3.202191
BFGS: 2 20:17:37 -302.493516 6.068897
BFGS: 3 20:17:37 -302.556587 1.939948
BFGS: 4 20:17:38 -302.657696 1.633610
BFGS: 5 20:17:39 -302.806272 1.713854
BFGS: 6 20:17:40 -302.827509 1.308578
BFGS: 7 20:17:40 -302.907934 1.309929
BFGS: 8 20:17:41 -302.919612 0.916039
BFGS: 9 20:17:42 -302.950954 0.551209
BFGS: 10 20:17:43 -302.960565 0.662998
BFGS: 11 20:17:43 -302.973773 0.665363
BFGS: 12 20:17:44 -302.976558 0.402879
BFGS: 13 20:17:45 -302.981214 0.467681
BFGS: 14 20:17:46 -302.987496 0.558575
BFGS: 15 20:17:46 -303.003515 0.613200
BFGS: 16 20:17:47 -303.022921 0.542084
BFGS: 17 20:17:48 -303.082418 0.764021
BFGS: 18 20:17:49 -303.256672 1.055542
BFGS: 19 20:17:49 -303.402053 1.258166
BFGS: 20 20:17:50 -303.462598 1.314167
BFGS: 21 20:17:51 -303.494031 1.207462
BFGS: 22 20:17:52 -303.494256 0.797548
BFGS: 23 20:17:52 -303.510256 0.598488
BFGS: 24 20:17:53 -303.518618 0.656488
BFGS: 25 20:17:54 -303.527029 0.515628
BFGS: 26 20:17:55 -303.531514 0.531433
BFGS: 27 20:17:55 -303.533926 0.522538
BFGS: 28 20:17:56 -303.535480 0.668106
BFGS: 29 20:17:57 -303.537315 0.608909
BFGS: 30 20:17:58 -303.538785 0.463633
BFGS: 31 20:17:59 -303.540277 0.472296
BFGS: 32 20:17:59 -303.542951 0.594573
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_9133/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")