trj2fig¶
Overview¶
trj2fig converts an XYZ trajectory with energy values (obtained from the pdb2reaction workflow) into plot images. By default it
reads the energies (in hartree) encoded in each frame’s comment line, converts them
to kcal/mol or hartree, optionally references all values to a chosen frame, and
exports the resulting series as static/interactive figures and CSV tables. The
reference can be the first frame or set manually (-r), and the last frame when --reverse-x is
used. When you supply -q/--charge and/or
-m/--multiplicity, all energies are recomputed for every frame with the
MLIP backend (default UMA; see -b/--backend) using the provided charge/spin instead of the comment
lines.
Usage¶
pdb2reaction trj2fig -i TRAJECTORY.xyz [-o OUTPUTS...] [-q CHARGE] [-m MULT] [options]
Examples¶
# Default PNG, ΔE relative to the first frame
pdb2reaction trj2fig -i traj.xyz
# CSV + SVG with ΔE relative to frame 5, reported in hartree
pdb2reaction trj2fig -i traj.xyz -o energy.csv energy.svg -r 5 --unit hartree
# Multiple figure formats with the x-axis reversed (reference becomes last frame)
pdb2reaction trj2fig -i traj.xyz --reverse-x -o energy.png energy.html energy.pdf
# Recompute all frame energies with UMA before plotting
pdb2reaction trj2fig -i traj.xyz -q 0 -m 1 -o energy.png
Workflow¶
Parse the XYZ trajectory. By default, read the first floating-point number found in every frame comment (scientific notation such as
1.5e-3is supported). If-q/-mis present, recompute energies (in hartree) for each frame with the MLIP backend using those charge/spin values instead of the comment. If no energies are found or produced, the run aborts.Normalize the reference specification:
init→ frame0(or the last frame when--reverse-xis active).None/none/null→ absolute energies (no referencing).Integer literal → the corresponding 0-based frame index.
Convert energies to either kcal/mol (default) or hartree and, when a reference is active, subtract the reference value to produce ΔE.
Build the Plotly figure (strong ticks, spline interpolation, markers, no title) and export it to every requested extension.
Optionally emit a CSV table with columns
frame,energy_hartree, and the appropriate ΔE/E column in the requested unit.
CLI options¶
Option |
Description |
Default |
|---|---|---|
|
XYZ trajectory whose second line stores energies. |
Required |
|
Repeatable output filenames; supports |
|
extra arguments |
Positional filenames listed after options; merged with the |
None |
|
Target unit for the plotted/exported values. |
|
|
Reference specification ( |
|
|
Total charge; triggers energy recomputation when provided. |
None |
|
Spin multiplicity (2S+1); triggers energy recomputation when provided. |
None |
|
Reverse the x-axis so the last frame appears on the left (and |
|
|
MLIP backend for energy recomputation. |
|
|
Implicit solvent name for xTB correction (e.g. |
|
|
xTB solvent model. |
|
|
Write a machine-readable |
|
Outputs¶
<output>.[png|jpg|jpeg|html|svg|pdf] # Plotly export for every requested extension (defaults to energy.png)
<output>.csv # Optional energy table when CSV is requested
When no
-oor positional outputs are provided, a singleenergy.pngis written to the current directory. CSV exports includeframe,energy_hartree, and either a ΔE column (delta_kcal/delta_hartree) or absolute column (energy_kcal/energy_hartreewhen no reference is applied).Console diagnostics describing parsing failures or unsupported extensions.
Notes¶
Energies are taken from the first decimal number in each comment; malformed comments raise an error.
Unsupported extensions abort the run;
.pnguses Plotly’s PNG export withscale=2for sharper output.--reverse-xflips both the axis direction and the behavior of-r initso that the initial frame appears on the right side of the plot.
See Also¶
Common Error Recipes – Symptom-first failure routing
Troubleshooting – Detailed troubleshooting guide
path-search – MEP trajectories for profiling
irc – IRC trajectories for profiling
all – End-to-end workflow