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 and exports figures and a CSV table.
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.
mlmm 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).
mlmm 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.
mlmm trj2fig -i traj.xyz --reverse-x -o energy.png energy.html energy.pdf
4. Recompute energies with an MLIP¶
Recompute every frame as a neutral singlet with a chosen UMA model and precision instead of reading the comments, and record the backend in result.json.
mlmm trj2fig -i traj.xyz -q 0 -m 1 -b uma --backend-model uma-s-1p2 \
--precision fp32 -o energy.png energy.csv --out-json
How it works¶
Reading the energies: Each frame’s comment line gives its energy. Trajectories written by mlmm, 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, exceptenergy=in extended XYZ (a comment withProperties=orLattice=), which is eV. With-qor-m, the MLIP (machine-learning interatomic potential) backend recomputes every frame instead.Choosing the reference:
-r init(the default) is 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(trajectory_commentormlip_recomputed), andoutput_files, the written files in order.mlip_backend,mlip_model,mlip_model_label,mlip_task, andmlip_precisionare filled only when the energies were recomputed, and are null otherwise. 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 of the frame; 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.Recomputed energies are MLIP energies: the MLIP computes every atom of the frame, with no ML/MM split, so the result is not the ML/MM ONIOM energy. To plot the ONIOM energy of an mlmm trajectory, read its comment lines (no
-qor-m).Comments without a readable energy 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