Batch Figure Generation Tutorial

What You Will Build

Three publication-quality PDF figures from a single command:

  1. A convergence plot (oracle calls vs force)

  2. A 2D PES contour with NEB path overlay

  3. An RFF quality comparison (two-panel)

All from one TOML config file and pre-existing HDF5 data.

Prerequisites

pip install rgpycrumbs chemparseplot h5py plotnine

You need HDF5 files produced by chemgp-core examples. The default pipeline stores them in an output/ directory.

Write the TOML Config

Create a file my_figures.toml:

[defaults]
input_dir = "output"
output_dir = "output"

[[plots]]
input = "leps_minimize.h5"
output = "leps_convergence.pdf"
type = "convergence"

[[plots]]
input = "leps_neb.h5"
output = "leps_surface.pdf"
type = "surface"

[[plots]]
input = "leps_rff.h5"
output = "leps_rff_quality.pdf"
type = "rff"

Each [[plots]] entry maps one HDF5 input to one PDF output. The type field selects the plt-gp subcommand (convergence, surface, rff, etc.).

Paths in input and output resolve relative to input_dir and output_dir respectively. Both default to the directory containing the TOML file.

Generate the Figures

rgpycrumbs chemgp plt-gp batch --config my_figures.toml

Output:

INFO - [1/3] convergence: output/leps_minimize.h5 -> output/leps_convergence.pdf
INFO - [2/3] surface: output/leps_neb.h5 -> output/leps_surface.pdf
INFO - [3/3] rff: output/leps_rff.h5 -> output/leps_rff_quality.pdf
INFO - Done: 3 ok, 0 skipped, 0 failed

Customizing Entries

Extra keys in a [[plots]] entry pass through as CLI flags. For example, to override figure dimensions and energy clamping:

[[plots]]
input = "mb_neb.h5"
output = "mb_surface.pdf"
type = "surface"
width = 10.0
height = 8.0
clamp_lo = -200
clamp_hi = 50

Any key that matches a CLI option on the corresponding subcommand (with underscores replacing hyphens) works here.

Landscape Entries

The landscape type uses source_dir instead of input, because it reads .con and .dat files rather than HDF5:

[[plots]]
source_dir = "output"
output = "leps_landscape.pdf"
type = "landscape"

This delegates to rgpycrumbs chemgp plt-neb under the hood.

Next Steps