Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Transition State Search (NEBs)

Tutorial Overview
PropertyValue
DifficultyAdvanced
Time30-45 minutes
PrerequisitesUnderstanding of NEB, ASE, catalysis
GoalFind 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 = 300

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,
)
Warp DeprecationWarning: The symbol `warp.vec` will soon be removed from the public API. Use `warp.types.vector` instead.
# 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
)
# 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))
# 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 00:27:31     -301.182488        3.955900
BFGS:    1 00:27:31     -301.568743        3.378422
BFGS:    2 00:27:32     -302.692694        3.263044
BFGS:    3 00:27:32     -302.563057        7.471874
BFGS:    4 00:27:32     -303.013161        2.588006
BFGS:    5 00:27:32     -303.142894        1.628429
BFGS:    6 00:27:33     -303.242180        1.903416
BFGS:    7 00:27:33     -303.281119        1.203645
BFGS:    8 00:27:33     -303.461706        1.966337
BFGS:    9 00:27:34     -303.656396        3.128855
BFGS:   10 00:27:34     -303.804027        3.341129
BFGS:   11 00:27:35     -303.934983        3.154403
BFGS:   12 00:27:35     -304.299850        2.358449
BFGS:   13 00:27:35     -304.415484        3.915775
BFGS:   14 00:27:36     -304.548156        0.772880
BFGS:   15 00:27:36     -304.570296        0.600744
BFGS:   16 00:27:37     -304.599999        0.526380
BFGS:   17 00:27:37     -304.610299        0.368153
BFGS:   18 00:27:38     -304.617092        0.276960
BFGS:   19 00:27:38     -304.622696        0.334202
BFGS:   20 00:27:39     -304.633076        0.467215
      Step     Time          Energy          fmax
BFGS:    0 00:27:39     -301.148525        4.061315
BFGS:    1 00:27:39     -301.541977        3.157591
BFGS:    2 00:27:40     -302.608809        3.471528
BFGS:    3 00:27:40     -302.700359        4.396152
BFGS:    4 00:27:41     -302.982705        2.257936
BFGS:    5 00:27:41     -303.074484        2.573560
BFGS:    6 00:27:42     -303.125935        0.578499
BFGS:    7 00:27:42     -303.147660        0.603557
BFGS:    8 00:27:42     -303.268226        0.613537
BFGS:    9 00:27:43     -303.283998        0.489904
BFGS:   10 00:27:44     -303.362763        1.366104
BFGS:   11 00:27:44     -303.437161        1.836279
BFGS:   12 00:27:44     -303.512198        2.235086
BFGS:   13 00:27:45     -303.623068        2.220564
BFGS:   14 00:27:45     -303.739303        2.858287
BFGS:   15 00:27:46     -303.797502        2.328123
BFGS:   16 00:27:46     -303.961203        1.675146
BFGS:   17 00:27:47     -304.090380        1.195646
BFGS:   18 00:27:47     -304.208673        1.818354
BFGS:   19 00:27:48     -304.283737        0.846438
BFGS:   20 00:27:48     -304.321209        1.086232
      Step     Time          Energy          fmax
BFGS:    0 00:27:49     -300.643920        4.030132
BFGS:    1 00:27:49     -301.121624        3.996292
BFGS:    2 00:27:49     -302.537602        3.662791
BFGS:    3 00:27:50     -302.363270        8.487669
BFGS:    4 00:27:50     -302.808328        3.240690
BFGS:    5 00:27:51     -302.968389        2.459222
BFGS:    6 00:27:51     -303.084878        2.537820
BFGS:    7 00:27:52     -303.128843        0.535678
BFGS:    8 00:27:52     -303.135933        0.331983
BFGS:    9 00:27:53     -303.144933        0.384642
BFGS:   10 00:27:53     -303.152476        0.487835
BFGS:   11 00:27:53     -303.161548        0.400362
BFGS:   12 00:27:54     -303.164275        0.236939
BFGS:   13 00:27:54     -303.165913        0.148431
BFGS:   14 00:27:54     -303.168999        0.186310
BFGS:   15 00:27:55     -303.172953        0.247697
BFGS:   16 00:27:55     -303.177197        0.236360
BFGS:   17 00:27:56     -303.179649        0.138425
BFGS:   18 00:27:56     -303.180533        0.077779
BFGS:   19 00:27:57     -303.181029        0.098368
BFGS:   20 00:27:57     -303.181812        0.136029
      Step     Time          Energy          fmax
BFGS:    0 00:27:58     -301.316843        4.164164
BFGS:    1 00:27:58     -301.711820        3.183506
BFGS:    2 00:27:58     -302.718375        3.455060
BFGS:    3 00:27:59     -302.848749        3.398249
BFGS:    4 00:27:59     -303.126442        2.051423
BFGS:    5 00:28:00     -303.218661        2.949841
BFGS:    6 00:28:00     -303.294670        1.250990
BFGS:    7 00:28:00     -303.368441        1.017732
BFGS:    8 00:28:01     -303.708363        1.838047
BFGS:    9 00:28:01     -303.812768        2.478430
BFGS:   10 00:28:02     -303.897063        1.879547
BFGS:   11 00:28:02     -304.000941        0.762954
BFGS:   12 00:28:02     -304.080445        1.066911
BFGS:   13 00:28:03     -304.110270        0.792849
BFGS:   14 00:28:03     -304.148507        0.883140
BFGS:   15 00:28:04     -304.173217        0.605976
BFGS:   16 00:28:04     -304.189278        0.352708
BFGS:   17 00:28:05     -304.213710        0.439587
BFGS:   18 00:28:05     -304.245238        0.623254
BFGS:   19 00:28:06     -304.285652        0.987182
BFGS:   20 00:28:06     -304.325231        0.935265
      Step     Time          Energy          fmax
BFGS:    0 00:28:06     -301.194340        4.140125
BFGS:    1 00:28:07     -301.590396        3.227665
BFGS:    2 00:28:07     -302.624276        3.442045
BFGS:    3 00:28:07     -302.729192        3.867752
BFGS:    4 00:28:08     -302.994713        2.236853
BFGS:    5 00:28:08     -303.080083        2.743855
BFGS:    6 00:28:08     -303.141253        0.772287
BFGS:    7 00:28:08     -303.170078        0.748155
BFGS:    8 00:28:09     -303.403375        0.839342
BFGS:    9 00:28:09     -303.483456        1.358007
BFGS:   10 00:28:09     -303.590327        1.749792
BFGS:   11 00:28:10     -303.776684        1.940317
BFGS:   12 00:28:10     -303.848899        2.105329
BFGS:   13 00:28:10     -304.022189        1.829151
BFGS:   14 00:28:10     -304.125354        1.426054
BFGS:   15 00:28:11     -304.245883        0.860717
BFGS:   16 00:28:11     -304.287693        0.802132
BFGS:   17 00:28:11     -304.393399        1.155028
BFGS:   18 00:28:12     -304.432878        1.083199
BFGS:   19 00:28:12     -304.486641        0.847449
BFGS:   20 00:28:12     -304.518224        0.412818
      Step     Time          Energy          fmax
BFGS:    0 00:28:12     -301.779846        4.208153
BFGS:    1 00:28:12     -302.168541        3.387056
BFGS:    2 00:28:13     -303.142680        3.212773
BFGS:    3 00:28:13     -303.308331        3.899223
BFGS:    4 00:28:13     -303.589666        2.323503
BFGS:    5 00:28:14     -303.842281        2.644501
BFGS:    6 00:28:14     -303.915966        1.137131
BFGS:    7 00:28:14     -303.992305        0.726019
BFGS:    8 00:28:14     -304.034580        0.944947
BFGS:    9 00:28:15     -304.072420        0.908849
BFGS:   10 00:28:15     -304.113928        0.703820
BFGS:   11 00:28:15     -304.148289        0.627234
BFGS:   12 00:28:15     -304.169317        0.477651
BFGS:   13 00:28:16     -304.176362        0.272409
BFGS:   14 00:28:16     -304.180509        0.248972
BFGS:   15 00:28:16     -304.188366        0.418707
BFGS:   16 00:28:17     -304.197142        0.509981
BFGS:   17 00:28:17     -304.205706        0.422506
BFGS:   18 00:28:17     -304.218054        0.427398
BFGS:   19 00:28:17     -304.247200        1.344150
BFGS:   20 00:28:18     -304.280362        1.358243
      Step     Time          Energy          fmax
BFGS:    0 00:28:18     -300.894799        4.118631
BFGS:    1 00:28:18     -301.322916        3.379720
BFGS:    2 00:28:18     -302.528565        3.613159
BFGS:    3 00:28:19     -302.562681        5.968758
BFGS:    4 00:28:19     -302.909406        2.598995
BFGS:    5 00:28:19     -303.068777        1.867723
BFGS:    6 00:28:19     -303.094920        0.733271
BFGS:    7 00:28:20     -303.115890        0.609416
BFGS:    8 00:28:20     -303.141807        0.940252
BFGS:    9 00:28:20     -303.168565        0.757058
BFGS:   10 00:28:20     -303.178901        0.291792
BFGS:   11 00:28:21     -303.181256        0.171157
BFGS:   12 00:28:21     -303.183581        0.316351
BFGS:   13 00:28:21     -303.187301        0.448819
BFGS:   14 00:28:22     -303.191044        0.408341
BFGS:   15 00:28:22     -303.193625        0.243036
BFGS:   16 00:28:22     -303.195314        0.148307
BFGS:   17 00:28:23     -303.197490        0.270870
BFGS:   18 00:28:23     -303.201049        0.382810
BFGS:   19 00:28:23     -303.206176        0.407228
BFGS:   20 00:28:24     -303.210359        0.254985
      Step     Time          Energy          fmax
BFGS:    0 00:28:24     -301.081797        4.040684
BFGS:    1 00:28:24     -301.484277        3.117891
BFGS:    2 00:28:24     -302.597903        3.557440
BFGS:    3 00:28:25     -302.696830        4.445086
BFGS:    4 00:28:25     -302.997366        2.148155
BFGS:    5 00:28:25     -303.055805        2.532305
BFGS:    6 00:28:26     -303.113214        0.516660
BFGS:    7 00:28:26     -303.128011        0.458079
BFGS:    8 00:28:26     -303.213717        0.364034
BFGS:    9 00:28:27     -303.223502        0.372113
BFGS:   10 00:28:27     -303.236922        0.395831
BFGS:   11 00:28:27     -303.260113        0.503283
BFGS:   12 00:28:28     -303.276938        0.575943
BFGS:   13 00:28:28     -303.291031        0.634469
BFGS:   14 00:28:28     -303.306604        0.806922
BFGS:   15 00:28:28     -303.434399        1.918951
BFGS:   16 00:28:29     -303.755427        1.614326
BFGS:   17 00:28:29     -303.827983        2.056820
BFGS:   18 00:28:29     -304.004733        0.946217
BFGS:   19 00:28:29     -304.199230        1.602779
BFGS:   20 00:28:30     -304.452292        2.095382
      Step     Time          Energy          fmax
BFGS:    0 00:28:30     -302.156600        4.009971
BFGS:    1 00:28:30     -302.531010        2.886729
BFGS:    2 00:28:31     -303.427680        3.336542
BFGS:    3 00:28:31     -303.600740        2.993892
BFGS:    4 00:28:31     -303.917499        1.477417
BFGS:    5 00:28:32     -303.972113        1.002436
BFGS:    6 00:28:32     -304.085491        0.727244
BFGS:    7 00:28:32     -304.143803        0.709394
BFGS:    8 00:28:32     -304.181796        0.804584
BFGS:    9 00:28:33     -304.232788        0.666465
BFGS:   10 00:28:33     -304.265116        0.490362
BFGS:   11 00:28:33     -304.279629        0.380119
BFGS:   12 00:28:33     -304.288679        0.379323
BFGS:   13 00:28:34     -304.299838        0.377026
BFGS:   14 00:28:34     -304.311296        0.296014
BFGS:   15 00:28:34     -304.318449        0.215169
BFGS:   16 00:28:35     -304.324090        0.167714
BFGS:   17 00:28:35     -304.327606        0.173262
BFGS:   18 00:28:35     -304.331689        0.177264
BFGS:   19 00:28:36     -304.336388        0.179244
BFGS:   20 00:28:36     -304.339425        0.172002
      Step     Time          Energy          fmax
BFGS:    0 00:28:36     -301.527916        4.174162
BFGS:    1 00:28:37     -301.922364        3.397735
BFGS:    2 00:28:37     -302.912997        3.228952
BFGS:    3 00:28:37     -303.041997        3.376178
BFGS:    4 00:28:37     -303.298039        2.227644
BFGS:    5 00:28:38     -303.491398        3.617070
BFGS:    6 00:28:38     -303.602511        1.891984
BFGS:    7 00:28:39     -303.802144        0.982379
BFGS:    8 00:28:39     -303.876720        2.113303
BFGS:    9 00:28:39     -303.952762        1.124024
BFGS:   10 00:28:40     -303.994588        0.747688
BFGS:   11 00:28:40     -304.094303        1.326092
BFGS:   12 00:28:40     -304.121691        0.925997
BFGS:   13 00:28:40     -304.166627        0.455492
BFGS:   14 00:28:41     -304.178898        0.561259
BFGS:   15 00:28:41     -304.210906        0.649366
BFGS:   16 00:28:41     -304.221389        0.437883
BFGS:   17 00:28:42     -304.233543        0.335976
BFGS:   18 00:28:42     -304.246888        0.405263
BFGS:   19 00:28:42     -304.263709        0.477779
BFGS:   20 00:28:43     -304.277902        0.397427
# 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 00:28:43     -297.182248        4.578023
BFGS:    1 00:28:43     -297.642498        4.715305
BFGS:    2 00:28:43     -298.914976        3.762486
BFGS:    3 00:28:44     -299.219969        4.660108
BFGS:    4 00:28:44     -299.422933        1.804763
BFGS:    5 00:28:44     -299.546020        1.699989
BFGS:    6 00:28:45     -299.695152        2.239458
BFGS:    7 00:28:45     -299.763375        1.325178
BFGS:    8 00:28:45     -299.794157        1.404382
BFGS:    9 00:28:45     -300.078294        1.894435
BFGS:   10 00:28:46     -300.185974        1.300733
BFGS:   11 00:28:46     -300.230609        1.618201
BFGS:   12 00:28:46     -300.277591        1.528354
BFGS:   13 00:28:47     -300.374297        1.107160
BFGS:   14 00:28:47     -300.393194        1.206419
BFGS:   15 00:28:47     -300.434806        1.159850
BFGS:   16 00:28:47     -300.455622        0.910881
BFGS:   17 00:28:48     -300.475638        0.673870
BFGS:   18 00:28:48     -300.483920        0.674033
BFGS:   19 00:28:48     -300.493934        0.765155
BFGS:   20 00:28:48     -300.502153        0.751057
      Step     Time          Energy          fmax
BFGS:    0 00:28:48     -296.913132        4.454080
BFGS:    1 00:28:49     -297.370959        4.619175
BFGS:    2 00:28:49     -298.663771        3.681325
BFGS:    3 00:28:49     -298.923877        5.177117
BFGS:    4 00:28:49     -299.158184        1.912085
BFGS:    5 00:28:50     -299.294733        1.832846
BFGS:    6 00:28:50     -299.681493        0.895763
BFGS:    7 00:28:50     -299.709616        1.722948
BFGS:    8 00:28:50     -299.760720        0.810741
BFGS:    9 00:28:50     -299.807380        0.779344
BFGS:   10 00:28:51     -299.875326        1.045542
BFGS:   11 00:28:51     -299.914290        0.924367
BFGS:   12 00:28:51     -299.966530        0.783899
BFGS:   13 00:28:51     -300.004284        1.119528
BFGS:   14 00:28:51     -300.075883        1.924456
BFGS:   15 00:28:51     -300.107905        2.362664
BFGS:   16 00:28:52     -300.205287        2.178877
BFGS:   17 00:28:52     -300.305629        1.675233
BFGS:   18 00:28:52     -300.445549        0.806734
BFGS:   19 00:28:52     -300.469998        0.604302
BFGS:   20 00:28:53     -300.497616        0.541666
      Step     Time          Energy          fmax
BFGS:    0 00:28:53     -296.470339        4.359852
BFGS:    1 00:28:53     -296.939261        4.582938
BFGS:    2 00:28:53     -298.341432        3.231354
BFGS:    3 00:28:53     -297.845219       10.321197
BFGS:    4 00:28:54     -298.585689        1.890199
BFGS:    5 00:28:54     -298.658060        1.238657
BFGS:    6 00:28:54     -298.740273        1.516288
BFGS:    7 00:28:54     -298.793803        1.613882
BFGS:    8 00:28:54     -299.007016        1.571119
BFGS:    9 00:28:54     -299.169377        1.776925
BFGS:   10 00:28:55     -299.269834        1.587320
BFGS:   11 00:28:55     -299.403784        1.464748
BFGS:   12 00:28:55     -299.853698        0.779000
BFGS:   13 00:28:55     -299.870140        0.801713
BFGS:   14 00:28:56     -299.925368        0.527827
BFGS:   15 00:28:56     -299.955554        0.441257
BFGS:   16 00:28:56     -299.965885        0.413739
BFGS:   17 00:28:56     -299.971992        0.384691
BFGS:   18 00:28:56     -299.986124        0.323007
BFGS:   19 00:28:56     -300.002138        0.308632
BFGS:   20 00:28:57     -300.016204        0.271017
      Step     Time          Energy          fmax
BFGS:    0 00:28:57     -296.037274        4.438262
BFGS:    1 00:28:57     -296.590273        4.760946
BFGS:    2 00:28:57     -298.249738        2.806758
BFGS:    3 00:28:57     -296.616831       18.388306
BFGS:    4 00:28:57     -298.401790        1.742556
BFGS:    5 00:28:58     -298.458735        0.993571
BFGS:    6 00:28:58     -298.494618        0.549930
BFGS:    7 00:28:58     -298.499031        0.290477
BFGS:    8 00:28:58     -298.505559        0.091900
BFGS:    9 00:28:58     -298.507165        0.113851
BFGS:   10 00:28:59     -298.507438        0.067307
BFGS:   11 00:28:59     -298.507536        0.046759
      Step     Time          Energy          fmax
BFGS:    0 00:28:59     -296.304337        4.382683
BFGS:    1 00:28:59     -296.795652        4.631855
BFGS:    2 00:28:59     -298.274681        3.106637
BFGS:    3 00:28:59     -297.479281       12.391833
BFGS:    4 00:29:00     -298.483040        1.848206
BFGS:    5 00:29:00     -298.549016        1.100973
BFGS:    6 00:29:00     -298.600301        1.078805
BFGS:    7 00:29:00     -298.618968        0.978236
BFGS:    8 00:29:01     -298.713813        1.315424
BFGS:    9 00:29:01     -298.753243        1.258881
BFGS:   10 00:29:01     -299.152051        1.710486
BFGS:   11 00:29:01     -299.577164        1.540759
BFGS:   12 00:29:02     -299.590557        3.274576
BFGS:   13 00:29:02     -299.732179        0.895245
BFGS:   14 00:29:02     -299.763367        0.635153
BFGS:   15 00:29:02     -299.801993        0.886034
BFGS:   16 00:29:02     -299.822105        0.717117
BFGS:   17 00:29:03     -299.854247        0.222925
BFGS:   18 00:29:03     -299.858759        0.233737
BFGS:   19 00:29:03     -299.868205        0.160607
BFGS:   20 00:29:03     -299.870571        0.150965
      Step     Time          Energy          fmax
BFGS:    0 00:29:04     -296.730701        4.392225
BFGS:    1 00:29:04     -297.187938        4.580180
BFGS:    2 00:29:04     -298.515143        3.484373
BFGS:    3 00:29:04     -298.491499        7.157108
BFGS:    4 00:29:05     -298.880233        1.968135
BFGS:    5 00:29:05     -298.980475        1.680655
BFGS:    6 00:29:05     -299.330121        2.350260
BFGS:    7 00:29:05     -299.522183        2.465294
BFGS:    8 00:29:05     -299.614603        1.647452
BFGS:    9 00:29:06     -299.746966        0.729990
BFGS:   10 00:29:06     -299.779410        0.841733
BFGS:   11 00:29:06     -299.806339        0.830666
BFGS:   12 00:29:06     -299.829111        0.650927
BFGS:   13 00:29:06     -299.848869        0.303813
BFGS:   14 00:29:07     -299.853953        0.320809
BFGS:   15 00:29:07     -299.862267        0.270221
BFGS:   16 00:29:07     -299.867065        0.183407
BFGS:   17 00:29:07     -299.868444        0.088338
BFGS:   18 00:29:08     -299.868933        0.084228
BFGS:   19 00:29:08     -299.869867        0.118104
BFGS:   20 00:29:08     -299.871203        0.171300
      Step     Time          Energy          fmax
BFGS:    0 00:29:08     -297.369492        4.661328
BFGS:    1 00:29:09     -297.835799        4.771240
BFGS:    2 00:29:09     -299.067793        3.799212
BFGS:    3 00:29:09     -299.491882        3.527611
BFGS:    4 00:29:10     -299.642429        1.773966
BFGS:    5 00:29:10     -299.858401        1.562700
BFGS:    6 00:29:10     -300.050463        1.522484
BFGS:    7 00:29:10     -300.119152        1.556659
BFGS:    8 00:29:11     -300.388632        1.248400
BFGS:    9 00:29:11     -300.435350        1.152406
BFGS:   10 00:29:11     -300.516879        0.558384
BFGS:   11 00:29:11     -300.529075        0.437691
BFGS:   12 00:29:11     -300.549905        0.338885
BFGS:   13 00:29:11     -300.558533        0.316050
BFGS:   14 00:29:11     -300.563790        0.208353
BFGS:   15 00:29:11     -300.566452        0.156077
BFGS:   16 00:29:12     -300.569492        0.205082
BFGS:   17 00:29:12     -300.572167        0.207841
BFGS:   18 00:29:12     -300.574783        0.149653
BFGS:   19 00:29:12     -300.576315        0.090148
BFGS:   20 00:29:12     -300.576937        0.063686
      Step     Time          Energy          fmax
BFGS:    0 00:29:13     -296.204191        4.399432
BFGS:    1 00:29:13     -296.714033        4.671739
BFGS:    2 00:29:13     -298.251257        3.005971
BFGS:    3 00:29:13     -297.198546       14.168984
BFGS:    4 00:29:13     -298.436888        1.814460
BFGS:    5 00:29:13     -298.499102        1.038873
BFGS:    6 00:29:14     -298.539901        0.822192
BFGS:    7 00:29:14     -298.548969        0.626537
BFGS:    8 00:29:14     -298.578435        0.533487
BFGS:    9 00:29:15     -298.584656        0.582821
BFGS:   10 00:29:15     -298.642377        1.186704
BFGS:   11 00:29:15     -298.714389        1.962110
BFGS:   12 00:29:15     -298.784256        2.626129
BFGS:   13 00:29:16     -298.842765        2.874603
BFGS:   14 00:29:16     -298.958596        2.787852
BFGS:   15 00:29:16     -299.537665        2.112429
BFGS:   16 00:29:16     -299.599131        1.656809
BFGS:   17 00:29:17     -299.717105        1.292289
BFGS:   18 00:29:17     -299.782467        0.850212
BFGS:   19 00:29:17     -299.818301        0.588351
BFGS:   20 00:29:17     -299.843732        0.441477
      Step     Time          Energy          fmax
BFGS:    0 00:29:18     -296.445622        4.372868
BFGS:    1 00:29:18     -296.918340        4.598026
BFGS:    2 00:29:18     -298.331170        3.255852
BFGS:    3 00:29:18     -297.858677       10.218587
BFGS:    4 00:29:19     -298.583672        1.901932
BFGS:    5 00:29:19     -298.658255        1.265967
BFGS:    6 00:29:19     -298.749821        1.650739
BFGS:    7 00:29:19     -298.819896        1.874858
BFGS:    8 00:29:20     -299.063394        2.006073
BFGS:    9 00:29:20     -299.239021        1.755607
BFGS:   10 00:29:20     -299.290388        1.619739
BFGS:   11 00:29:20     -299.432242        1.272915
BFGS:   12 00:29:21     -299.737995        1.071548
BFGS:   13 00:29:21     -299.830873        0.540086
BFGS:   14 00:29:21     -299.841922        0.394008
BFGS:   15 00:29:21     -299.857773        0.457628
BFGS:   16 00:29:22     -299.873079        0.437069
BFGS:   17 00:29:22     -299.888520        0.517433
BFGS:   18 00:29:22     -299.903192        0.604582
BFGS:   19 00:29:23     -299.917323        0.622562
BFGS:   20 00:29:23     -299.943572        0.798708
      Step     Time          Energy          fmax
BFGS:    0 00:29:23     -296.794018        4.432037
BFGS:    1 00:29:23     -297.245283        4.617009
BFGS:    2 00:29:23     -298.548770        3.656802
BFGS:    3 00:29:23     -298.711786        5.932989
BFGS:    4 00:29:23     -298.993231        1.997023
BFGS:    5 00:29:23     -299.113876        1.875425
BFGS:    6 00:29:24     -299.559437        1.769578
BFGS:    7 00:29:24     -299.743366        1.503299
BFGS:    8 00:29:24     -299.808158        1.138754
BFGS:    9 00:29:24     -299.926115        1.085882
BFGS:   10 00:29:24     -300.043093        1.444689
BFGS:   11 00:29:24     -300.138582        1.560422
BFGS:   12 00:29:25     -300.255549        1.578828
BFGS:   13 00:29:25     -300.359751        1.080218
BFGS:   14 00:29:25     -300.434213        1.180214
BFGS:   15 00:29:25     -300.468399        0.908076
BFGS:   16 00:29:26     -300.518531        0.649393
BFGS:   17 00:29:26     -300.538169        0.301031
BFGS:   18 00:29:26     -300.543986        0.251048
BFGS:   19 00:29:26     -300.554848        0.242652
BFGS:   20 00:29:27     -300.565298        0.199665
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:29:27     -295.246778        1.386110
BFGS:    1 00:29:27     -295.330881        1.258971
BFGS:    2 00:29:27     -295.539388        1.613788
BFGS:    3 00:29:28     -295.581945        0.565996
BFGS:    4 00:29:28     -295.593089        0.538556
BFGS:    5 00:29:28     -295.625373        0.366997
BFGS:    6 00:29:29     -295.630028        0.383348
BFGS:    7 00:29:29     -295.649049        0.403654
BFGS:    8 00:29:29     -295.661554        0.517859
BFGS:    9 00:29:29     -295.678550        0.496301
BFGS:   10 00:29:30     -295.691960        0.702525
BFGS:   11 00:29:30     -295.725683        1.074199
BFGS:   12 00:29:30     -295.753164        0.991153
BFGS:   13 00:29:31     -295.803747        0.617686
BFGS:   14 00:29:31     -295.824011        0.325001
BFGS:   15 00:29:31     -295.833839        0.286885
BFGS:   16 00:29:31     -295.837018        0.325489
BFGS:   17 00:29:32     -295.842899        0.310954
BFGS:   18 00:29:32     -295.847412        0.212880
BFGS:   19 00:29:32     -295.850274        0.114254
BFGS:   20 00:29:32     -295.851548        0.109892
      Step     Time          Energy          fmax
BFGS:    0 00:29:32     -295.316359        1.276262
BFGS:    1 00:29:33     -295.391815        1.166170
BFGS:    2 00:29:33     -295.607534        1.344455
BFGS:    3 00:29:33     -295.639006        0.593872
BFGS:    4 00:29:34     -295.650200        0.491794
BFGS:    5 00:29:34     -295.688240        0.505598
BFGS:    6 00:29:34     -295.694821        0.499011
BFGS:    7 00:29:34     -295.765406        0.622061
BFGS:    8 00:29:35     -295.786820        0.762898
BFGS:    9 00:29:35     -295.802371        0.672365
BFGS:   10 00:29:35     -295.839005        0.566404
BFGS:   11 00:29:35     -295.864207        0.336493
BFGS:   12 00:29:36     -295.870194        0.243005
BFGS:   13 00:29:36     -295.874068        0.253394
BFGS:   14 00:29:36     -295.877770        0.287821
BFGS:   15 00:29:37     -295.882739        0.286885
BFGS:   16 00:29:37     -295.891237        0.271722
BFGS:   17 00:29:37     -295.896600        0.294051
BFGS:   18 00:29:37     -295.901138        0.296216
BFGS:   19 00:29:38     -295.906941        0.327643
BFGS:   20 00:29:38     -295.917645        0.510380
      Step     Time          Energy          fmax
BFGS:    0 00:29:38     -295.579090        0.801818
BFGS:    1 00:29:38     -295.631922        0.756991
BFGS:    2 00:29:39     -295.823796        0.490019
BFGS:    3 00:29:39     -295.836725        0.463710
BFGS:    4 00:29:39     -295.844818        0.469644
BFGS:    5 00:29:39     -295.882008        0.430303
BFGS:    6 00:29:40     -295.891661        0.420214
BFGS:    7 00:29:40     -295.903986        0.420137
BFGS:    8 00:29:40     -295.912741        0.276481
BFGS:    9 00:29:41     -295.919462        0.194658
BFGS:   10 00:29:41     -295.922363        0.198048
BFGS:   11 00:29:41     -295.923906        0.180726
BFGS:   12 00:29:41     -295.925708        0.147673
BFGS:   13 00:29:42     -295.927765        0.103649
BFGS:   14 00:29:42     -295.929222        0.088661
BFGS:   15 00:29:42     -295.929958        0.093031
BFGS:   16 00:29:43     -295.930549        0.084890
BFGS:   17 00:29:43     -295.931386        0.059332
BFGS:   18 00:29:43     -295.932251        0.045124
      Step     Time          Energy          fmax
BFGS:    0 00:29:44     -295.497057        0.953985
BFGS:    1 00:29:44     -295.556506        0.885905
BFGS:    2 00:29:44     -295.761631        0.738145
BFGS:    3 00:29:44     -295.776848        0.464975
BFGS:    4 00:29:45     -295.786970        0.463101
BFGS:    5 00:29:45     -295.818411        0.476784
BFGS:    6 00:29:45     -295.826930        0.416126
BFGS:    7 00:29:45     -295.838737        0.387945
BFGS:    8 00:29:46     -295.847728        0.261180
BFGS:    9 00:29:46     -295.854538        0.183166
BFGS:   10 00:29:46     -295.857373        0.190555
BFGS:   11 00:29:46     -295.859098        0.181437
BFGS:   12 00:29:46     -295.861626        0.169433
BFGS:   13 00:29:47     -295.865051        0.169151
BFGS:   14 00:29:47     -295.868288        0.185708
BFGS:   15 00:29:48     -295.870821        0.203183
BFGS:   16 00:29:48     -295.873948        0.221736
BFGS:   17 00:29:48     -295.880241        0.250656
BFGS:   18 00:29:49     -295.890745        0.259829
BFGS:   19 00:29:49     -295.901654        0.248912
BFGS:   20 00:29:49     -295.913843        0.219113
      Step     Time          Energy          fmax
BFGS:    0 00:29:49     -295.318804        1.269043
BFGS:    1 00:29:49     -295.394619        1.158841
BFGS:    2 00:29:50     -295.610934        1.322010
BFGS:    3 00:29:50     -295.641181        0.602175
BFGS:    4 00:29:50     -295.652740        0.487510
BFGS:    5 00:29:51     -295.691634        0.520529
BFGS:    6 00:29:51     -295.698446        0.510137
BFGS:    7 00:29:51     -295.767542        0.571366
BFGS:    8 00:29:51     -295.783530        0.591065
BFGS:    9 00:29:52     -295.794772        0.562341
BFGS:   10 00:29:52     -295.814525        0.455045
BFGS:   11 00:29:52     -295.833628        0.228725
BFGS:   12 00:29:52     -295.837729        0.182778
BFGS:   13 00:29:53     -295.839289        0.186386
BFGS:   14 00:29:53     -295.840779        0.179842
BFGS:   15 00:29:53     -295.842554        0.154441
BFGS:   16 00:29:53     -295.844284        0.107284
BFGS:   17 00:29:54     -295.845118        0.066125
BFGS:   18 00:29:54     -295.845447        0.065395
BFGS:   19 00:29:54     -295.845711        0.065782
BFGS:   20 00:29:54     -295.846161        0.068323
      Step     Time          Energy          fmax
BFGS:    0 00:29:54     -295.097088        1.721144
BFGS:    1 00:29:55     -295.209103        1.551965
BFGS:    2 00:29:55     -295.393170        2.457042
BFGS:    3 00:29:55     -295.481369        0.463442
BFGS:    4 00:29:55     -295.497665        0.616834
BFGS:    5 00:29:56     -295.523836        0.672748
BFGS:    6 00:29:56     -295.537833        0.441502
BFGS:    7 00:29:56     -295.545695        0.255379
BFGS:    8 00:29:57     -295.550149        0.307918
BFGS:    9 00:29:57     -295.556367        0.292142
BFGS:   10 00:29:57     -295.560162        0.179297
BFGS:   11 00:29:57     -295.561469        0.058853
BFGS:   12 00:29:58     -295.561627        0.018168
      Step     Time          Energy          fmax
BFGS:    0 00:29:58     -295.452871        1.040226
BFGS:    1 00:29:58     -295.516475        0.961272
BFGS:    2 00:29:58     -295.729027        0.880116
BFGS:    3 00:29:59     -295.746829        0.528262
BFGS:    4 00:29:59     -295.758430        0.482842
BFGS:    5 00:29:59     -295.793080        0.522741
BFGS:    6 00:29:59     -295.802377        0.467778
BFGS:    7 00:30:00     -295.817800        0.423553
BFGS:    8 00:30:00     -295.828705        0.286498
BFGS:    9 00:30:00     -295.836653        0.167542
BFGS:   10 00:30:00     -295.839249        0.153103
BFGS:   11 00:30:01     -295.840505        0.131666
BFGS:   12 00:30:01     -295.842063        0.101603
BFGS:   13 00:30:01     -295.843667        0.076375
BFGS:   14 00:30:02     -295.844597        0.072687
BFGS:   15 00:30:02     -295.844987        0.070151
BFGS:   16 00:30:02     -295.845329        0.072084
BFGS:   17 00:30:02     -295.845921        0.075059
BFGS:   18 00:30:02     -295.846783        0.079307
BFGS:   19 00:30:03     -295.847661        0.088944
BFGS:   20 00:30:03     -295.848336        0.103831
      Step     Time          Energy          fmax
BFGS:    0 00:30:03     -295.126440        1.636210
BFGS:    1 00:30:04     -295.231568        1.478340
BFGS:    2 00:30:04     -295.420194        2.295384
BFGS:    3 00:30:04     -295.499512        0.476532
BFGS:    4 00:30:04     -295.514419        0.600778
BFGS:    5 00:30:05     -295.539419        0.608324
BFGS:    6 00:30:05     -295.550903        0.364819
BFGS:    7 00:30:05     -295.557242        0.254037
BFGS:    8 00:30:05     -295.561431        0.296947
BFGS:    9 00:30:06     -295.566745        0.269948
BFGS:   10 00:30:06     -295.570142        0.171482
BFGS:   11 00:30:06     -295.571333        0.074358
BFGS:   12 00:30:06     -295.571575        0.076619
BFGS:   13 00:30:07     -295.571806        0.087324
BFGS:   14 00:30:07     -295.572316        0.107159
BFGS:   15 00:30:07     -295.573363        0.132025
BFGS:   16 00:30:07     -295.575294        0.149460
BFGS:   17 00:30:08     -295.578274        0.162605
BFGS:   18 00:30:08     -295.583958        0.353204
BFGS:   19 00:30:08     -295.594529        0.728996
BFGS:   20 00:30:08     -295.596406        1.082987
      Step     Time          Energy          fmax
BFGS:    0 00:30:08     -295.356914        1.215331
BFGS:    1 00:30:09     -295.428373        1.114580
BFGS:    2 00:30:09     -295.646915        1.195759
BFGS:    3 00:30:09     -295.673089        0.597251
BFGS:    4 00:30:09     -295.684953        0.465592
BFGS:    5 00:30:10     -295.726074        0.564887
BFGS:    6 00:30:10     -295.734480        0.548503
BFGS:    7 00:30:10     -295.799348        0.635039
BFGS:    8 00:30:11     -295.819701        0.577027
BFGS:    9 00:30:11     -295.833378        0.496449
BFGS:   10 00:30:11     -295.843284        0.418053
BFGS:   11 00:30:12     -295.857579        0.270354
BFGS:   12 00:30:12     -295.865854        0.199394
BFGS:   13 00:30:12     -295.869641        0.202553
BFGS:   14 00:30:12     -295.871633        0.193532
BFGS:   15 00:30:12     -295.874890        0.200686
BFGS:   16 00:30:13     -295.880200        0.222904
BFGS:   17 00:30:13     -295.887295        0.255187
BFGS:   18 00:30:13     -295.893396        0.293479
BFGS:   19 00:30:14     -295.899289        0.321858
BFGS:   20 00:30:14     -295.907286        0.350164
      Step     Time          Energy          fmax
BFGS:    0 00:30:14     -295.479672        1.042600
BFGS:    1 00:30:14     -295.539579        0.973263
BFGS:    2 00:30:15     -295.756504        0.801647
BFGS:    3 00:30:15     -295.774074        0.521180
BFGS:    4 00:30:15     -295.786727        0.546268
BFGS:    5 00:30:16     -295.834230        0.613848
BFGS:    6 00:30:16     -295.851211        0.646566
BFGS:    7 00:30:16     -295.882716        0.794025
BFGS:    8 00:30:16     -295.911620        0.648668
BFGS:    9 00:30:17     -295.934177        0.353896
BFGS:   10 00:30:17     -295.944416        0.334291
BFGS:   11 00:30:17     -295.949138        0.288750
BFGS:   12 00:30:18     -295.953405        0.226482
BFGS:   13 00:30:18     -295.958039        0.155823
BFGS:   14 00:30:18     -295.961126        0.135680
BFGS:   15 00:30:18     -295.962491        0.139650
BFGS:   16 00:30:19     -295.963450        0.119113
BFGS:   17 00:30:19     -295.964681        0.076201
BFGS:   18 00:30:19     -295.965907        0.050940
BFGS:   19 00:30:20     -295.966596        0.039461

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:30:20     -303.673626        0.658667
BFGS:    1 00:30:20     -303.686532        0.434309
BFGS:    2 00:30:20     -303.706071        0.315086
BFGS:    3 00:30:21     -303.711959        0.262217
BFGS:    4 00:30:21     -303.717482        0.237992
BFGS:    5 00:30:21     -303.720238        0.208929
BFGS:    6 00:30:22     -303.723166        0.166086
BFGS:    7 00:30:22     -303.725384        0.140110
BFGS:    8 00:30:22     -303.726731        0.109240
BFGS:    9 00:30:22     -303.727633        0.102350
BFGS:   10 00:30:23     -303.728629        0.136197
BFGS:   11 00:30:23     -303.730049        0.178287
BFGS:   12 00:30:23     -303.732102        0.209106
BFGS:   13 00:30:24     -303.735037        0.264229
BFGS:   14 00:30:24     -303.740565        0.462763
BFGS:   15 00:30:24     -303.755036        1.063605
BFGS:   16 00:30:25     -303.774628        1.947622
BFGS:   17 00:30:25     -303.813209        2.522324
BFGS:   18 00:30:25     -303.952090        2.445241
BFGS:   19 00:30:25     -304.087197        1.945546
BFGS:   20 00:30:26     -304.204518        1.378058
BFGS:   21 00:30:26     -304.302131        0.670090
BFGS:   22 00:30:26     -304.342030        0.905684
BFGS:   23 00:30:26     -304.367183        0.474115
BFGS:   24 00:30:27     -304.383592        0.315101
BFGS:   25 00:30:27     -304.390626        0.219615
BFGS:   26 00:30:27     -304.396724        0.154036
BFGS:   27 00:30:27     -304.399920        0.178781
BFGS:   28 00:30:28     -304.403333        0.149781
BFGS:   29 00:30:28     -304.405983        0.125925
BFGS:   30 00:30:28     -304.408064        0.119573
BFGS:   31 00:30:29     -304.409430        0.104489
BFGS:   32 00:30:29     -304.410719        0.112591
BFGS:   33 00:30:29     -304.412252        0.099010
BFGS:   34 00:30:30     -304.413919        0.076665
BFGS:   35 00:30:30     -304.415272        0.054679
BFGS:   36 00:30:30     -304.415969        0.061353
BFGS:   37 00:30:31     -304.416284        0.062908
BFGS:   38 00:30:31     -304.416592        0.056424
BFGS:   39 00:30:31     -304.416991        0.041166
      Step     Time          Energy          fmax
BFGS:    0 00:30:32     -302.820027        1.134716
BFGS:    1 00:30:32     -302.870494        0.839374
BFGS:    2 00:30:32     -302.915229        0.653662
BFGS:    3 00:30:33     -302.935595        0.592096
BFGS:    4 00:30:33     -302.980467        1.012411
BFGS:    5 00:30:33     -303.038377        1.445125
BFGS:    6 00:30:33     -303.128651        1.667471
BFGS:    7 00:30:34     -303.284516        1.908137
BFGS:    8 00:30:34     -303.594732        2.294013
BFGS:    9 00:30:34     -303.822156        2.496959
BFGS:   10 00:30:35     -304.008374        3.049098
BFGS:   11 00:30:35     -304.215300        2.201370
BFGS:   12 00:30:35     -304.370278        1.284830
BFGS:   13 00:30:36     -304.479168        0.833366
BFGS:   14 00:30:36     -304.517337        0.575713
BFGS:   15 00:30:36     -304.547452        0.513490
BFGS:   16 00:30:36     -304.576141        0.425423
BFGS:   17 00:30:37     -304.592133        0.436811
BFGS:   18 00:30:37     -304.604583        0.437219
BFGS:   19 00:30:37     -304.622221        0.491163
BFGS:   20 00:30:37     -304.636812        0.332030
BFGS:   21 00:30:38     -304.644364        0.189140
BFGS:   22 00:30:38     -304.648853        0.208574
BFGS:   23 00:30:38     -304.653639        0.268040
BFGS:   24 00:30:38     -304.659605        0.283506
BFGS:   25 00:30:39     -304.666029        0.207264
BFGS:   26 00:30:39     -304.670831        0.149985
BFGS:   27 00:30:39     -304.673573        0.117888
BFGS:   28 00:30:40     -304.675191        0.090852
BFGS:   29 00:30:40     -304.676659        0.145741
BFGS:   30 00:30:40     -304.678507        0.076799
BFGS:   31 00:30:40     -304.680114        0.058865
BFGS:   32 00:30:41     -304.680839        0.059570
BFGS:   33 00:30:41     -304.681094        0.047492
      Step     Time          Energy          fmax
BFGS:    0 00:30:41     -303.418019        0.955475
BFGS:    1 00:30:41     -303.449211        0.767120
BFGS:    2 00:30:41     -303.508529        0.606610
BFGS:    3 00:30:42     -303.532047        0.661937
BFGS:    4 00:30:42     -303.577831        0.745530
BFGS:    5 00:30:42     -303.615900        0.861892
BFGS:    6 00:30:43     -303.676158        1.132612
BFGS:    7 00:30:43     -303.778314        1.674896
BFGS:    8 00:30:43     -303.894172        1.824528
BFGS:    9 00:30:43     -304.060011        1.170296
BFGS:   10 00:30:43     -304.156806        1.183621
BFGS:   11 00:30:44     -304.222579        1.063122
BFGS:   12 00:30:44     -304.280315        0.755171
BFGS:   13 00:30:44     -304.318913        0.620245
BFGS:   14 00:30:44     -304.375837        0.585192
BFGS:   15 00:30:45     -304.398336        0.421793
BFGS:   16 00:30:45     -304.421991        0.482626
BFGS:   17 00:30:45     -304.438978        0.398801
BFGS:   18 00:30:46     -304.450479        0.232265
BFGS:   19 00:30:46     -304.455653        0.234534
BFGS:   20 00:30:46     -304.461156        0.245440
BFGS:   21 00:30:46     -304.468820        0.253095
BFGS:   22 00:30:47     -304.477126        0.267373
BFGS:   23 00:30:47     -304.484218        0.214204
BFGS:   24 00:30:47     -304.489091        0.207629
BFGS:   25 00:30:47     -304.492262        0.196359
BFGS:   26 00:30:48     -304.495699        0.154517
BFGS:   27 00:30:48     -304.499309        0.094953
BFGS:   28 00:30:49     -304.501651        0.067170
BFGS:   29 00:30:49     -304.502724        0.093425
BFGS:   30 00:30:49     -304.503348        0.101196
BFGS:   31 00:30:49     -304.503892        0.085769
BFGS:   32 00:30:50     -304.504480        0.051689
BFGS:   33 00:30:50     -304.505046        0.068805
BFGS:   34 00:30:50     -304.505440        0.069565
BFGS:   35 00:30:50     -304.505706        0.054634
BFGS:   36 00:30:51     -304.505961        0.031625
      Step     Time          Energy          fmax
BFGS:    0 00:30:51     -302.886625        1.726571
BFGS:    1 00:30:51     -302.947513        0.985340
BFGS:    2 00:30:52     -302.976151        0.436827
BFGS:    3 00:30:52     -302.986262        0.560898
BFGS:    4 00:30:52     -303.005217        0.724258
BFGS:    5 00:30:52     -303.025896        0.727683
BFGS:    6 00:30:53     -303.047988        0.601983
BFGS:    7 00:30:53     -303.072643        0.519921
BFGS:    8 00:30:53     -303.094872        0.526790
BFGS:    9 00:30:54     -303.115510        0.672024
BFGS:   10 00:30:54     -303.152475        0.780562
BFGS:   11 00:30:54     -303.181390        0.602687
BFGS:   12 00:30:55     -303.202158        0.480652
BFGS:   13 00:30:55     -303.228274        0.676791
BFGS:   14 00:30:55     -303.264464        0.911118
BFGS:   15 00:30:56     -303.325679        1.149601
BFGS:   16 00:30:56     -303.389288        1.215409
BFGS:   17 00:30:56     -303.446438        1.036971
BFGS:   18 00:30:56     -303.472255        0.910584
BFGS:   19 00:30:57     -303.555125        0.631961
BFGS:   20 00:30:57     -303.598677        0.410295
BFGS:   21 00:30:57     -303.616505        0.340547
BFGS:   22 00:30:58     -303.628045        0.321058
BFGS:   23 00:30:58     -303.634796        0.268246
BFGS:   24 00:30:58     -303.642478        0.130818
BFGS:   25 00:30:59     -303.644590        0.080197
BFGS:   26 00:30:59     -303.645175        0.066474
BFGS:   27 00:30:59     -303.645828        0.067453
BFGS:   28 00:31:00     -303.646401        0.080190
BFGS:   29 00:31:00     -303.646855        0.080937
BFGS:   30 00:31:00     -303.647114        0.058612
BFGS:   31 00:31:01     -303.647283        0.035627
/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)
      Step     Time          Energy          fmax
BFGS:    0 00:31:10     -302.692306        3.677165
BFGS:    1 00:31:11     -302.889385        3.067314
BFGS:    2 00:31:11     -303.395073        8.749130
BFGS:    3 00:31:12     -303.421852        1.844280
BFGS:    4 00:31:13     -303.550935        1.513267
BFGS:    5 00:31:14     -303.677211        1.033334
BFGS:    6 00:31:14     -303.703623        0.748289
BFGS:    7 00:31:15     -303.752856        0.717794
BFGS:    8 00:31:16     -303.765163        0.639361
BFGS:    9 00:31:17     -303.786860        0.471171
BFGS:   10 00:31:18     -303.793875        0.415430
BFGS:   11 00:31:18     -303.801504        0.427616
BFGS:   12 00:31:19     -303.804585        0.404154
BFGS:   13 00:31:20     -303.805828        0.385085
BFGS:   14 00:31:21     -303.804989        0.384217
BFGS:   15 00:31:22     -303.801739        0.366904
BFGS:   16 00:31:22     -303.796394        0.378553
BFGS:   17 00:31:23     -303.788950        0.470406
BFGS:   18 00:31:24     -303.782910        0.524321
BFGS:   19 00:31:25     -303.779950        0.545773
BFGS:   20 00:31:25     -303.779181        0.639217
BFGS:   21 00:31:26     -303.777527        0.882158
BFGS:   22 00:31:27     -303.777826        0.750091
BFGS:   23 00:31:28     -303.787905        0.502514
BFGS:   24 00:31:29     -303.802737        0.587940
BFGS:   25 00:31:29     -303.809602        0.536357
BFGS:   26 00:31:30     -303.811025        0.445451
BFGS:   27 00:31:31     -303.809945        0.399211
BFGS:   28 00:31:32     -303.806861        0.283553
BFGS:   29 00:31:32     -303.803467        0.303203
BFGS:   30 00:31:33     -303.800861        0.324519

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_10279/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")
<Figure size 640x480 with 1 Axes>

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")