trj2fig (energy profile of a trajectory)¶
trj2fig plots the energy along an XYZ trajectory, such as one written by opt, scan, path-opt, path-search, or irc. It reads the energy of each frame from its comment line, or recomputes it with an MLIP (machine-learning interatomic potential) when -q or -m is given. It exports PNG, JPEG, SVG, PDF, or interactive HTML figures and a CSV table. By default it plots ΔE in kcal/mol relative to the first frame.
What it is for¶
Energy profiles of paths: minimum energy path (MEP), scan, and intrinsic reaction coordinate (IRC) trajectories as ΔE plots.
Checking an optimization: how the energy fell over the optimization cycles.
Data for your own plots: per-frame energies as CSV.
Examples¶
1. Default PNG¶
Plot ΔE relative to the first frame and write energy.png.
pdb2reaction trj2fig -i traj.xyz --out-json
The console prints [trj2fig] Saved figure -> energy.png, and result.json has n_frames, the number of frames read.
2. CSV and SVG relative to frame 5, in hartree¶
Write a table and a figure in hartree, relative to frame index 5 (counted from 0, so the sixth frame).
pdb2reaction trj2fig -i traj.xyz -o energy.csv energy.svg -r 5 --unit hartree
3. Several formats, x-axis reversed¶
Put the last frame on the left; ΔE is then relative to the last frame.
pdb2reaction trj2fig -i traj.xyz --reverse-x -o energy.png energy.html energy.pdf
4. Recompute energies with an MLIP¶
Recompute every frame with the default MLIP, UMA, for a neutral singlet instead of reading the comments.
pdb2reaction trj2fig -i traj.xyz -q 0 -m 1 -o energy.png
How it works¶
Reading the energies: Each frame’s comment line gives its energy. Trajectories written by pdb2reaction, such as
optimization_trj.xyz(opt --dump),scan_trj.xyz,mep_trj.xyz, andfinished_irc_trj.xyz, are read as they are. In other files, writeE=<value>with an optional unit (Ha,Eh,hartree,eV,kcal/mol); without a unit it is hartree, except thatenergy=in a comment withProperties=orLattice=(extended XYZ) is eV. With-qor-m, the MLIP backend recomputes every frame instead.Choosing the reference:
-r initis the frame at the left end: the first frame, or the last with--reverse-x; an integer is a 0-based frame index;noneplots absolute energies.Converting the unit: The energies are converted to kcal/mol (default) or hartree, and the reference is subtracted to give ΔE. The y-axis reads
ΔE (kcal/mol), orE (…)for absolute energies.Exporting: Each output gets its format from its extension:
.png,.jpg,.jpeg,.svg,.pdf, and.htmlare figures, and.csvis a table. PNG is written at twice the pixel width and height of the figure.
Output files¶
energy.png # Figure (default when no output is given)
energy.csv # Energy table (when a .csv output is given)
result.json # Summary (with --out-json)
summary.json # Same content as result.json (with --out-json)
CSV columns:
frame,energy_hartree, and the plotted value in the--unitunit. The third column is nameddelta_kcalordelta_hartreewith a reference, andenergy_kcalorenergy_hartreewith-r none.result.jsonis written in the directory of the first output. It hasn_frames,min_energy_hartree,max_energy_hartree,energy_source, andoutput_files; themlip_*fields are null unless the energies were recomputed. See JSON Output Reference.
Main options¶
Option |
Type |
Default |
Description |
|---|---|---|---|
|
path |
(required) |
XYZ trajectory |
|
path |
|
Output files ( |
|
|
|
Unit of the plotted and exported values |
|
text |
|
Reference: |
|
integer |
|
Total charge; recomputes the energies with the MLIP when given |
|
integer |
|
Spin multiplicity (2S+1); recomputes the energies with the MLIP when given |
|
flag |
|
Put the last frame on the left |
|
text |
|
MLIP for recomputation ( |
|
text |
|
Model of the selected backend (e.g. |
|
|
per backend |
Precision of the recomputation (UMA |
|
flag |
|
Write |
See the generated CLI reference for every option.
Notes¶
Recomputation: with only one of
-qand-m, the other is taken as charge 0 or multiplicity 1.Comments without a readable energy, such as one that holds only an integer or several numbers, stop the run with an error that names the frame.
Unsupported extensions stop the run with an error.
Exit codes: see Exit codes.
See also¶
path-search — MEP trajectories to plot
irc — IRC trajectories to plot
energy-diagram — a state energy diagram from numbers you give
all — the full workflow
Troubleshooting — what to do when a run fails; for a failed figure export, see Installation / environment