Surrogate-assisted saddle searches¶
These commands draw searches that answer most force calls from a fitted
surrogate and spend a counted number of calls on the true potential (the
oracle): a Gaussian-process NEB, a GP dimer, or ASE/CatLearn ML-NEB. The
drawing lives in chemparseplot.plot.surrogate and the records it takes in
chemparseplot.parse.surrogate. The commands read a search directory,
call one function per figure, and save PNG, PDF or SVG.
Added in version 1.12.0.
Commands¶
Command |
Input |
Files written (after |
|---|---|---|
|
a search directory (cell or ML-NEB run) |
|
|
a search directory; |
|
|
a gproptimdimer cell |
|
|
a campaign record |
|
|
a per-repetition wall-time CSV |
|
|
a tidy per-case CSV (and a baseline CSV) |
|
|
a per-repetition wall-time CSV or a JSON table |
|
|
fixed-work CSVs (ranks, threads, wall, factor columns) |
|
|
a tidy per-component CSV (cell, ranks, threads, repetition, component, seconds) |
|
Every command takes --format png|pdf|svg and --dpi. Run
rgpycrumbs surrogate <command> --help for the options.
Example¶
A cell of a gproptimcampaign, drawn two ways:
rgpycrumbs surrogate plt-band results/rec/baker/25_hcnh2 -o figs/hcnh2
rgpycrumbs surrogate plt-history results/rec/baker/25_hcnh2 -o figs/hcnh2
The first writes figs/hcnh2-profile.png and figs/hcnh2-evolution.png,
the second figs/hcnh2-convergence.png and figs/hcnh2-diagnostics.png.
To see where a run spent calls another did not, name both:
rgpycrumbs surrogate plt-history rec_old/baker/25_hcnh2 \
--against rec_new/baker/25_hcnh2 -o figs/hcnh2-regression
-comparison puts the true force of both runs on shared axes and stacks
their oracle calls by phase (endpoints, initial band, outer loop,
transition, dimer).
Baselines for a campaign come from JSON objects {"<cell label>": calls}:
rgpycrumbs surrogate plt-campaign results/rec -o figs/rec \
--baseline "ASE ML-NEB=baselines/mlneb.json"
Producers¶
--producer gpr_optim (default) reads a campaign cell: result.json,
band/band.h5, band/gprn.log and the MLflow store at <record>/mlruns.
--producer ml-neb reads predicted.traj, evaluated.traj and
ml_summary.txt. A producer that stores only the final band (gproptim)
gets the acquisition record in place of band snapshots in -evolution;
quantities a producer did not write (predictive sigma, true profile) are
left out of the figure, not drawn as zero.
Reproducible output¶
Fonts are embedded, no timestamp is written, and the SVG id salt is fixed,
so the same inputs give the same bytes. Each file embeds a JSON description:
the SHA-256 of every input, the command line and the versions of
chemparseplot, matplotlib and numpy. The same description sits in
<file>.provenance.json.
The scripts pin chemparseplot to a commit in their inline metadata until
the release carrying chemparseplot.plot.surrogate exists; the pin is then
replaced by a version range.
Strong scaling¶
rgpycrumbs surrogate plt-scaling strong_scaling_wall.csv \
--counts strong_scaling_counts.csv --stage pipeline -o figs/strong \
--pop fixed_work.csv --pop-metric load_balance --pop-metric comm_eff
The wall CSV has cell, ranks, threads, repetition, stage, seconds, calls;
the call count comes from the search rows. -<cell>-strong has four
panels per cell with one tick per ranks x threads layout: wall time with
the slowest and fastest repetition, speedup against the ideal line,
oracle calls in the search and seconds per call (the last two show when the
search path changes with the layout). Open markers are runs the counts file
marks passed=False. -efficiency has one row per layout. --pop takes a
fixed-work CSV with ranks, threads, an optional cell and the columns
named by --pop-metric; each is drawn as an efficiency per layout.
Wall-time breakdown¶
rgpycrumbs surrogate plt-breakdown strong_scaling_wall.csv -o figs/bd \
--component band_oracle --component band_refit --component dimer_oracle
One figure per cell: median seconds of each --component stage stacked per
ranks x threads layout, the remainder of --total (default pipeline) as
other, the total printed above each bar. Components must not nest.
Fonts¶
Every command takes --font FAMILY and --font-dir DIR (repeatable). The
family is looked up through fontconfig, $CHEMPARSEPLOT_FONT_DIRS, the
user and system font directories and --font-dir; every face found is
registered with matplotlib, and text and math text use it. If no file for
the family exists, the command fails naming the family and where it looked.
Per-case boards¶
rgpycrumbs surrogate plt-cases cases.csv -o figs/cases --baseline baselines.csv \
--reference-label "earlier record" --font Jost
cases.csv has one row per case: board, case, label, search_calls, validation_calls, pipeline_wall_s, certified and optionally
reference_pipeline_wall_s. One panel per board, rows in file order,
titled with the count of certified cases. -calls stacks search and
independent-validation evaluations; baseline markers (open where the
method did not converge) come from a long CSV board, case, method, calls, converged. -wall is a log-axis bar per case with a tick at the reference
time.
Band landscape¶
plt-band --panel landscape draws the same progress/deviation landscape as
rgpycrumbs eon plt-neb, through the same chemparseplot functions
(plot_landscape_surface, plot_landscape_path_overlay,
mark_saddle_point): axes are the reaction progress s and the orthogonal
deviation d (RMSD, angstrom) of the straight reactant-to-product line, the
energy colour scale is the theme landscape map. The legend names every mark:
the GP energy surface and its dashed relative-variance contours, fitted to the oracle evaluations (energy and the in-plane part of the true gradient);
--no-landscape-surfaceomits both;the oracle evaluations as dots, filled by true energy or, with
--landscape-color iteration, shaded by order of evaluation (with a colourbar);--landscape-label-every Kalso numbers every K-th, and the legend then says the numbers are the order of evaluation;the final path (coloured by the surrogate energy), the climbing image (ring) and the saddle the search reports (gold star, “certified” when the cell passed).
The surface is a fresh GP fit to the oracle energies and the in-plane gradient
components in the reduced (s, d) plane; it is not the search’s own model,
which the record does not store. Where the relative variance is above
--landscape-fade-variance (default 0.95, the outermost labelled contour)
the surface is faded to the background, so no confident surface is drawn
where nothing was evaluated; 1 keeps all of it. Use --title, --font and --font-dir as for the
other panels.
Structure strip¶
Under the profile and the landscape plt-band draws the strip of structures
rgpycrumbs eon plt-neb draws (the same plot_structure_strip, renderer and
layout constants): --plot-structures crit_points (default) shows the
reactant R, the saddle SP (or the climbing image CI when it differs from the
reported saddle) and the product P; all shows every band image; none
leaves the strip out. --n-structures N draws N evenly spaced images,
always including R, SP and P. R, SP and P are captioned on the strip and
labelled at their points on the curve or the landscape; the legend says what
the letters mean. --strip-renderer picks the backend (default xyzrender).
The elements come from the record: band/band.con, then saddle/pos.con
(checked for the band’s atom count). --types-from FILE takes any
ASE-readable geometry file, or a .con, with the atoms in the band’s order.
If neither source exists the command stops and names the files it looked
for; it never draws a strip with guessed elements. --font applies to the
captions.
Legend size and critical-point letters¶
Every figure command takes --legend-fontsize PT (default: each figure’s
own 8 or 9 pt). The landscape and the profile with a strip size themselves
around the legend, choosing one or two columns and growing the figure, so a
larger legend is not cut off. --label-critical-points puts R, SP (or CI)
and P on the profile’s curve and on the landscape’s path; it is on whenever
the strip is drawn and can be selected with --plot-structures none when the
structures are shown in another figure.
Landscape window¶
--landscape-window square (default) is the equal-metric square window of
plt-neb. fit crops it to the part of the surface that is not faded plus
every oracle evaluation, the final path and the saddle, with a small margin,
and keeps the same angstrom scale on both axes: the map becomes a rectangle,
and the figure with its strip and legend gets shorter.
--landscape-xlim MIN MAX and --landscape-ylim MIN MAX set the window
explicitly. The legend wraps into two columns whatever --legend-fontsize is.