Function reference

You probably won’t need most of these functions. The core workflow is covered in the Learn tutorials; this reference lists everything the library exposes. Some functions are experimental, legacy or deprecated and are marked as such. Use the tags below to filter, or the groups inside each module.

Show:

Compute

Core algorithms for grids, regions, RAGs, paths, percolation, and surface area.

Alternate

Valid, but not the default choice.

add_best_optuna_trial_to_rag alternate Run Optuna guest placement per pocket (Dask-parallel) and store best trials on RAG nodes.
add_pocket_psd_to_rag_with_pbc alternate Attach probe-occupiable pocket PSD histograms (Rust pocket-wise sampler) to RAG nodes.
add_pocket_psds_to_rag_from_segmentation alternate Attach probe pocket PSDs to a RAG built from segmentation.
add_vdw_hist_to_rag alternate Attach vdW energy histograms (and bin centers) to RAG nodes for clustering or plotting.
check_percolation_periodic2 alternate Return True if void voxels percolate along any axis (percolation_all_axes_periodic).
compute_percolation_history alternate Compute the percolation history with region and maxima information.
compute_percolation_history2 alternate Compute percolation history using correct periodic percolation logic.
compute_percolation_history_from_results alternate Attach lattice percolation history (v1 by default; prefer v2 via variant=‘v2’).
compute_percolation_history_from_results2 alternate Attach lattice v2 percolation history from segmentation results (compute_percolation_history2).
compute_percolation_history_from_results_lattice alternate Attach lattice percolation history under percolation_history_lattice.
compute_point_probe_reference alternate Compute point probe (probe_radius = 0) surface area and void volume as reference.
compute_surface_area_mc_lattice alternate Monte Carlo shell surface area with lattice accessibility.
compute_surface_area_mesh alternate Compute surface area analysis from pre-computed results dictionary.
compute_surface_area_mesh_lattice alternate Mesh (marching-cubes) surface area with lattice (voxel) accessibility — Zeo++-style.
compute_void_volume_from_results alternate Compute void volume analysis from pre-computed results dictionary with accessibility concerns.
compute_void_volume_from_results_lattice alternate Void volume (voxel) with lattice accessibility.
detect_periodic_maxima_enhanced alternate Enhanced periodic maxima detection that handles:
dgrid_from_atoms_cpu_hybrid alternate Modified dgrid computation using a hybrid AABB query and explicit distance calculation.
dgrid_from_atoms_gpu alternate Compute the distance grid on the GPU (alternative to the Rust dgrid_from_atoms_rust).
get_energy_interpolator alternate Build a scipy RegularGridInterpolator for a 3D energy grid, filling NaNs from local neighborhoods.
get_pld_for_rag alternate Estimate PLD from a RAG via supercell tiling, re-segmentation, and percolated-path analysis.
get_pore_dia_lattice alternate Lattice pore diameters; stores pore_dia_lattice on results when provided.
get_pore_dia_mgr alternate Compute the pore diameters (LCD, PLD, DFSD) from a CIF file.
get_pore_dia_mgr2 alternate Compute pore diameters (LCD/PLD/DFSD) using the periodic-aware percolation solver.
get_psd_on_rag alternate Compute pocketwise pore size distributions on a RAG using path-based sphere inflation.
get_rag_from_regions_and_grid alternate Build a skimage mean-color RAG from regions with centroid and optional maxima node properties.
gpd_aabb_hybrid alternate Hybrid approach combining an AABB neighbor search with vectorized distance calculations.
gpe_aabb alternate Sum Lennard-Jones energies at grid points via Freud ball query on a prebuilt AABB neighbor search.
setup_poisson_spectral_gpu alternate Set up the system for solving the Poisson equation using a spectral method.
solve_poisson_spectral_gpu alternate Solve the Poisson equation using a spectral method for non-orthogonal, periodic systems.

Other

Low-level helpers and building blocks.

AABB_on_atoms other Build a freud AABBQuery neighbor tree for an ASE structure and optional query points.
add_centroids_to_rag_with_pbc other Add PBC-aware centroid_pbc coordinates to RAG nodes for each periodic image group.
add_maxima_to_rag other Attach watershed maxima indices, coordinates, and radii to each RAG node.
add_pbc_to_rag other Add a pbc_group attribute to each RAG node from the PBC groups.
add_props_to_graph other Add node and edge property dicts to a graph.
add_props_to_rag other Copy skimage region props dicts onto matching RAG nodes as props.
add_window_info_to_rag other Add window radii and positions from the connection list to the RAG edges.
apply_pbc other Pad a region-label array with periodic boundary images.
apply_periodic_map other Relabel an integer array using a label-to-label map.
calc_path_components other Calculate the PCA components of a path in a RAG.
calculate_padding_thickness other Calculate required padding thickness for periodic calculations.
clustering_grid_from_regions other Paint region labels with RAG cluster ids for a given cluster_key attribute.
compare_two_paths other Compare two paths on a RAG.
dask_grid_over_atoms other Generate a dask array of grid points over an ase atoms object with a specified grid spacing
filter_percolated_paths other Keep only percolated paths whose limiting window meets a size threshold.
get_diametrically_opposite_points other Pick evenly spaced convex-hull vertices around a region for path-sampling seed points.
get_distances_for_path other Minimum framework surface distance at each path voxel (neighbor query minus covalent radii).
get_pbc_groups other Group unmerged regions based on periodic boundary conditions (PBC).
get_periodic_map other Map each region label to its periodic representative (optional connectivity groups).
get_region_props_for_regions other Return skimage regionprops for a labeled 3D region array.
get_repetitions_to_meet_cutoff other Return supercell repeat counts along each axis so pairwise interactions meet the cutoff.
get_sampling_paths_for_region other Find Dijkstra paths from a region maximum to its connection window sites.
get_wall_windows2 other Detect unit-cell face wall windows by pairing opposite boundary region labels.
gpd_aabb other Compute shortest probe distance from each grid point to the framework surface via Freud AABB search.
gpe_aabb2 other Sum Lennard-Jones grid energies via Freud ball query on positions (gpe_aabb uses a prebuilt AABB).
interpolate_dgrid other Build a scipy RegularGridInterpolator on a unit-cube mesh for a 3D distance grid.
mark_points_with_largest_including_dia other Inflate spheres along paths to windows and record the largest inclusive diameter per voxel.
normalize_pbc_groups_by_regions_pbc other Map PBC fragment groups to regions_pbc representative ids (visualization labels).
pad_periodic other Wrap-pad a 3D array by one voxel on each face for periodic neighbor lookups.
percolation_all_axes_periodic other Check percolation in x/y/z with periodic BCs in transverse directions.
repeat_to_meet_cutoff other Tile the structure and forcefield until the Lennard-Jones cutoff is satisfied in all directions.
sample_path other Resample a voxel path to evenly spaced points using spline interpolation.
setup_poisson_spectral other Set up the system for solving the Poisson equation using a spectral method.
solve_poisson_spectral other Solve the Poisson equation using a spectral method for non-orthogonal, periodic systems.

Experimental

Prototypes; may change or be removed.

compute_surface_area_mc experimental Experimental Monte Carlo shell-based surface area estimator.
find_isomorphic_path_groups experimental Group channel paths whose RAG subgraphs are isomorphic (optional pre-clustering).
find_paths experimental Enumerate Bellman–Ford paths in the RAG that connect opposing periodic faces.
optimize_molecule_at_node experimental Optimize guest pose at a RAG node with Optuna using a grid energy interpolator.

Legacy

Superseded by a better function; still works.

add_clustering_to_rag legacy Agglomeratively cluster RAG node feature vectors and write cluster labels on nodes.
add_clustering_to_rag_energy legacy Cluster RAG pockets by comparing PBC-aware vdW energy samples (KS distance).
add_clustering_to_rag_energy_js legacy Cluster RAG pockets using Jensen–Shannon distance between energy histograms.
add_clustering_to_rag_geometry_js legacy Adds cluster information to a region adjacency graph (RAG) by calculating the Jensen-Shannon distance between two histograms of distances.
add_csd_to_rag legacy Attach cavity-size distribution (CSD) histograms to RAG nodes.
add_csd_to_rag_with_pbc legacy Attach PBC-aware cavity-size distribution (CSD) histograms to RAG nodes.
check_percolation_periodic legacy Return True if void voxels above threshold form a periodically infinite (winding) network.
compute_pld legacy Compute the pore limiting diameter (PLD) from a CIF file.
compute_surface_area legacy Compute the surface area based on the distance grid and probe radius.
compute_void_volume legacy Compute the accessible volume based on the distance grid and probe radius.
dgrid_from_atoms legacy Build a Dask distance grid over atoms (dispatches to CPU implementation).
dgrid_from_atoms_cpu legacy Build a distance grid on CPU with Dask, using freud AABB neighbor queries when precompute=True.
dgrid_from_atoms_cpu_no_aabb legacy Build a CPU distance grid without AABB acceleration (slower, sometimes smoother in tight pores).
egrid_from_atoms2 legacy Sample vdW interaction energies on a grid (Dask); prefer Rust tricubic for production accuracy.
find_pore_limiting_radius legacy Binary-search the largest probe radius that still percolates (uses check_percolation_periodic).
find_pore_limiting_radius2 legacy Like find_pore_limiting_radius but uses check_percolation_periodic2 percolation tests.
get_energies_for_group legacy Sample Lennard-Jones energies at voxels in a PBC pocket group (legacy energy-based pocket typing).
get_energies_for_group2 legacy Sample grid energies for a region group using an energy interpolator (legacy pocket typing).

Deprecated

Do not use in new code.

add_clustering_to_rag_pca deprecated Cluster RAG nodes using PCA of their features (deprecated).
do_periodic_segmentation deprecated Full periodic watershed segmentation pipeline in pure Python/Dask.
do_periodic_segmentation_basic deprecated Like do_periodic_segmentation with optional connections and dgrid return flags.
get_pld_from_percolated_paths_path_windows deprecated Return PLD as twice the smallest path-limiting window radius across the given paths.
get_wall_windows3 deprecated Incomplete wall-window stub; use get_wall_windows2 for face-pair wall window detection.
add_psd_to_rag deprecated Attach CSD histograms to RAG nodes; forwards to add_csd_to_rag.
add_psd_to_rag_with_pbc deprecated Attach PBC CSD and optional pocket PSDs to RAG nodes via legacy combined entry point.
compute_surface_area_from_results deprecated Route mesh-based surface area from a segmentation results dict (winding or lattice backend).
compute_surface_area_from_results_lattice deprecated Forward to compute_surface_area_mesh_lattice for lattice-accessible mesh area.
compute_surface_area_from_results_mc deprecated Route Monte Carlo shell surface area from a segmentation results dict.
compute_surface_area_from_results_mc_lattice deprecated Forward to compute_surface_area_mc_lattice for lattice-accessible MC area.
compute_surface_area_from_results_mc_winding deprecated Forward to compute_surface_area_mc_winding for winding-accessible MC area.
compute_surface_area_from_results_winding deprecated Forward to compute_surface_area_mesh_winding for winding-accessible mesh area.

Plotly visualization

Plotly-based 3D figures and traces for frameworks, regions, and RAGs.

Alternate

Valid, but not the default choice.

draw_framework alternate Return Plotly Scatter3d traces for atoms, bonds, and optional aromatic rings in a framework.
get_pore_size_distribution_trace alternate Create a plotly trace for pore size distribution.
make_pore_size_distribution_fig_from_rag alternate Return a Plotly figure with PDF and CDF pore size traces stored on the RAG graph.
plot_dgrid_as_volume alternate Visualise a distance grid (optionally padded in ‘wrap’ mode).
plot_electrostatic_isosurfaces alternate Return a Plotly mesh trace for electrostatic potential isosurfaces with PBC-aware scaling.
plot_electrostatic_volume alternate Create a Volume trace for the electrostatic potential with meaningful isosurfaces.
plot_paths alternate Return Plotly Scatter3d line traces for paths through RAG nodes at maxima coordinates.
plot_pld_locations alternate Return Plotly Scatter3d traces for pore limiting diameter locations on a distance grid.
plot_pocket_psds alternate Create and display plotly figure comparing overall PSD with individual pocket PSDs.
plot_rag alternate Return one Plotly Scatter3d trace for a region adjacency graph at node coordinates.
plot_rag_separate_traces alternate Plot region adjacency graph with separate traces for nodes and edges.
plot_snapshot_raspa_pdb alternate Plots a snapshot of a RASPA PDB file.
plot_vdw_hists alternate Return Plotly bar traces for VdW energy histograms stored on RAG nodes.

Other

Low-level helpers and building blocks.

add_hoverdata_to_atoms_traces other Attach per-vertex hover text to a framework Mesh3d trace from ASE atom and bond data.
add_traces_plotly other Add traces to a Plotly go.Figure with backend validation.
batched_mesh_for_atoms other Fast batched mesh generation — returns a single trimesh for atoms + bonds.
cylinders_for_bonds other Build trimesh cylinder meshes for each bond pair in an ASE structure.
get_default_colors other Return normalized ASE Jmol RGB colors for default atom coloring.
get_isosurface_mesh other Build a trimesh isosurface from a 3D grid at the given isovalue with periodic cell metadata.
get_isosurface_submeshes other Get submeshes of isosurface based on region labels.
get_potential_near_atoms other Get potential values near atoms of a specific element.
make_bg_image other Return a Plotly layout image trace from a synthetic radial or axis-aligned gradient.
make_fig_orthographic other Set orthographic projection and default mesh lighting on a Plotly 3D figure.
make_fig_orthographic_all_subplots other Apply orthographic cameras and mesh lighting to every 3D subplot in a figure.
mesh_for_atoms other Build a ball-and-stick trimesh (or Scene) from an ASE atoms object and optional bonds.
plot_blocking_spheres_styled other
plot_cycle_highlights other Return Plotly mesh traces highlighting selected aromatic cycles on a structure graph.
plot_mesh other Convert a trimesh object (or list) to a Plotly Mesh3d trace with optional stylized lighting.
plot_subset_of_atoms other Return a Plotly Mesh3d trace for a subset of atoms selected by index.
scatter3d other Return a Plotly Scatter3d for an N×3 array of points with configurable markers and lines.
spheres_for_atoms other Return a list of trimesh spheres at ASE atom sites with scaled covalent radii.
spheres_for_positions other Return trimesh spheres at arbitrary positions with given radii and colors.
trimesh_from_pyvista other Convert a PyVista mesh to a trimesh surface mesh.

Experimental

Prototypes; may change or be removed.

plot_molecule_at_best_optuna_trials experimental Plot mesh traces for Optuna-optimized molecule geometries stored on RAG nodes.

Legacy

Superseded by a better function; still works.

plot_connections legacy Plot connections graph including periodic boundary connections.
plot_everything legacy Build a demo Plotly figure from the legacy do_it_all output tuple (HKUST-1 style).
plot_pore_graph legacy Return node and edge Scatter3d traces for graphs with node_coords (legacy pgraph format).
plot_windows legacy Return a Plotly Scatter3d trace of window positions from a raw connections list.

Deprecated

Do not use in new code.

plot_psds deprecated Deprecated alias for plot_csds (centroid-distance CSD, not probe PSD).

Analyze

Cheminformatics, ring finding, functional groups, and graph conversions.

Alternate

Valid, but not the default choice.

ase_to_rdkit alternate ASE → RDKit with bond deduplication (no sanitisation needed).
find_aromatic_cycles_in_sgraph alternate Find all aromatic cycles in the graph.
find_cycles_in_sgraph alternate List chordless cycles in a bond graph, filtered by size and expanded by subgraph isomorphism.
find_rings_in_ase_atoms alternate Find rings in an ASE structure via Voronoi bonds, sgraph_from_atoms, and NetworkX cycle_basis.
rings_by_size_rdkit alternate Return {ring_size: [rings]} using RDKit’s C++ ring perception.

Other

Low-level helpers and building blocks.

aabb_neighbors_on_atoms other Periodic neighbor pairs for covalent-bond candidacy (freud AABB or ASE fallback).
detect_smiles_in_mol other Return subgraph-isomorphism maps from a SMILES pattern into a SMILES molecule graph.
find_chemically_unique_cycles other Return indices of chemically non-isomorphic cycles (element + bond_type).
find_pattern_in_sgraph other Find subgraph isomorphisms of pattern in sgraph (element and bond_type node/edge matching).
find_smiles_in_mofid other Search MOFid linker SMILES segments for matches to a SMILES pattern via detect_smiles_in_mol.
get_atoms_from_smiles other Build an ASE Atoms object from a SMILES string with RDKit 3D embedding and covalent bond metadata.
get_bonds_and_orders_without_replication other Infer covalent bonds and pymatgen bond orders without replicating periodic images.
get_subset_atoms other Extract a bonded subgraph of ase_atoms as a new ASE Atoms object for the given atom indices.
voronoi_on_atoms other Build a freud Voronoi neighbor list for ASE atomic positions in the periodic cell.

Experimental

Prototypes; may change or be removed.

find_unique_sgraphs experimental Drop isomorphic duplicates from a list of NetworkX bond graphs (pairwise GraphMatcher).

Data

MOFdb fetchers, SQLite graph store, and CIF/PDB readers.

Alternate

Valid, but not the default choice.

get_atoms_from_mofdb_df_parallel alternate Parallel variant of atoms_from_mofdb_df for large MOFdb-style DataFrames.
read_cif_string alternate Parse a CIF string into an ASE Atoms object, or the string NaN on failure.

Other

Low-level helpers and building blocks.

add_graph_to_db other Insert one gzip-pickled NetworkX (or similar) graph into a SQLite graphs table.
bound_fetch other Fetch JSON from a URL while holding an asyncio semaphore (parallel MOFdb page downloads).
create_db_from_pickled_graphs other Create a SQLite database and store gzip-compressed pickled graphs from a pickle file.
fetch other Fetch JSON from a URL with aiohttp (single-page MOFdb helper).
get_graph other Load one gzip-pickled graph from a SQLite graphs table by row id.
get_mofdb_data other Compile a asyncio Future containing the results of a search by making requests to MOFDb in parallel asynchronously
get_num_graphs other Return the number of rows in the SQLite graphs table at db_path.
get_number_of_pages other Get the number of pages of the result, from the url, for a given set of headers and parameters
mix_lorentz_berthelot other Mix framework and probe UFF parameters with Lorentz-Berthelot rules for each framework atom.
plot_representative_sample_subplots other Build a 2x2 Plotly figure comparing full vs sample histograms for each
read_raspa_pdb other Parse a RASPA trajectory PDB into per-frame cells, symbols, and Cartesian coordinates.
show_percolated_paths_as_df other Build a sorted DataFrame of pore-graph paths, window diameters along each path, and hop counts.
write_cifs_from_mofdb_df other Write CIF strings from a MOFdb-style DataFrame to .cif files in a folder.

Helper

Grid utilities, PBC helpers, PSD peak finding, and small math routines.

Alternate

Valid, but not the default choice.

compute_psds_from_points_pocketwise alternate Compute pore size distributions for each unique region/pocket instead of the whole unit cell.
estimate_h_from_percolation_history alternate Estimate h parameter using PLR and analysis of percolation transition.
merge_small_regions_pbc alternate Merge small labeled regions (< min_size voxels) into neighboring larger regions,

Other

Low-level helpers and building blocks.

ase_frac_to_egrid_query other Map ASE fractional coordinates to egrid / tricubic query coords in [0, 1).
check_wall other Flag grid maxima that lie in the near-wall voxel band along any cell direction.
check_wall_per_dim other Like check_wall but return per-axis wall flags (shape N×3) instead of a single boolean.
compare_psd_peaks other Pairwise match shorter PSD peak diameter lists to the nearest peaks in a longer list.
compute_wall_cells other Return voxel counts per axis for a wall band of thickness wall_thickness times cell height.
convert_to_cygwin_path other Convert a Windows path to a Cygwin-style path and escape spaces.
find_coord_from_indices other Get the cartesian coordinates from the indces of a grid mapped over an ase atoms object.
find_end_channel_pairs other Pair wall-adjacent segmented regions that share a PBC label and may form end-to-end channels.
find_psd_peaks other Locate PSD peaks with scipy continuous wavelet transform peak finding (find_peaks_cwt).
find_touching_region_pairs other Given a 3D grid of segmented regions (integer labels, with 0 as background),
get_fractional_coordinates other Find the fractional coordinates for a bunch of cartesian corrdinates in a box corresponding to an ase.atoms object
get_min_distance other Calculate minimum image distance between two points using ASE cell.
get_perpendicular_voxel_lengths other Estimate effective voxel edge lengths perpendicular to skewed grid basis vectors.
interpolate_labels other Create a scipy.interpolator.RegularGridInterpolator, using ‘nearest’ method for the region labels (or any 3D numpy grid)
is_inside_or_close_to_boundary other Determines if points are inside the box or just outside within tolerance. Typically used for checking the maxima positions, but we can use it with basically any point. To get a healthy tolerance with proper accounting of non orthogonality use the compute_wall_cells function to find the number of cells forming the wall region in each direction [a, b, c]
make_command other Create a command string for running a Cygwin executable with a CIF file.
merge_small_regions other Merge small labeled regions (< min_size voxels) into neighboring larger regions.
move_maximum_to_peak other Move a maximum position to the nearest peak using gradient ascent,
periodic_gaussian_filter other Apply a periodic (wrap-around) Gaussian filter using np.roll.
process_wall_maxima other Process wall maxima to identify and merge periodic copies.
run_cygwin_from_jupyter other Run a Cygwin command from a Jupyter notebook.
run_cygwin_from_jupyter_rt other Run a Cygwin command from a Jupyter notebook in real-time.
spectral_smooth_3d other Smooth a 3D grid using spectral filtering with proper handling of non-orthogonal cells.
trim_connections_to_unique_regions other Keep connections with at least one endpoint label in unique_regions.
zoom_grid other Resample a grid with periodic wrap (grid-wrap) via scipy zoom, wrapped as a Dask array.

Rust backend

Python bindings to the Rust backend (distance/energy grids, segmentation, watershed).

Alternate

Valid, but not the default choice.

compute_psd_uniform_rust alternate Compute pore size distribution using uniform sampling.
compute_psds_pocketwise_accessible alternate Compute pocket-wise PSD restricted to accessible (percolating) regions only.
egrid_from_atoms_rust alternate Compute an energy grid from atomic positions using the Rust backend.
seeded_watershed_det_parallel_rust alternate Deterministic parallel seeded watershed wrapper around mgr_rust.
seeded_watershed_det_rust alternate Deterministic single-threaded seeded watershed wrapper around mgr_rust.
dgrid_from_atoms_rtree_interp_rust alternate Compute a smoothed distance grid using coarse R-tree sampling + trilinear interpolation.
dgrid_from_atoms_rtree_rust alternate Compute a distance grid using the Rust R-tree (AABB) periodic neighbor-search backend.

Other

Low-level helpers and building blocks.

compute_pore_sizes_pocketwise_rust other Compute pore sizes for each pocket/region separately.
compute_pore_sizes_uniform_rust other Compute pore sizes using uniform sampling across the material.
egrid_query_extent_from_atoms other ASE fractional span per axis covered by a unit-cell egrid (1.0 = full cell).
tricubic_interpolator_from_grid other Build a tricubic energy interpolator from an 8-channel energy grid.

Deprecated

Do not use in new code.

dgrid_from_atoms_aabb_interp_rust deprecated Deprecated alias of dgrid_from_atoms_rtree_interp_rust.
dgrid_from_atoms_aabb_rust deprecated Deprecated alias of dgrid_from_atoms_rtree_rust.
dgrid_from_atoms_exp_rust deprecated Same as dgrid_from_atoms_rust; kept for backward-compatible imports.

Workflows

High-level pipelines that wire compute + visualize for common analyses.

Alternate

Valid, but not the default choice.

build_padded_threejs_scene alternate Build a Three.js HTML scene with padded transparent segmentation surfaces.

Legacy

Superseded by a better function; still works.

quick_cluster legacy Run the legacy Python dgrid segmentation and geometry-JS clustering pipeline with optional figures.

Three.js visualization

Three.js trace helpers (Figure3JS / Figure3js) that mirror the Plotly API.

Alternate

Valid, but not the default choice.

draw_framework_3js alternate
plot_cell_3js alternate
plot_connections_3js alternate
plot_maxima_3js alternate
plot_maxima_from_grid_3js alternate
plot_percolated_cluster_meshes_3js alternate
plot_percolation_windows_3js alternate
plot_surface_dgrid_3js alternate
plot_windows_3js alternate
plot_windows_from_results_3js alternate

Other

Low-level helpers and building blocks.

add_trace other Add one Three.js trace dict to a Figure3D and return the figure.
add_traces other Add Three.js trace dicts or bundles to a Figure3D and return the figure.
prepare_seg_threejs other Validate and normalize a segmentation dict for Three.js plot helpers.
qualitative_colorscale other Return Plotly qualitative palette colors as 0–1 RGB triples for Three.js traces.
seg_from_connections other Build a minimal segmentation dict from connections, maxima, and grid shape.

Three.js plotting

Standalone Three.js HTML builders for percolation scenes.

Viz backend

Backend dispatch utilities (Plotly vs Three.js) for figures and traces.

Other

Low-level helpers and building blocks.

ensure_plotly_figure other Raise TypeError if fig is not a plotly.graph_objects.Figure.
ensure_plotly_trace other Raise TypeError if obj is not a Plotly trace.
ensure_threejs_figure other Raise TypeError if fig is not a Three.js figure used by mofography.
ensure_threejs_trace other Raise TypeError if obj is not a mofography Three.js trace dict.
is_plotly_figure other Return whether fig is a plotly.graph_objects.Figure instance.
is_plotly_trace other Return whether obj is a Plotly trace (and not a Three.js dict).
is_threejs_figure other Return whether fig is a Figure3JS, Figure3D, or MovieFigure Three.js figure.
is_threejs_trace other Return whether obj is a native or tagged mofography Three.js trace dict.
iter_leaf_traces other Yield individual trace objects from nested lists or trace-bundle dicts.
tag_threejs_trace other Mark a trace dict with the mofography Three.js backend tag and return it.
validate_plotly_traces other Ensure every leaf in nested traces is a Plotly trace.
validate_threejs_traces other Ensure every leaf in nested traces is a mofography Three.js trace dict.

Movies

Frame builders and movie-HTML helpers for time-varying scenes.

Alternate

Valid, but not the default choice.

embedded_movie_dict_from_path alternate Load trajectory and return the JSON movie block used by md_pdb_threejs_viewer.
make_framework_scatter_trace alternate Framework as scatter points + line segments (fast, no mesh geometry).
make_framework_trace alternate Build a Three.js mesh trace for framework atoms and covalent bonds.
make_movie_from_raspa_pdb alternate High-level convenience function to build a fixed-framework movie from RASPA PDB + CIF.
make_sparse_multicomponent_movie alternate Build sparse-index movie with separate guest traces per component.
read_raspa_pdb_movie alternate Parse a RASPA PDB movie into canonical snapshot dictionaries.

Other

Low-level helpers and building blocks.

compute_cell_lines other Compute unit-cell wireframe line-segment data.
compute_connection_data other Compute connection line-segment + node-point data.
compute_framework_mesh other Compute raw framework mesh data (positions, indices, colors, hover).
compute_maxima_data other Compute maxima point-cloud data (positions, sizes, colors, hover).
compute_sparse_segmentation_series other Compute segmentation payloads for sparse framework frame indices.
compute_surface_mesh other Compute marching-cubes isosurface mesh from distance grid and region labels.
compute_windows_data other Compute window-point data from connection list.
make_cell_trace other Build a Three.js unit-cell wireframe line trace for the structure cell.
make_connections_trace other Build connection line segments and node markers from a segmentation dict.
make_guest_bonds_trace other Build cylindrical bond mesh for polyatomic adsorbates.
make_guest_trace other Build an instanced-sphere trace for adsorbate or guest atoms.
make_maxima_trace other Build internal, periodic, and PBC maxima point traces from a segmentation dict.
make_surface_trace other Build a Three.js colored isosurface mesh trace from dgrid and region labels.
make_windows_trace other Build internal and periodic window marker traces from connections in seg.

Legacy

Superseded by a better function; still works.

embedded_movie_dict_from_snapshots legacy Compact per-frame dict for the legacy devtools Three.js HTML (positions + radii only).

Winding percolation

Graph-winding-based accessibility and percolation routines.

Alternate

Valid, but not the default choice.

annotate_graph_edges_with_window_fingerprints alternate Annotate each graph edge with a lightweight window shell fingerprint.
get_pore_dia_mgr_winding2 alternate Compute pore diameters using winding percolation with spill guardrail.
get_pore_dia_mgr_winding3 alternate Compute pore diameters with spill-edge pruning (no resegmentation).
make_periodic_graph_from_binary_grid alternate Convert a binary 2D periodic lattice into a MultiDiGraph for winding percolation.
percolation_winding_on_binary_grid alternate Run winding percolation on a 2D binary periodic lattice (demo / tests).

Other

Low-level helpers and building blocks.

annotate_clusters other Assign cluster IDs to winding loops from node sets and |winding| tuples.
build_base_region_labels other Map each base maxima node to watershed region labels it represents.
build_base_region_labels_from_results other Build base-node to region-label mapping from segmentation results.
check_percolation_winding other Return True if winding percolation occurs on any axis at the given threshold.
detect_percolation_with_threshold other Convenience wrapper that filters nodes/edges below threshold before
percolation_winding_multidigraph other Evaluate percolation with winding numbers on a deduplicated MultiDiGraph.

Legacy

Superseded by a better function; still works.

collect_periodic_edges legacy Backward-compatible wrapper for canonical edge collection.

Pocket typing

Pocket classification (chemistry/shape) on segmentation results.

Alternate

Valid, but not the default choice.

assign_pocket_types_shape_refined alternate d₁ coarse bands first; max_r refinement only for large ZIF-like groups.

Other

Low-level helpers and building blocks.

build_fragment_label_to_rep other Map every fragment region label to its PBC representative (min label in group).
build_fragment_label_to_type other Map every fragment label → 1-based pocket type id (via PBC rep).
build_pockets_from_segmentation other Build pocket records (id, d1, neighbors) from segmentation + PSD on RAG.
build_rep_to_fragment_group other PBC representative (min label) → all fragment region labels in that pocket.
compute_pocket_fingerprints other Mouth-annulus fingerprints for all pockets (for typing and diagnostics).
compute_typing_dgrid other Distance grid for typing max_r only (same spacing as segmentation).
fingerprints_similar_adjacent_bands other Merge adjacent max_r bands when annulus fingerprints agree (relaxed max_r gate).
group_pockets_by_d1_coarse other Greedy adjacent merge on probe PSD d₁ (Å); returns rep ids per coarse group.
merge_adjacent_groups_by_fingerprint other Union-merge neighboring groups (by mean max_r) when d₁ + fingerprints allow.
merge_singleton_max_r_bands other Reassign isolated max_r bands to the nearest band if within gap_tol_a.
pocket_typing_result_for_app other Convert PocketTypingResult to the dict shape used by Streamlit/CLI.
psd_bins other Diameter bins for pocketwise probe-occupiable PSDs.
resolve_typing_vdw_radii other Per-atom VDW radii (Å) for typing max_r, or None = use segmentation dgrid.
split_band_by_max_r_subpeaks other Split one max_r band when grid peaks differ in radius and annulus fingerprint.
summarize_types other Summarize per-type pocket counts and max_r, volume, and d1 ranges for reporting.

Legacy

Superseded by a better function; still works.

regions_cluster_from_rag legacy Paint fragment labels via RAG nodes (labels[0]), matching legacy clustering.

Pocket framework env

Framework fingerprints and probe-radius helpers for pocket typing.

Other

Low-level helpers and building blocks.

adaptive_shell_radius other Shell extent (Å) from pocket size scale (d1 or dgrid max).
assign_pocket_types_by_max_probe_radius other Cluster by probe radius at dgrid peak; one type per band (symmetry copies merged).
bond_type_from_order other Classify a bond as single, aromatic, or double from its bond order.
compute_connectivity_fingerprints other SH power spectrum of direction vectors to trusted neighbour pocket centres.
compute_pocket_fingerprint other Radial (r/R_shell) + SH angular power per element → L2-normalized vector.
expand_bond_closure other Add bonded neighbors up to n_hops (cushion beyond distance shell).
fingerprint_cosine_similarity other Mean cosine over environment + PSD + connectivity channels (rotation-invariant).
framework_atom_indices_near_void other MIC: keep framework atoms with min distance to any void sample <= r_cut.
framework_indices_adaptive_shell other Framework atom indices within adaptive shell + optional bond closure.
max_probe_radius_at_peak other Largest probe radius (Å) at the pocket maximum on the unit-cell fragment.
max_probe_radius_for_fragment_group other Largest probe radius (Å) over all periodic fragment labels in one PBC pocket.
mic_vectors_from_centroid other (N, 3) Cartesian MIC displacements centroid → atom.
peak_cart_for_fragment_group other Cartesian position of the dgrid maximum for a PBC pocket group.
pocket_centroid other Return the Cartesian centroid (mean position) of void sample points.
radial_histogram_normalized other Build an L1-normalized radial histogram of r/R_shell in n_bins bins.
sh_power_spectrum_unit_dirs other Rotation-invariant power |a_l|^2 = sum_m |a_lm|^2 for l=0..l_max.
void_cart_for_pocket other Cartesian void sample points for pocket rep.
void_cart_mic_for_fragment_group other Void points for a full PBC pocket (all fragment copies, MIC-wrapped to peak).
void_cart_near_dgrid_peak other Void samples within shell_a of the local dgrid maximum (fragment).
void_cart_surface_pocket other Surface void voxels of pocket rep (small dgrid → close to VDW surface).

Widest-path resegment

Pore-graph widest-path resegmenting for PBC wrap repairs.

Other

Low-level helpers and building blocks.

marker_padded_position other Padded-grid index for one maxima_info row.
neighbor_offsets_26 other Return the 26 face/edge/corner neighbor offsets for a 3D voxel grid.
widest_path_bottleneck_between_seeds other Bottleneck of the widest path between two seeds (symmetric max-min).
widest_path_bottleneck_from_seed other Max-bottleneck distances from seed on the void graph (26-NN).

Experimental

Prototypes; may change or be removed.

apply_widest_path_fix_to_pair experimental Locate PBC wrap pair and re-partition; return labels unchanged if none found.
find_all_pbc_wrap_marker_pairs experimental All in-cell + single-axis wrapped label pairs at each maxima position.
find_pbc_wrap_marker_pair experimental Find the leakiest in-cell + single-axis wrapped marker pair.
repartition_pair_widest_path experimental Reassign disputed voxels between two seeds via widest-path partition.

Window refinement

Morphological window refinement on connections.

Deprecated

Do not use in new code.

refine_windows_via_morph_opening deprecated Refine window centers and radii via local morphological opening on the distance field.

Export MP4

MP4 export helpers for Plotly/Three.js figures.

Alternate

Valid, but not the default choice.

export_plotly_frames_to_mp4 alternate Export a figure that uses Plotly’s frames API (slider / animation) to MP4.

Other

Low-level helpers and building blocks.

kaleido_persistent_session other Start Kaleido’s sync server for fast repeated static export, then stop it.
set_traces_visible other Set visible on each trace in order.

Percolation results

Result-pack accessors for percolation history and pore diameter.

VDW radii

Van der Waals radii tables (Bondi, Mendeleev, typing) and metadata.

Other

Low-level helpers and building blocks.

vdw_radii_input_metadata other Compact VDW radii provenance for segmentation input_params.

Legacy

Superseded by a better function; still works.

mendeleev_vdw_radii_angstrom legacy Per-atom Mendeleev VDW radii in Å (legacy table, larger for metals).

CIF I/O

CIF parsing with large-file support.

RASPA helper

RASPA input/output helpers, blocking spheres, and accessibility masks.

Alternate

Valid, but not the default choice.

blocking_spheres_greedy alternate Greedy blocking spheres (org-note style): place spheres at pocket maxima for

Other

Low-level helpers and building blocks.

accessible_interface_voxel_mask other Boolean mask (same shape as results['regions']) for accessible
apply_region_map_to_raspa_pdb other Count adsorbates per segmentation region using a supercell region map on PDB frames.
apply_region_map_to_raspa_pdb_wrapped other Count adsorbates per region after wrapping PDB coordinates into one unit cell.
blocking_spheres_overlap_accessible_coarse_sample other Same intent as blocking_spheres_overlap_into_accessible_regions, but
blocking_spheres_overlap_into_accessible_near_interface other Cheaper overlap diagnostic: sample coarse grid points (default 0.5 Å)
blocking_spheres_overlap_into_accessible_regions other Estimate how much blocking-sphere volume intrudes into accessible void.
blocking_spheres_overlap_leakage other How much blocking spheres intrude into the other void class (leakage).
blocking_spheres_overlap_leakage_pair other Pair of blocking_spheres_overlap_leakage runs for BlockPockets QA.
get_atoms_list_for_pdb other Read selected frames from a RASPA trajectory PDB into a list of ASE Atoms.
get_isos_fit_for_multiple_raspa_folders other Run get_isos_fit_for_raspa_folder on each folder and return a path-keyed dict.
get_isos_fit_for_raspa_folder other Fit Legendre polynomials to RASPA energies and return isosteric heat vs loading.
get_isotherm_df_for_raspa_folder other Parse RASPA output *.data files in a folder into a sorted isotherm DataFrame.
get_isotherms_dict_for_multiple_raspa_folders other Build a dict of isotherm DataFrames keyed by folder basename for each run folder.
labels_accessible_adjacent_to_inaccessible_via_rag other Region labels that are percolating and share an internal RAG edge
make_raspa_input_for_cif other Render simulation.input from a Jinja template and copy files into a run folder.
percolation_region_labels_union_winding other Union of segmentation region IDs appearing in any winding-percolation cluster.
print_blocking_accessible_coarse_overlap_comparison other Compare outputs of blocking_spheres_overlap_accessible_coarse_sample
print_blocking_spheres_overlap_pair_report other Print blocking_spheres_overlap_leakage_pair results in plain language.
print_blocking_spheres_overlap_report other Print a human-readable summary for blocking_spheres_overlap_leakage
segmentation_spacing_from_results other Segmentation grid spacing (Å), consistent with dask_grid_over_atoms.
write_blocking_spheres_file other Write RASPA-style blocking list: first line = count, then sx sy sz r

Legacy

Superseded by a better function; still works.

block_pockets_at_random_and_write legacy Write RASPA blocking spheres for a random fraction of each RAG pocket type.
block_specific_pockets_and_write legacy Write RASPA blocking spheres for selected RAG pocket node IDs.

Deprecated

Do not use in new code.

print_blocking_accessible_coarse_overlap_report deprecated Deprecated name; calls print_blocking_spheres_overlap_report.
print_blocking_interface_overlap_stats deprecated Deprecated name; calls print_blocking_spheres_overlap_report.
print_blocking_overlap_stats deprecated Deprecated name; calls print_blocking_spheres_overlap_report.