Plotting API Reference#
Module: chemparseplot.plot.neb#
Data Structures#
InsetImagePos#
Frozen dataclass for inset structure image placement with fields x, y, and rad.
Field |
Type |
Description |
|---|---|---|
|
|
Data x coordinate |
|
|
Data y coordinate |
|
|
Arrow curvature radius |
SmoothingParams#
Dataclass for Savitzky-Golay smoothing of NEB force profiles.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Savitzky-Golay window length |
|
|
|
Polynomial order |
1D Profile Functions#
plot_energy_path(ax, rc, energy, f_para, color, alpha, zorder, method”hermite”, smoothing=None)=#
Plots a 1D energy profile with optional Hermite spline interpolation.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes |
|
|
|
Reaction coordinate (RMSD or image index) |
|
|
|
Energy values |
|
|
|
Parallel force component |
|
|
|
Line and marker color |
|
|
|
Opacity |
|
|
|
Drawing order |
|
|
|
|
Interpolation method: |
|
|
|
Savitzky-Golay parameters (defaults to |
Notes#
hermite: CubicHermiteSpline using Savitzky-Golay smoothed force derivatives. Produces physically meaningful interpolation when forces are available.spline: Standard B-spline viasplrep/splev(cubic, k=3). Does not use force information.Normalizes reaction coordinate to [0, 1] before fitting, then maps back.
Falls back to raw line plot if spline fitting raises an exception.
plot_eigenvalue_path(ax, rc, eigenvalue, color, alpha, zorder, grid_color”white”)=#
Plots a 1D eigenvalue profile with cubic spline interpolation.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes |
|
|
|
Reaction coordinate |
|
|
|
Eigenvalue array |
|
|
|
Line and marker color |
|
|
|
Opacity |
|
|
|
Drawing order |
|
|
|
|
Color of the horizontal zero-line |
Notes#
Adds a horizontal dashed line at eigenvalue = 0
Uses square markers (
"s")
2D Landscape Functions#
plot_landscape_surface(...)#
Plots a 2D landscape surface using gradient-enhanced GP/RBF interpolation.
Signature (core args abbreviated)::
- plotlandscapesurface(
ax, rmsdr, rmsdp, gradr, gradp, zdata, stepdata=None, method=”gradmatern", rbfsmooth=None, cmap=”viridis”, showpts=True, variancethreshold=0.05, projectpath=True, extrapoints=None, ninducing=None, xlim=None, ylim=None, basis=None, autothin=False, maxsurfacepoints=64, surfacefit=None,
)
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes |
|
|
|
RMSD from reactant |
|
|
|
RMSD from product |
|
|
|
Synthetic gradient (R direction) |
|
|
|
Synthetic gradient (P direction) |
|
|
|
Energy or eigenvalue |
|
|
|
|
Step indices per point |
|
|
|
Surface model (see table below) |
|
|
|
Length scale hint (auto-optimized) |
|
|
|
Matplotlib colormap name |
|
|
|
Scatter data points on surface |
|
|
|
Variance contour threshold (fraction of range) |
|
|
|
Project to reaction valley coordinates |
|
|
|
Shape |
|
|
|
Inducing points for Nystrom approximation |
|
|
|
Opt-in: subsample dense clouds for the fit only |
|
|
|
Cap when |
|
|
|
TOML-friendly config; overrides the two keys above when set |
SurfaceFitConfig (v1.9.10+)#
Prefer a small config object over growing kwargs. Key names match rgpycrumbs
eOn plot TOML (auto_thin, max_surface_points):
from chemparseplot.plot.neb import SurfaceFitConfig, plot_landscape_surface
cfg = SurfaceFitConfig.from_mapping({"auto_thin": True, "max_surface_points": 64})
# or: SurfaceFitConfig(auto_thin=True, max_surface_points=64)
plot_landscape_surface(
ax, rmsd_r, rmsd_p, grad_r, grad_p, z_data,
method="grad_imq",
surface_fit=cfg,
)
Defaults keep historical behaviour (~autothin=False=).
Interpolation Methods#
Method |
Description |
|---|---|
|
Gradient-enhanced Matern kernel (default) |
|
Gradient-enhanced Inverse MultiQuadric |
|
Nystrom-approximated |
|
Value-only RBF (no gradients) |
Notes#
Hyperparameters (length scale, noise) optimized on the latest step’s data only
Variance contours drawn at 5%,
variance_threshold, and 95% of the rangeWhen Nystrom is active, non-inducing points are drawn with reduced opacity (alpha=0.15)
Reaction valley projection rotates (RMSD-R, RMSD-P) into (progress
s, deviationd) along the R-to-P lineSurface models come from
rgpycrumbs.surfacesWith
auto_thin, the GP trains on a thinned set; scatter and viewport still use the full cloudDense force-eval movies can yield non-finite
grad_imqgrids without thinning; opt in explicitly
plot_landscape_path_overlay(ax, r, p, z, cmap, z_label, project_path=True)#
Overlays a colored NEB path line on the landscape surface.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes |
|
|
|
RMSD from reactant (path images) |
|
|
|
RMSD from product (path images) |
|
|
|
Energy coloring values |
|
|
|
Colormap name |
|
|
|
Colorbar label |
|
|
|
|
Apply reaction valley projection |
Returns#
matplotlib.colorbar.Colorbar – The created colorbar instance.
Notes#
Draws a
LineCollectioncolored by the average energy of adjacent imagesScatter points with black edge at each image position
Creates and returns a colorbar
Structure Rendering Functions#
render_structure_to_image(atoms, zoom, rotation)#
Renders an ASE Atoms object to a numpy RGBA image array using ASE’s built-in PNG writer.
Parameters#
Parameter |
Type |
Description |
|---|---|---|
|
|
Structure to render |
|
|
Zoom level (used by callers for OffsetImage scaling) |
|
|
ASE rotation string, e.g. |
Returns#
np.ndarray – RGBA image array with shape (H, W, 4) and float dtype.
plot_structure_strip(ax, atoms_list, labels=None, zoom=0.3, rotation”0x,90y,0z”, themecolor=”black”, maxcols=6, renderer=”xyzrender”, labelax=None)=#
Renders a horizontal gallery of atomic structures.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes (turned off) |
|
|
|
Structures to render, or typed strip entries |
|
|
|
|
Labels below each image; inferred from |
|
|
|
Image zoom level |
|
|
|
ASE rotation string |
|
|
|
Label text color |
|
|
|
Maximum columns before wrapping |
|
|
|
Structure rendering backend |
|
|
|
Optional caption-only axis aligned with the structure gallery |
Notes#
Adaptive font size: shrinks for more than 4 items
Multi-row layout with
max_colswrappingxyzrenderrenderer requirespip install 'xyzrender>=0.1.3'StructurePlacementlets callers pass a typed strip payload instead of parallelatoms_list/labelslistsSupplying
label_axkeeps captions out of the structure-image axis and uses matching normalized row and column positions
plot_structure_inset(ax, atoms, x, y, xybox, rad, zoom=0.4, rotation”0x,90y,0z”, arrowprops=None, renderer=”ase”)=#
Plots a single structure as an annotation inset with an arrow.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes |
|
|
|
Structure to render |
|
|
|
Data x coordinate for arrow target |
|
|
|
Data y coordinate for arrow target |
|
|
|
Offset in points for image placement |
|
|
|
Arrow curvature ( |
|
|
|
|
Image zoom level |
|
|
|
ASE rotation string |
|
|
|
Override default arrow properties |
|
|
|
|
Notes#
Default arrow style: Fancy with
head_length=0.4,head_width=0.4,tail_width=0.1Image zorder set to 80 (above most plot elements)
OCI-NEB/RONEB Functions#
plot_mmf_peaks_overlay(ax, peak_rmsd_r, peak_rmsd_p, peak_energies, project_path=True)#
Overlays MMF (mode-following) refinement peak positions on the landscape. Used for OCI-NEB/RONEB to show where dimer refinement was applied.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes (same as landscape) |
|
|
|
RMSD-R coordinates of peak structures |
|
|
|
RMSD-P coordinates of peak structures |
|
|
|
Energy at each peak |
|
|
|
|
Apply reaction valley projection |
Notes#
Draws a dark outer halo marker below each peak and an energy-colored core on top
Colors peak cores by energy using
coolwarmcolormap
plot_neb_evolution(ax, step_rmsd_r_list, step_rmsd_p_list, project_path=True, cmap”Blues”)=#
Shows NEB band evolution across optimization iterations with fading older bands.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Target axes |
|
|
|
RMSD-R arrays per NEB iteration |
|
|
|
RMSD-P arrays per NEB iteration |
|
|
|
|
Apply reaction valley projection |
|
|
|
Colormap for band fading |
High-Level ORCA Functions#
plot_orca_neb_profile(neb_data, output, *, width=7.0, height=5.0, dpi=200)#
Simple ORCA NEB energy profile. Plots image index vs energy with labeled reactant, product, and saddle.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Typed result from |
|
|
|
Output file path |
|
|
|
|
Figure width (inches) |
|
|
|
Figure height (inches) |
|
|
|
Output resolution |
plot_orca_neb_energy_profile(neb_data, output, *, width=5.37, height=5.37, dpi=200, method”hermite”, smoothing=None)=#
Publication ORCA NEB energy profile using the eOn-style plot_energy_path() function.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Typed result from |
|
|
|
Output file path |
|
|
|
|
Figure width (inches) |
|
|
|
Figure height (inches) |
|
|
|
Output resolution |
|
|
|
Interpolation method |
|
|
|
Smoothing parameters |
Notes#
Uses RMSD as reaction coordinate if available, image index otherwise
Applies the
ruhithemeLabels reactant, product, and saddle points
plot_orca_neb_landscape(neb_data, output, *, width=5.37, height=5.37, dpi=200, method”gradmatern", projectpath=True)=#
Publication ORCA NEB 2D landscape using plot_landscape_surface() and plot_landscape_path_overlay().
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Typed result from |
|
|
|
Output file path |
|
|
|
|
Figure width (inches) |
|
|
|
Figure height (inches) |
|
|
|
Output resolution |
|
|
|
Surface interpolation method |
|
|
|
Project to reaction valley coordinates |
Raises#
Exception |
Condition |
|---|---|
|
|
Module: chemparseplot.plot.theme#
PlotTheme#
Frozen dataclass holding all aesthetic parameters.
Field |
Type |
Description |
|---|---|---|
|
|
Theme identifier |
|
|
Font family name |
|
|
Base font size |
|
|
Figure/axes background |
|
|
Text and label color |
|
|
Axes edge color |
|
|
Grid line color |
|
|
Default colormap for profiles |
|
|
Default colormap for landscapes |
|
|
Accent color |
Built-in Themes#
Name |
Font |
Colormap |
Notes |
|---|---|---|---|
|
Atkinson Hyperlegible |
|
Default theme |
|
Atkinson Hyperlegible |
|
Crameri scientific colormap |
get_theme(name, **overrides)#
Retrieves a theme by name, applying optional field overrides.
setup_global_theme(theme)#
Sets plt.rcParams from the theme (font, colors, sizes).
setup_publication_theme(theme)#
Extends setup_global_theme() with publication defaults: spine removal, line widths, DPI 300, tight bbox.
apply_axis_theme(ax, theme)#
Applies theme properties to a specific axes instance (facecolor, spine colors, tick colors).
build_cmap(hex_list, name)#
Builds and registers a LinearSegmentedColormap from hex color strings.
Module: chemparseplot.plot.optimization#
Functions for single-ended method (dimer, minimization) visualization.
plot_optimization_landscape(ax, rmsd_a, rmsd_b, grad_a, grad_b, z_data, *, label_mode”optimization”, projectpath=True, method=”gradmatern", cmap=”viridis”, zlabel=”Energy (eV)”, **surfacekwargs)=#
Wraps plot_landscape_surface() and plot_landscape_path_overlay() with semantically correct axis labels for single-ended methods.
Parameters#
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
All other parameters (including auto_thin, max_surface_points, surface_fit)
are passed through to plot_landscape_surface().
render_single_ended_landscape(...)#
Full single-ended pipeline (min/saddle CLIs). Accepts the same surface-fit
knobs (auto_thin default false, max_surface_points 64, surface_fit).
See plot_landscape_surface above.
plot_optimization_profile(ax, iterations, energies, *, eigenvalues=None, ax_eigen=None, color”#004D40”, eigencolor=”#FF655D”)=#
Plots energy (and optionally eigenvalue) vs iteration.
plot_convergence_panel(ax_force, ax_step, dat_df, *, force_col”convergence”, stepcol=”stepsize", itercol=”iteration”, color=”#004D40”)=#
Plots convergence metrics (force norm and step size) from a trajectory DataFrame.
plot_dimer_mode_evolution(ax, mode_vectors, *, color”#004D40”)=#
Plots alignment of per-iteration dimer mode with the final converged mode (|cos(mode, final)|).
Module: chemparseplot.parse.projection#
Shared (s, d) reaction valley projection utilities.
ProjectionBasis#
Frozen dataclass storing the orthonormal basis vectors for the projection.
Field |
Type |
Description |
|---|---|---|
|
|
RMSD origin (first point) |
|
|
Unit vector along path direction |
|
|
Unit vector perpendicular to path |
|
|
Path length in RMSD space |
compute_projection_basis(rmsd_a, rmsd_b) -> ProjectionBasis#
Computes basis from first/last points of the arrays.
project_to_sd(rmsd_a, rmsd_b, basis) -> (s, d)#
Forward projection from RMSD space to reaction valley coordinates.
inverse_sd_to_ab(s, d, basis) -> (rmsd_a, rmsd_b)#
Inverse transform for grid evaluation on projected surfaces.