==================================== Compare the GPRidge binding examples ==================================== Each example below solves the same problem in the languages shown. The selected language carries across the examples. For the same GP-NEB calculation in Python, C++, C and Fortran, see the :doc:`Lennard-Jones pentamer `. Build against an installed GPRidge shared library as described in :doc:`Installation <../getting-started/installation>`. The build command for each native program is in its opening comment. Build ``examples/band_examples.cpp`` once for all three settings. The Python program declares its dependencies for ``uv run --script``. The C and C++ examples check the library's ABI with ``GPR_ABI_CHECK()`` and ``GPR_SUCCESS``. The Fortran module exposes the same check as ``gpr_check_abi``. Band on the Muller–Brown surface -------------------------------- A standard nudged elastic band (NEB) finds the path between two minima of the two-dimensional Muller–Brown potential. .. tab-set:: :sync-group: gpridge-language .. tab-item:: Python :sync: python .. code-block:: bash uv run --script examples/band_examples.py standard .. literalinclude:: ../../../examples/band_examples.py :language: python :pyobject: standard_band .. tab-item:: C++ :sync: cpp .. code-block:: bash ./band_examples standard .. literalinclude:: ../../../examples/band_examples.cpp :language: cpp :start-at: NebResult standardBand() :end-before: NebResult localBand( .. tab-item:: C :sync: c .. literalinclude:: ../../../examples/capi_neb_muller_brown.c :language: c .. tab-item:: Fortran :sync: fortran .. literalinclude:: ../../../examples/fortran_neb_muller_brown.f90 :language: fortran Local band on a one-atom bowl ----------------------------- The local band calls the supplied oracle for the harmonic energy and gradient of a single atom. The result reports the oracle call count and the certificate status. The example limits the search to two outer iterations to show this report without waiting for convergence. .. tab-set:: :sync-group: gpridge-language .. tab-item:: Python :sync: python .. code-block:: bash uv run --script examples/band_examples.py local .. literalinclude:: ../../../examples/band_examples.py :language: python :pyobject: local_band .. tab-item:: C++ :sync: cpp .. code-block:: bash ./band_examples local .. literalinclude:: ../../../examples/band_examples.cpp :language: cpp :start-at: NebResult localBand() :end-before: NebResult periodicBand( .. tab-item:: C :sync: c .. literalinclude:: ../../../examples/capi_local_band.c :language: c .. tab-item:: Fortran :sync: fortran .. literalinclude:: ../../../examples/fortran_local_band.f90 :language: fortran Periodic band with a frozen neighbour ------------------------------------- The periodic local band takes a cell and an atom descriptor. The frozen atom stays fixed while the moving atom relaxes across the band. .. tab-set:: :sync-group: gpridge-language .. tab-item:: Python :sync: python .. code-block:: bash uv run --script examples/band_examples.py periodic .. literalinclude:: ../../../examples/band_examples.py :language: python :pyobject: periodic_band .. tab-item:: C++ :sync: cpp .. code-block:: bash ./band_examples periodic .. literalinclude:: ../../../examples/band_examples.cpp :language: cpp :start-at: NebResult periodicBand() :end-before: NebResult runBand( .. tab-item:: C :sync: c .. literalinclude:: ../../../examples/capi_periodic_band.c :language: c .. tab-item:: Fortran :sync: fortran .. literalinclude:: ../../../examples/fortran_periodic_band.f90 :language: fortran The examples are in the repository's `examples directory `_.