Skip to main content

pes_analyzer

Fast saddle-point and minimum analysis on dense N-D potential energy surface grids.

Python ≥ 3.10 · Rust 2024 edition · N-D grids for N ∈ [2, 7] · MIT

Why

Quantum-chemistry calculations produce potential energy surfaces (PES) as dense tables of energies on a multidimensional grid of geometric coordinates. Once that grid exists, the interesting analysis questions are topological: where are the minima, where are the saddle points, which basins are connected to which? pes_analyzer answers those questions on grids that may be too large for pure-Python approaches by pushing the inner loops into Rust.

What it does

  • pes_analyzer.saddle.find_iwf_grid — imaginary water flow (watershed) saddle search between two grid points.
  • pes_analyzer.extrema.find_minima_grid — local minima on the Chebyshev king-move stencil (default 3ᴺ−1; widen via confirm_range for a fast two-pass check, or via neighborhood_range for a direct wider check).
  • pes_analyzer.extrema.find_maxima_grid — strict dual of find_minima_grid. Same stencil and same neighborhood_range / confirm_range semantics; output sorted descending by energy.
  • pes_analyzer.extrema.find_extrema_grid — combined single-sweep search. Returns (minima, maxima) byte-identical to calling the two single-polarity functions separately, at the cost of one extra-list allocation but one fewer stencil walk per cell.
  • pes_analyzer.topology.find_watershed_segmentation — full watershed flood returning a Watershed: basin labels, the merge (saddle) events, and optionally each cell's flood parent (parents=True). Peak memory 8N + 4V bytes; drop_labels() releases the grid arrays.
  • pes_analyzer.topology.find_minimax_path — deep minimax path between two cells; with tree= it is reconstructed from the watershed's flood state instead of re-flooding.
  • pes_analyzer.topology.find_steepest_descent_path, find_least_action_path, find_minimum_ascent_path — path kernels that follow the slope from a cell, minimise ∫ cost ds for a caller-built cost, or minimise the total climb; they take optional physical axis coordinates (axes=) and an end cell or a boolean target mask.
  • pes_analyzer.topology merge-tree helpers — pure-Python compute_persistence, prune_merge_tree, and the traversable MergeTree(ws) (whose nodes are BasinNodes) analyse that merge tree. MergeTree is physics-free: it exposes neutral traversal, membership, and geometry primitives that a consumer composes with its own predicates to label ground states, saddles, fission exits, etc.
  • pes_analyzer.grid.build_dense — scatter helper that turns sparse (coords, value) rows into a dense numpy array indexed in axis order.
  • pes_analyzer.grid.minimize_grid / jump_map / index_to_coords / path_length — minimised maps with the full index of each minimiser, the jump map that shows where the minimiser switches valley, and axis-coordinate helpers.
  • pes_analyzer.synthetic — analytic surfaces (muller_brown, separable_wells, hidden_barrier) with exact minima, index-1 saddles and the minima each saddle joins, for tests and data-free examples.

Installation

pip install pes_analyzer

Runtime dependencies are NumPy and matplotlib; pip installs both.

Wheels bundle the full reference docs under pes_analyzer/_docs/ — see Documentation. Building from source (PyO3 + Rust via maturin) and contributor workflows are covered in DEVELOPMENT.md.

Quickstart

import numpy as np

from pes_analyzer.saddle  import find_iwf_grid
from pes_analyzer.extrema import find_minima_grid

# A toy 2x5 PES: two basins at (0, 0) and (0, 4) along the top row,
# separated by a hump that peaks at (0, 2). The bottom row is a high
# wall, so any path between the basins must cross the hump.
energies = np.array([
    [0.0, 1.0, 2.0, 1.0, 0.0],
    [3.0, 3.0, 3.0, 3.0, 3.0],
])

print(find_minima_grid(energies))
# [((0, 0), 0.0), ((0, 4), 0.0)]

print(find_iwf_grid(energies, start=(0, 0), end=(0, 4)))
# ((0, 2), 2.0)

API at a glance

Function Purpose Reference
grid.build_dense(coords, values) sparse rows → dense N-D array API.md
grid.minimize_grid(energies, keep, *, threads=None) minimised map + full index of each minimiser API.md
grid.jump_map(index, keep) how far the minimiser moves between map neighbours API.md
grid.index_to_coords(indices, axes) grid indices → physical coordinates API.md
grid.path_length(indices, axes=None) cumulative Euclidean length along a path API.md
saddle.find_iwf_grid(energies, start, end) watershed saddle search API.md
extrema.find_minima_grid(energies, *, neighborhood_range=1, confirm_range=None) local minima (Chebyshev stencil) API.md
extrema.find_maxima_grid(energies, *, neighborhood_range=1, confirm_range=None) local maxima (dual of find_minima_grid) API.md
extrema.find_extrema_grid(energies, *, neighborhood_range=1, confirm_range=None) combined single-sweep search API.md
topology.find_watershed_segmentation(energies, neighborhood="von_neumann", *, parents=False) full basin labelling + merge tree (Watershed) API.md
topology.find_minimax_path(energies, start, end, tree=tree) deep minimax path from the watershed's flood state API.md
topology.find_steepest_descent_path(energies, start, *, axes=None, neighborhood="moore") steepest-descent path from a cell API.md
topology.find_least_action_path(cost, start, end, *, axes=None, neighborhood="moore") path minimising ∫ cost ds to a cell or mask API.md
topology.find_minimum_ascent_path(energies, start, end, *, axes=None, neighborhood="von_neumann") path minimising the total climb to a cell or mask API.md
topology.compute_persistence(basins, merges) per-basin topological persistence API.md
topology.prune_merge_tree(basins, merges, threshold) drop low-persistence basins API.md
topology.MergeTree(ws) traversable basin merge tree (physics-free primitives; drop_labels()) API.md
synthetic.muller_brown(), separable_wells(ndim), hidden_barrier() analytic surfaces with exact critical points API.md

Documentation

The consumer reference docs are bundled in the installed package under pes_analyzer/_docs/; locate them at runtime with pes_analyzer.docs_path().

  • USAGE.md — end-to-end pipeline cookbook (start here).
  • API.md — full API reference with examples.
  • ALGORITHMS.md — how the watershed and minima algorithms work.

Developer-facing docs stay in the repo (not bundled):

License

MIT — see Cargo.toml.

Metadata

Release files for pes-analyzer 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pes-analyzer 0.12.0
File Size Uploaded Provenance Actions
pes_analyzer-0.12.0.tar.gz 627.9 kB With provenance Details for pes_analyzer-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pes-analyzer 0.12.0
File Interpreter ABI Platform Actions
pes_analyzer-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for pes_analyzer-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Total release size: 1.1 MB

Release files / pes_analyzer-0.12.0.tar.gz

Download URL pes_analyzer-0.12.0.tar.gz
Size 627.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e82ed1ded98324c2b9d71bff29e82306430937e93a24442efc10af2978a076e5
BLAKE2b-256 checksum
How to use checksums
d11b4a12e1231fc96eab8618c3661e65fb45c6c660c1c15e3a59110730827511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / pes_analyzer-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pes_analyzer-0.12.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 492.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b4a45425dfa18c2381a6df655d16e625f3f2166b0195a74999b2d11e6a8bbf10
BLAKE2b-256 checksum
How to use checksums
741699999ffba1b6ceb1714075e4270a501d3ff4b94bbb34a344c32a82ef699a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Security for pes-analyzer 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pes_analyzer-0.12.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page