============================================== Run a Baker-24 cell with an external potential ============================================== This page shows how to build ``gprn`` with an external potential, fetch the PET-MAD checkpoint, and run one cell of the Baker-24 reaction set with the classic GP-OIE settings. The 24 cells are the label directories under ``bench_data/baker/endpoints/``, each with a ``reactant.con`` and a ``product.con``. The recorded results of the publication runs, and the script that replays them, are in :doc:`Reproduce the paper's results `. For the options of a band run, see :doc:`Run a GP-NEB band `. What you need ------------- - A clone of the repository and ``pixi``. - A C++ toolchain and the dependencies that the ``scalapack`` pixi environment installs (``pixi.toml``, ``[feature.scalapack.dependencies]`` and ``[feature.scalapack.pypi-dependencies]``): OpenMPI, ScaLAPACK, Rust, libclang, and PyTorch with metatomic, metatensor and vesin. - For the PET-MAD runs, a network connection to fetch the checkpoint. Build gprn with external potentials ----------------------------------- The pixi tasks of the ``scalapack`` environment call ``scripts/setup_gprn_external.sh``. .. code:: bash pixi install -e scalapack pixi run -e scalapack build-gprn-external ``setup-gprn-external`` configures the build only, and ``build-gprn-external`` configures and compiles the ``gprn`` target. The script runs ``meson setup`` with ``-Dlinalg_backend=scalapack``, ``-Duse_readcon=true``, ``-Duse_capnp=true``, ``-Duse_hdf5=true``, ``-Duse_rgmin=enabled`` and ``-Ddo_install=false``. The rgpot provider switches follow environment variables: .. table:: +-------------------------------+---------+---------------------------+ | Variable | Default | Meson option | +===============================+=========+===========================+ | ``GPR_GPRN_ENABLE_METATOMIC`` | 1 | ``-Duse_rgpot_metatomic`` | +-------------------------------+---------+---------------------------+ | ``GPR_GPRN_ENABLE_XTB`` | 1 | ``-Duse_rgpot_xtb`` | +-------------------------------+---------+---------------------------+ | ``GPR_GPRN_ENABLE_NWCHEM`` | 0 | ``-Duse_rgpot_nwchem`` | +-------------------------------+---------+---------------------------+ With metatomic enabled the script writes a Meson native file with the torch, metatensor, metatomic and vesin include and CMake paths of the active pixi environment (``scripts/write_torch_native_file.py``). ``GPR_GPRN_BUILD_DIR`` (default ``bld-gprn``) and ``GPR_GPRN_NATIVE_FILE`` (default ``.pixi/gprn-external-native.ini``) choose the paths. The binary is ``bld-gprn/gprn``. ``smoke-gprn-lj`` builds ``gprn`` with the metatomic, xTB and NWChem providers off and runs a three-image band on a two-atom system with the Lennard-Jones potential. The task passes when the HDF5 result exists and is not empty. .. code:: bash pixi run -e scalapack smoke-gprn-lj SLATE builds use two other tasks of the same environment. ``build-slate-prefix`` builds a tagged SLATE release into ``~/.cache/gpridge/slate/prefix-``. ``build-slate`` depends on it and configures ``build-slate-real`` with ``-Dlinalg_backend=slate``, the metatomic provider and the Cap'n Proto option, then builds it with ``ninja``. The ``build-scalapack-real`` task does the same with ``-Dlinalg_backend=scalapack`` in ``build-scalapack-real`` and builds the ``gprd`` and ``gprn`` targets. Check which potentials a build has ---------------------------------- ``gprn --list-potentials`` prints one row per potential, with a tab-separated column that says whether the direct backend is compiled. The block below checks that the Lennard-Jones backend is present in whatever ``gprn`` is on the path. .. code:: bash gprn --list-potentials | awk -F'\t' '$1 == "lj" { print $2 }' The ``metatomic`` row reads ``compiled`` in a build that has the rgpot metatomic provider. A row that reads ``not compiled`` lists the requirement, for example ``rgpot metatomic support``. ``--potential metatomic`` needs ``--model PATH`` with a ``.pt`` model file, and ``--device`` selects ``cpu`` (default) or ``cuda``. Fetch the PET-MAD checkpoint ---------------------------- .. code:: bash pixi run -e petmad-assets prepare-petmad-model The task runs ``scripts/prepare_petmad_assets.py --skip-config``, which fetches PET-MAD through ``upet.save_upet`` and writes the exported model. The default output directory is ``bench_data/petmad/``, and the file name is ``pet-mad-s-v1.5.0.pt`` (the constants ``PETMAD_SIZE`` and ``PETMAD_VERSION`` in the script). The checkpoint is not stored in the repository. The baseline run recorded in ``bench_data/baker/manifest.json`` uses a different file, ``pet-mad-v1.1.0.pt``, with the SHA-256 and the download URL the manifest lists under ``model``. Use that file when you reproduce a recorded run, and the file from ``prepare-petmad-model`` for a new run. Run a cell ---------- The command below runs the HCN cell. The block runs only when ``GPRIDGE_PETMAD_MODEL`` names a checkpoint, and it needs a ``gprn`` built with the metatomic provider. .. code:: bash test -s "$GPRIDGE_PETMAD_MODEL" bld-gprn/gprn \ --reactant bench_data/baker/endpoints/01_hcn/reactant.con \ --product bench_data/baker/endpoints/01_hcn/product.con \ --nimages 8 \ --potential metatomic --model "$GPRIDGE_PETMAD_MODEL" \ --nebmode gp_oie \ --gp-model-profile gprd_zbl \ --acquisition max_variance \ --gp-nonperiodic true \ --use-mmf false \ --band-refinements 1 \ --first-attempt-wall-seconds 180 \ --output baker01.h5 --write-con baker01.con test -s baker01.con The options do the following. Defaults are those of ``gprn --help``. - ``--nimages 8`` is the default, and it gives a band of ten images. - ``--gp-model-profile gprd_zbl`` selects the classic joint energy-force model; the default profile is ``extended``. - ``--acquisition max_variance`` selects the image with the highest posterior force variance; the default rule is ``tpe``. - ``--gp-nonperiodic true`` treats the molecule as isolated, independently of the vacuum box in the ``.con`` file, and the default is ``false``. ``--molecular-rigid-motion true`` (default ``false``) also removes whole-molecule translation and rotation from the band of an isolated, fully free molecule. - ``--use-mmf false`` is the default; it keeps the dimer-burst controller off the climbing image. - ``--band-refinements 1`` allows one refinement pass. A converged band that fails the certificate of the climbing-image neighbourhood is retried with twice the number of images. The default is 0. - ``--first-attempt-wall-seconds 180`` limits the first attempt to 180 s so that a slow band yields to the refinement. The default 0 uses ``--max-wall-seconds`` unchanged. - ``--band-certificate-force-scale F`` adds a perpendicular true-force threshold in eV/Angstrom at the neighbours of the climbing image. Its default, 0, disables the requirement. The block below compares the defaults named above with the ``gprn`` on your path. .. code:: bash fail=0 help=$(gprn --help) || { echo "gprn --help failed"; exit 1; } while IFS='|' read -r flag text; do lines=$(printf '%s\n' "$help" | grep -E -- "^ +$flag " || true) printf '%s\n' "$lines" | grep -- "$text" >/dev/null || { echo "mismatch: $flag"; fail=1; } done <<'EOF' --band-refinements|Default 0. --first-attempt-wall-seconds|Default 0. --use-mmf|Default false. --spring-constant|Default 5.0 --spring-constant-min|Default -1. --climbing-image-converged-only|Default true. --sidpp|(eOn default) --band-certificate-force-scale|Default 0. --device|Default cpu. EOF test "$fail" = 0 && echo ok The manifest records the configuration of its baseline run under ``baseline.configuration``: eight intermediate images (ten in total), a force tolerance of 0.05 eV/Angstrom, ``climbing_image_converged_only`` true, the ``sidpp`` initializer, a spring constant of 9.72 eV/Angstrom^2 at the maximum and 0.972 eV/Angstrom^2 at the minimum, and PET-MAD v1.1.0. In ``gprn`` the force tolerance, the converged-only rule and the SIDPP seeding are the defaults (``--converged-force 0.05``, ``--climbing-image-converged-only true``, ``--sidpp true``). The spring constants are not the defaults (5.0 and the derived 0.5), so add ``--spring-constant 9.72 --spring-constant-min 0.972`` to match the baseline. To run another cell, replace ``01_hcn`` with another label from ``bench_data/baker/endpoints/``. Other external potentials ------------------------- NWChem is opt-in. Build with ``GPR_GPRN_ENABLE_NWCHEM=1`` (or configure with ``-Duse_rgpot_nwchem=true``) and set ``NWCHEMC_LIBRARY`` or ``RGPOT_NWCHEMC_ENGINE`` to the ``libnwchemc.so`` path at run time. Its options are the ``--nwchem-*`` family; for example ``--nwchem-basis`` (default ``sto-3g``), ``--nwchem-theory`` (default ``scf``), ``--nwchem-dft-xc``, ``--nwchem-charge`` and ``--nwchem-multiplicity``. Potentials that load an engine library are covered in :doc:`Use an rgpot engine plugin `. For a GPU build of the random-feature normal equations, see :doc:`Run GPRidge on a GPU ` and the :doc:`CUTLASS RFF design note <../development/design/cutlass_rff_kernelinverse>`.