Skip to main content

Fast saddle-point analysis on dense N-D PES grids

Project description

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: labels every cell by basin and records every basin-merge (saddle) event as a merge tree. The whole-surface generalization of find_iwf_grid.
  • pes_analyzer.topology merge-tree helpers — pure-Python compute_persistence, prune_merge_tree, and the traversable MergeTree (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.

Installation

pip install pes_analyzer

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
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) full basin labelling + merge tree 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(labels, basins, merges) traversable basin merge tree (physics-free primitives) 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pes_analyzer-0.8.0.tar.gz (60.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pes_analyzer-0.8.0-cp310-abi3-manylinux_2_34_x86_64.whl (321.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

pes_analyzer-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (303.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

File details

Details for the file pes_analyzer-0.8.0.tar.gz.

File metadata

  • Download URL: pes_analyzer-0.8.0.tar.gz
  • Upload date:
  • Size: 60.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pes_analyzer-0.8.0.tar.gz
Algorithm Hash digest
SHA256 eebbc5ed86e4aced672ca7ff09852d96a9bdbb8c24b8a2c3a8a2570bc0854e21
MD5 bd02a7037f6c3ea7c2fb1b2ce7af588a
BLAKE2b-256 2ec1e15f0f32280397ddf395b67ad15e7ddd39cde15083b830ae93318f48c4c5

See more details on using hashes here.

File details

Details for the file pes_analyzer-0.8.0-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pes_analyzer-0.8.0-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a373a869a06c41860334055a833f756c3f2c93befa4128afbeeb3ab3b0c45918
MD5 f1ce423a9d836f3660beb8a63f77990f
BLAKE2b-256 023937972af21c9af83a2db5812b0e79765477b4d8dde0ea80b64b9a567df498

See more details on using hashes here.

File details

Details for the file pes_analyzer-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pes_analyzer-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 634d0d6715e6dce5c60ad311b1d82f3d3e3c1da14cb1e2794cad1e88b397e533
MD5 c2671727122d75e9040e9c60a2910ebf
BLAKE2b-256 74788d5a4abf65d8a150171bf9ea9462a8ed765814616cd17004ce9acbd34283

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page