============ UMA HCN band ============ This tutorial runs ``gprn``, the double-ended band driver, on the isomerisation of hydrogen cyanide to hydrogen isocyanide (HCN to HNC) with the UMA-S-1.1 neural-network potential, task head ``omol``. The barrier, about 2 eV, is large enough that a straight line between the endpoints is a poor start and the surrogate has real work to do. Three parts of the page depend on what your build and machine have: - Steps 1 and 3 need only this repository. They run in the documentation test and assert their output. - Step 2 calls UMA. It needs a build with the UMA engine, the engine's libraries on the loader path and a model package. The block is gated on ``GPRIDGE_UMA_MODEL`` and the documentation test skips it when the variable is unset. No UMA run is part of the test, so the UMA numbers below are recorded results of the published runs, not output of this page. - A plain checkout has none of this. ``gprn --list-potentials`` lists ``uma`` as ``not compiled``, the repository ships no ``.pt2`` package, and ``--potential uma`` on such a build prints ``Potential unavailable: uma`` and exits with status 1. What you need ------------- A gprn with the UMA engine ~~~~~~~~~~~~~~~~~~~~~~~~~~ UMA runs through the engine plugin ``libuma_engine.so``, which ``gprn`` loads when ``--oracle-path`` is ``engine``, the default for UMA. That path needs Cap'n Proto in the ``gprn`` build. The build options are ``-Duse_rgpot_uma=true`` and ``-Duse_capnp=true`` (with ``-Duse_readcon=true`` and ``-Duse_anneal=enabled``, as for every build in the :doc:`Installation page <../getting-started/installation>`). The tested route is ``bench/determinism/build_uma.sh``. It runs inside the ``scalapack`` pixi environment (CPU torch 2.8, metatomic, static OpenBLAS), uses GCC, and builds both ``gprn`` and ``libuma_engine.so``: .. code:: bash PATH=$HOME/.pixi/bin:$PATH bench/determinism/build_uma.sh . build-uma The check below lists the potentials of the binary on ``PATH``. A UMA build lists ``uma`` as ``compiled``; a plain build lists it as ``not compiled``. .. code:: bash gprn --list-potentials | grep -E '^uma' The engine's libraries ~~~~~~~~~~~~~~~~~~~~~~ ``libuma_engine.so`` is linked against libtorch (``libtorch_cpu.so``, ``libc10.so``), which is not on the default loader path. The engine in the archive's runtime tarball is also linked against Cap'n Proto 1.4.0, and Cap'n Proto 1.0.1 from a distribution package cannot stand in for it. ``gprn`` looks for the engine in ``--engine-dir``, then in the colon-separated ``RGPOT_ENGINE_PATH``, then in ``../lib``, ``../lib64`` and the directory of the executable, and in the build tree's ``subprojects/rgpot`` directory. The environment that the determinism harness sets for a ``build_uma.sh`` build (``bench/determinism/run_uma_cells.py``, function ``environment``) is: .. code:: bash BUILD=$PWD/build-uma PREFIX=$PWD/.pixi/envs/scalapack SITE=$PREFIX/lib/python3.12/site-packages export RGPOT_ENGINE_PATH=$BUILD/subprojects/rgpot/CppCore/rgpot/UmaPot export LD_LIBRARY_PATH=$BUILD:$RGPOT_ENGINE_PATH:$PREFIX/lib:$SITE/torch/lib:$SITE/metatensor/lib:$SITE/metatensor/torch/torch-2.8/lib:$SITE/metatomic/torch/torch-2.8/lib:$SITE/vesin/lib ldd "$RGPOT_ENGINE_PATH/libuma_engine.so" | grep -E 'not found' || echo "all libraries found" A run that has loaded the engine prints ``[startup] oracle path=engine potential=uma`` near the top of the log. A build without Cap'n Proto prints ``[startup] oracle path=direct potential=uma reason``"default: this binary has no Cap'n Proto"= instead, and then fails. The model ~~~~~~~~~ UMA takes an exported AOTInductor package, a ``.pt2`` file, not a TorchScript ``.pt`` model. Each package is exported for one composition, charge and spin, so HCN has its own. Set ``GPRIDGE_UMA_MODEL`` to its path. There are two sources. The archived package is in the Zenodo record `10.5281/zenodo.23776354 `_, which is the dataset cited in ``CITATION.cff``. The record holds one archive, ``gpridge-jcim-repro-2026.10.29.tar.gz`` (1,906,525,901 bytes, SHA-256 ``d34a9b057e8c4eeb818b1feaae129d08f05924f8eaf439d41c1697700c52e2d4``). The member ``data/uma/baker24_fr/01_hcn.pt2`` is 29,271,737 bytes with SHA-256 ``493e1c88a793409ddf3d912cb99e4b459b78613418ca1c164e4b8243986d586e``. The members have no leading directory. The extraction reads the whole compressed archive: .. code:: bash tar -xzf gpridge-jcim-repro-2026.10.29.tar.gz data/uma/baker24_fr/01_hcn.pt2 echo "493e1c88a793409ddf3d912cb99e4b459b78613418ca1c164e4b8243986d586e data/uma/baker24_fr/01_hcn.pt2" | sha256sum -c export GPRIDGE_UMA_MODEL=$PWD/data/uma/baker24_fr/01_hcn.pt2 To export a package yourself, use ``scripts/export_uma_aoti.py`` of the rgpot subproject (present under ``subprojects/rgpot`` after the first ``meson setup``), which the ``umaexport`` pixi environment of that project runs; its how-to is ``subprojects/rgpot/docs/orgmode/howto/uma-export.org``. It needs the UMA checkpoint, which you obtain from the model's publisher. Check an exported package with ``bench/determinism/check_package.py PACKAGE.pt2 GEOMETRY.con``. The pinned rgpot is ``4a5a7321`` (``subprojects/rgpot.wrap``) and contains ``ef558571``, which makes the AOTI export deterministic. A package exported with several OpenMP threads by an exporter without that commit gives a different result on every call. The UMA license ~~~~~~~~~~~~~~~ The UMA weights come under the FAIR Chemistry License v1 (May 14, 2025) and its acceptable-use policy. The archive's README states that the compiled UMA packages keep that license and that the deposit does not relicense them. The two texts are in the archive as ``analysis/publication/UMA-LICENSE.txt`` and ``analysis/publication/UMA-USE-POLICY.txt``. Read them before you use or pass on a package. Step 1: the endpoints --------------------- The repository ships three endpoint sets for the Baker systems: - ``bench_data/baker/endpoints/`` holds the PET-MAD v1.1.0 relaxed geometries from Materials Cloud. The :doc:`quickstart <../getting-started/quickstart>` uses them. - ``bench_data/baker/endpoints-uma/`` holds the same geometries relaxed with UMA-S-1.1 (``omol``) to a force of 0.0514221 eV/Angstrom (``manifest.json`` in that directory). - ``bench_data/baker/endpoints-irc/`` holds the endpoints derived from UMA IRC walks (``bench_data/baker/dest_irc_uma.json``). The published runs start from this set, and it is the one used here. The files of ``endpoints-irc/01_hcn`` are byte-identical to the inputs of the published HCN band run, which records their SHA-256 sums in ``results/gpridge-0.5.0-baker-r1/baker/01_hcn/result.json`` in the Zenodo archive. The block copies them and checks the sums. .. code:: bash cp "$GPRIDGE_ROOT/bench_data/baker/endpoints-irc/01_hcn/reactant.con" reactant.con cp "$GPRIDGE_ROOT/bench_data/baker/endpoints-irc/01_hcn/product.con" product.con cat > endpoints.sha256 <<'EOF' f1d6681a16a42a21001cc9824acea42d3a26da2da8a9e7c52c506761b2750642 reactant.con 189929ff68a86eba136caf218ab3340703cfa909ae0aa82d3c1ecc380a2d406b product.con EOF sha256sum -c endpoints.sha256 :: reactant.con: OK product.con: OK A ``.con`` file holds one structure. These two have a cell of :math:`0 \times 0 \times 0` Angstrom, which means no cell, so the runs below pass ``--gp-nonperiodic true``. The next block reads both files and prints the bond lengths, which shows that the hydrogen atom moves from the carbon end to the nitrogen end. .. code:: bash cat > bonds.py <<'EOF' import math import sys for path in sys.argv[1:]: lines = open(path).read().splitlines() n_types = int(lines[6].split()[0]) counts = [int(c) for c in lines[7].split()[:n_types]] symbols, xyz, j = [], [], 9 for count in counts: symbols += [lines[j]] * count xyz += [[float(v) for v in row.split()[:3]] for row in lines[j + 2:j + 2 + count]] j += 2 + count pairs = [(0, 1), (0, 2), (1, 2)] text = ", ".join(f"{symbols[a]}-{symbols[b]} {math.dist(xyz[a], xyz[b]):.3f}" for a, b in pairs) print(f"{path}: {text} Angstrom") EOF python3 bonds.py reactant.con product.con :: reactant.con: C-N 1.144, C-H 1.067, N-H 2.211 Angstrom product.con: C-N 1.163, C-H 2.160, N-H 0.997 Angstrom Step 2: the band ---------------- The command needs the UMA setup above. ``GPRIDGE_UMA_MODEL`` holds the path of the ``01_hcn.pt2`` package. - ``--potential uma`` selects UMA. ``--model`` is the package, ``--device cpu`` runs it on the CPU, and ``--task-name omol`` is the task head (the default). ``--uma-charge 0`` and ``--uma-spin 1`` give the total charge and the spin multiplicity of HCN (both are the defaults). - ``--gp-nonperiodic true`` treats the molecule as isolated and ignores the CON vacuum box, which these files do not have anyway. - ``--nimages 18`` puts 18 movable images between the endpoints, a band of 20 frames, as in the published run. - ``--idpp true`` builds the starting band by image-dependent pair potential interpolation. A straight line moves the hydrogen atom through the heavy atoms. - ``--converged-force 0.0514221`` is the convergence limit on the true force, in eV/Angstrom. It is 0.001 hartree/bohr, the tolerance of the published runs. - ``--gp-model-profile gprd_zbl --gp-zbl-prior-mean true`` are the GP settings of the published UMA runs. - ``--output band.h5`` and ``--write-con band.con`` name the result files. ``--gp-observation-archive`` defaults to ``auto``, so the archive of every oracle evaluation goes to ``obs-archive`` next to ``band.h5``. .. code:: bash test -s "$GPRIDGE_UMA_MODEL" gprn --reactant reactant.con --product product.con \ --potential uma --model "$GPRIDGE_UMA_MODEL" \ --device cpu --task-name omol --uma-charge 0 --uma-spin 1 \ --gp-nonperiodic true \ --nimages 18 --idpp true --converged-force 0.0514221 \ --gp-model-profile gprd_zbl --gp-zbl-prior-mean true \ --output band.h5 --write-con band.con > gprn.log 2>&1 grep -E '^(Oracle calls:|Barrier energy|Reverse barrier|Converged:|Certified:|IRC certificate record)' gprn.log test -s band.con ``gprn`` exits with status 0 when the run converged and 2 otherwise, so the block fails on a run that did not converge. The flag list is shorter than the one of the published runs, whose full list is in the archive. This page does not claim that your call count equals theirs. To replay the published run itself, follow :doc:`Reproducing the paper <../howto/reproducing>` and ``bench/determinism/README.md``. Step 3: read the result ----------------------- A run writes four things: - ``gprn.log``, the run log. The summary lines at its end are the ones the grep above prints. - ``band.con``, the final band as 20 frames. Each frame header carries the image's energy in eV, its ``neb_bead`` index and its ``role``, and the forces section holds the forces. The first frame also carries the run summary under ``neb_summary`` (barriers, oracle calls, convergence), and ``band.con.corpus`` holds the same frames as a readcon-db corpus. An image the oracle did not evaluate carries the surrogate's prediction instead of an oracle energy. :doc:`The pentamer tutorial ` checks this on a Lennard-Jones band. - ``band.h5``, the per-outer GP trace (schema ``gprn-gp-trace/2``). ``--trace-band-history true`` adds a global posterior snapshot per outer iteration, ``--full-h5 true`` writes the band, the run summary and the training set instead (schema ``neb-band/1``), and ``--gp-trace false`` leaves the file out. - ``obs-archive/``, every energy and gradient the oracle returned, the training set of the surrogate. With the IRC certificate on, which is the default, it also holds ``irc_certificate.txt``. The log line ``IRC certificate record:`` prints the path. With ``--gp-observation-archive off`` the record goes to ``./irc_certificate.txt``. The lines to read are ``Converged: yes``, which says the true force on the climbing image fell below the limit, and ``Certified: yes``, which says the IRC walk from the saddle reached the reactant and the product (see :doc:`Get an IRC certificate for a saddle <../howto/irc_certificate>`). ``Barrier energy (eV)`` is the highest image above the reactant, and ``Reverse barrier (eV)`` is the highest image above the product. The published HCN band run is on record. Its log, in the Zenodo archive as ``results/gpridge-0.5.0-baker-r1/baker/01_hcn/band/gprn.log``, reads :: Oracle calls (to convergence): 25 (endpoints=2, initial=18, outer=5, dimer=0, certificate=0, transition=0) Oracle calls (with validation): 44 (validation=19) Oracle calls: 44 (neb=44, dimer=0, certificate=0, transition=0) Barrier energy (eV): 2.03374 (forward: E_saddle - E_reactant) Reverse barrier (eV): 1.49633 (E_saddle - E_product) Converged: yes Certified: yes The 19 validation calls are the Cartesian stencil that run measured at its saddle because it passed ``--oracle-stencil``; the command above does not, so a run of it has none. The run used 0.0514221 eV/Angstrom, 18 images and the archived ``endpoints-irc`` pair, with the longer flag list. The repository also keeps the band it wrote, ``paper/jcim/records/band/hcn/band.con``. The block below reads the energy of every frame of a band file, prints the barriers, and asserts the recorded ones. .. code:: bash cat > barrier.py <<'EOF' # /// script # requires-python = ">=3.11" # dependencies = ["readcon-chemfiles>=0.23.2,<0.24"] # /// import sys import readcon energies = [frame.energy for frame in readcon.read_con(sys.argv[1])] top = max(range(len(energies)), key=energies.__getitem__) print(f"{len(energies)} frames, highest frame {top}") print(f"forward barrier {energies[top] - energies[0]:.5f} eV") print(f"reverse barrier {energies[top] - energies[-1]:.5f} eV") print(f"reaction energy {energies[-1] - energies[0]:.5f} eV") EOF uv run --script barrier.py "$GPRIDGE_ROOT/paper/jcim/records/band/hcn/band.con" :: 20 frames, highest frame 7 forward barrier 2.03374 eV reverse barrier 1.49633 eV reaction energy 0.53741 eV Run the same script on your ``band.con``. Compare its barrier with 2.03374 eV. Both runs use the same potential and the same endpoints, so a difference measures how well each run located the saddle. .. code:: bash uv run --script barrier.py band.con The UMA energies are total energies, about -2542 eV for this molecule, and only differences mean anything. The UMA-relaxed endpoints of ``bench_data/baker/endpoints-uma/manifest.json`` have energies of -2542.43395 eV and -2541.89654 eV, which gives the same reaction energy, 0.53741 eV. What to try next ---------------- - :doc:`The UMA HCN dimer ` refines the saddle of this band with ``gprd``. - :doc:`Run a GP-NEB band <../howto/gpneb>` covers the acquisition and trust options. - :doc:`Check run-to-run determinism <../howto/determinism>` explains what repeats between runs. - :doc:`Run on an HPC cluster <../howto/hpc>` and :doc:`Run a search across MPI ranks <../howto/mpi>` cover larger jobs.