tsopt¶
pdb2reaction tsopt refines a transition-state (TS) candidate into an optimized first-order saddle point, with a built-in imaginary-frequency check. The candidate can be the highest-energy image (HEI) from path-opt / path-search, or a user-supplied structure.
Pick the optimizer with --opt-mode. The default hess mode is RS-P-RFO
(Restricted-Step Partitioned Rational Function Optimization, Banerjee) and uses
a full Hessian. The grad mode is the Hessian-Guided Dimer alternative
when full-Hessian recomputation is prohibitive or a separate optimization route
is needed. Compare the methods on the actual TS seed and validate the result
with one imaginary mode and IRC connectivity. Enable --flatten (disabled by
default) when the candidate has multiple imaginary frequencies and surplus-mode
cleanup is needed.
tsopt always sets reject_uphill: false for its RFO-family and Dimer
optimizers, including after YAML overrides. A saddle search must be able to
raise the physical energy along the reaction mode. The
--reject-uphill/--no-reject-uphill toggle belongs only to minimum
optimization (opt and post-IRC endpoint re-optimization in all).
At optimizer termination, tsopt retains the final geometry. Terminal exact PHVA runs only after numerical convergence; a non-converged or stalled run stops without PHVA. A PHVA failure is recorded without discarding the structure or fabricating frequencies. Numerical optimizer status is independent of saddle order: first-order certification still requires exactly one imaginary frequency, the intended displacement, and correct irc connectivity. A separate freq run is needed only for full vibrational analysis or thermochemistry.
Terminal outcomes and fatal errors¶
Condition |
|
Composite |
|---|---|---|
Convergence criteria unmet, explicit cycle limit reached, or opt-in energy plateau |
Retain the final geometry and trajectory; skip terminal PHVA |
Register the TS result and stop before IRC |
Terminal PHVA fails |
Retain the geometry and set |
Stop before IRC after artifact registration |
Invalid input/geometry or an unrecoverable optimizer exception such as |
Follow the structured error-envelope path; only files already written are retained on a best-effort basis |
Abort the stage rather than relabelling it as ordinary non-convergence |
If you need a TS guess first, run path-opt (two structures) or path-search (two or more structures), then optimize the HEI with tsopt → irc. For XYZ / GJF inputs, --ref-pdb supplies a reference PDB/mmCIF topology while keeping the XYZ coordinates, enabling format-aware PDB / CIF / GJF companion output.
--ref-mode is an advanced/internal handoff, not a normal requirement for
standalone tsopt. It accepts one or more atom-order-matched Cartesian 3N
candidate directions from .npz, .npy, or whitespace text. The all
workflow supplies CPU/file-cached MEP tangent candidates automatically for
Hessian TS optimizers; legacy paths without readable energies use normalized
secants. Dimer does not consume --ref-mode. With
all --no-tsopt-from-mep-tan, cache creation/use is disabled and TSOPT selects
its initial root from the initial-structure Hessian modes.
The reference direction guides Hessian-root identity and overlap tracking; it
is not an initial Hessian replacement and does not make a failed TS search
successful. Terminal exact PHVA remains authoritative for saddle order.
n_imag = 0 is no_imaginary; n_imag > 1 is higher_order. Neither state
rewrites a numerically converged optimizer result as numerical non-convergence.
A higher-order result may be used only for warning-labelled diagnostic IRC by
all, never as first-order TS certification.
--flatten is a separate, explicit cleanup for surplus imaginary modes. It can
remove extra negative directions but cannot create a missing reaction mode.
Naming note: the CLI accepts
grad/dimer(Dimer),hess/rsprfo(RS-P-RFO, default), andrsirfo(RS-I-RFO) /trim(TRIM). In YAML, use the top-levelhessian_dimer:(Dimer) block, or thersirfo:block (shared by RS-P-RFO, RS-I-RFO, and TRIM), directly.
Two routes to a TS candidate¶
tsopt refines an existing candidate. Select the candidate-generation route
according to the available structural information.
Route |
Subcommand |
Use when |
What it does |
|---|---|---|---|
(a) MEP / path search |
You have both endpoints (reactant and product) and want the TS bracketed automatically |
Recursive minimum-energy-path search (GSM / DMF) with bond-change detection; it auto-segments a multi-step path, refines each reactive segment, and returns the highest-energy image per segment ( |
|
(b) Distance-restrained scan |
You have only the reactant, or want to drive a specific reacting distance directly |
Harmonic distance restraints, |
There is no opt --restraint flag: opt restrains distances with --dist-freeze (harmonic, --bias-k) rather than driving them, and the distance-driven build-up route is scan (which can relax the endpoints around the driven path with --preopt / --endopt). Feed the candidate from either route into tsopt → freq → irc to optimize and validate it.
Examples¶
Default RS-P-RFO optimization of a PDB candidate:
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 --out-dir ./result_tsopt
Dimer mode with analytical Hessian (VRAM permitting):
# Dimer mode with analytical Hessian (VRAM permitting)
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 \
--opt-mode grad --hessian-calc-mode Analytical --out-dir ./result_tsopt_grad
RS-P-RFO mode driven by YAML overrides:
# RS-P-RFO mode driven by YAML overrides
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 \
--opt-mode hess --config tsopt.yaml --out-dir ./result_tsopt_hess
RS-P-RFO mode with surplus-imaginary-mode flattening enabled:
# RS-P-RFO mode with surplus-imaginary-mode flattening enabled
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 \
--opt-mode hess --flatten --out-dir ./result_tsopt_flatten
Add --dump to keep the full optimization trajectory for inspection.
Workflow¶
Charge / spin are resolved via the standard priority chain (see CLI Conventions: Charge specification).
Geometry loading + freeze-links — structures are read through
pysisyphus.helpers.geom_loader. When--freeze-linksis active, cap-hydrogen parent atoms are automatically frozen (see Cap hydrogen and frozen atoms).MLIP Hessians (default UMA) —
--hessian-calc-modetoggles analytical vs finite-difference; both honor active (PHVA) subspaces. The MLIP backend may return only the active block when frozen atoms are present. See Hessian evaluation mode for the full Hessian-evaluation matrix.Dimer mode — the Hessian-Guided Dimer stage periodically refreshes the dimer direction by evaluating an exact Hessian in the active subspace. It uses the fixed constrained rigid-mode treatment, which removes only full-system rigid motions compatible with frozen anchors. Every stored, rotated, and trial orientation has frozen Cartesian components set to zero, and every off-center force evaluation retains the central image’s frozen coordinates exactly. The lowest eigenpair uses
torch.lobpcgwhenroot == 0, falling back totorch.linalg.eigh. With--flatten, the active Hessian is updated via a Bofill update (an SR1/MS ↔ PSB blend; toggle viahessian_dimer.flatten_loop_bofill) using displacements Δx and gradient differences Δg. Each flatten loop:estimates imaginary modes, flattens once, and refreshes the dimer direction;
runs a Dimer + L-BFGS micro-segment;
optionally performs a Bofill update.
At termination, one exact PHVA is produced after numerical convergence; a non-converged or stalled run retains the final geometry and skips PHVA. If
root != 0, that root seeds only the initial dimer direction; subsequent refreshes follow the most negative mode (root = 0).RS-I-RFO mode — runs the RS-I-RFO optimizer with optional Hessian reference files, R+S splitting safeguards, and micro-cycle controls defined in the
rsirfoYAML section. With--flatten, when more than one imaginary mode remains after convergence the workflow flattens extra modes and reruns RS-I-RFO until only one imaginary mode remains or the flatten-iteration cap is reached.Mode export + conversion — imaginary modes smaller than the configured magnitude threshold (5 cm⁻¹ by default) are ignored; the remaining modes are written to
vib/imag_*_trj.xyz. With conversion enabled, PDB inputs receive.pdbcompanions and mmCIF/oversized-PDB bridge inputs receive.pdbplus.cif; Gaussian templates receive a.gjfcompanion for the final geometry only.
Outputs¶
Validate a run from result.json, the final geometry in final_geometry.*, and the vib/imag_* modes (expect exactly one for a valid TS).
out_dir/ (default: ./result_tsopt/)
├─ final_geometry.xyz # Always written
├─ final_geometry.pdb # PDB/mmCIF topology input (conversion enabled)
├─ final_geometry.cif # mmCIF/oversized-PDB bridge input
├─ final_geometry.gjf # When the input was Gaussian (conversion enabled)
├─ optimization_all_trj.xyz # Dimer-mode dump (--dump)
├─ optimization_all.pdb # Dimer-mode PDB companion (--dump, topology input)
├─ optimization_all.cif # Bridge-input companion with original IDs
├─ optimization_trj.xyz # RS-P-RFO/RS-I-RFO/TRIM trajectory (--dump)
├─ optimization.pdb # RFO-mode PDB companion (--dump)
├─ optimization.cif # Bridge-input companion with original IDs
├─ vib/
│ ├─ imag_±XXXX.Xcm-1_trj.xyz
│ ├─ imag_±XXXX.Xcm-1.pdb
│ └─ imag_±XXXX.Xcm-1.cif # Bridge input
└─ .dimer_mode.dat # Dimer-mode orientation seed
Exit codes: see Exit codes in CLI Conventions.
CLI options¶
Command form:
pdb2reaction tsopt -i INPUT.{pdb|xyz|trj|...} [-q CHARGE] [-l 'RES:Q,...'] [-m 2S+1] \
[-b uma|orb|mace|aimnet2] [--opt-mode grad|hess|dimer|rsirfo|trim|rsprfo] [--flatten / --no-flatten] \
[--freeze-links / --no-freeze-links] [--max-cycles N] [--thresh PRESET] \
[--hessian-calc-mode Analytical|FiniteDifference] \
[--convert-files / --no-convert-files] [--ref-pdb FILE]
pdb2reaction tsopt --help shows core options; pdb2reaction tsopt --help-advanced shows the full option list. For full input-file requirements (hydrogens, element columns, atom-order parity, charge specification), see CLI Conventions.
The tables below cover the options that need explanation. The full flag list is in the generated command reference.
Option |
Description |
Default |
|---|---|---|
Input & charge |
||
|
One geometry ( |
Required |
|
Net charge. Required unless a |
Required unless template / derivation applies |
|
Either a scalar integer (e.g. |
None |
|
Spin multiplicity (2S+1). |
|
|
Reference PDB/mmCIF topology when the input is XYZ / GJF (keeps XYZ coordinates). |
None |
Backend & compute |
||
|
MLIP backend. |
|
|
UMA predictor parallelism. |
|
|
MLIP Hessian mode ( |
|
Active-region freezing |
||
|
PDB/mmCIF input (or XYZ/GJF with |
|
|
Comma-separated 1-based atom indices to freeze explicitly (e.g. |
None |
TS optimizer & mode |
||
|
TS optimizer preset (Choice: |
|
|
Advanced/internal Cartesian reference candidate(s) from |
None |
|
Enable surplus-imaginary-mode flattening for Dimer and the RS-P-RFO / RS-I-RFO / TRIM Hessian family. |
|
|
Optimization coordinate system ( |
|
|
MLIP backend precision, routed to the backend-native kwarg (UMA |
per backend (uma |
Thresholds & cycles |
||
|
Override convergence preset ( |
|
|
Macro-cycle cap forwarded to |
|
Output & config |
||
|
Output directory. |
|
|
Toggle XYZ/TRJ → PDB/CIF/GJF companions according to the input topology/template. |
|
|
Dump trajectories. |
|
|
Write a machine-readable |
|
|
Base YAML configuration applied before explicit CLI options. |
None |
|
Print resolved config layers and continue execution. |
|
|
Validate inputs / config and print the execution plan without running TS optimization. |
|
--flatten precedence caveat¶
Note
--flatten is disabled by default (precedence caveat). Although defaults.py defines flatten_max_iter: 50, the CLI initializer seeds flatten_max_iter = 0. Effective resolution:
CLI
--flattennot passed →flatten_max_iter = 0unless explicitly set in YAML viahessian_dimer.flatten_max_iter(the flatten counter is read only from thehessian_dimerblock for both Dimer and RS-I-RFO paths). Thedefaults.pyvalue of 50 is ignored.CLI
--flattenpassed → the YAML /defaults.pyvalue applies (defaultflatten_max_iter = 50); you can still override via YAML.CLI
--no-flattenpassed →flatten_max_iter = 0, overriding YAML.
If your TS candidate has multiple imaginary frequencies, add --flatten to enable the surplus-mode cleanup loop.
If TS optimization still fails from a path HEI, there are two distinct retries:
Add
--flattenwhen the candidate retains surplus imaginary modes.In the
allworkflow, use--refine-pathto run recursivepath-searchand obtain a better-resolved HEI before TSOPT.
The second retry is intentionally not the default: a poor or noisy path can be split into unnecessary elementary segments, multiplying MEP, TSOPT, IRC, and frequency work. Inspect the unrefined MEP first and enable recursive refinement only when the coarse HEI is the likely cause.
Wrong imaginary-mode count after optimization¶
A true first-order saddle has exactly one imaginary frequency, and its mode displaces along the reaction coordinate. If tsopt instead reports a spurious second small imaginary mode, or no dominant reaction mode, escalate the following levers — they are complementary, so you can combine them:
Lever |
Flag |
Effect |
|---|---|---|
Compare precision |
`–precision fp32 |
fp64` |
Internal coordinates |
|
Changes the optimization conditioning. Benchmark |
Flatten small modes |
|
Runs an extra-imaginary-mode flattening loop ( |
Inspect the mode displacements and optimizer stop reason, then retry an appropriate supported precision/coordinate setting and use --flatten only for surplus modes. For example:
pdb2reaction tsopt -i ts_candidate.xyz -q -1 -m 1 \
--precision fp64 --coord-type dlc --flatten -o result_tsopt
See also Common Error Recipes → Convergence and post-processing failures.
Reading a barrier scanned from the product side¶
If the scan (or path) that produced this TS candidate started from the product, the raw barrier it reports is the reverse barrier, E(TS) − E(product). The forward barrier you usually want is computed from the reactant:
You ran |
Forward barrier |
|---|---|
A product-start scan |
|
This is a read-time interpretation, not a flag. Always confirm which endpoint the scan started from before quoting a barrier, especially when the workflow was seeded from a crystallographic product complex. See also scan → Scan direction and barrier sign.
Controlled mutant-vs-WT comparison¶
Do not confuse the MEP input contract with a cross-variant comparison. Within each R→IM→P path, all structures must contain the same atoms in the same order. A real WT→mutant substitution may change residue identity and atom count, so raw total energies from WT and mutant must not be subtracted directly. Compare the activation energy or free energy computed within each system instead:
ΔΔG‡ = (G_TS − G_R)_mutant − (G_TS − G_R)_WT.
Match the selected residue positions and cluster-boundary/cap policy as closely as chemically meaningful, with the intended mutation as the only designed composition change. Compare independent radius-based extractions, because a boundary residue can enter one cluster but not the other.
Keep protonation, charge-assignment convention, backend/model, precision, constraints, and thermochemistry settings controlled. The verified total charge itself may legitimately differ if the mutation changes protonation or formal charge; do not force equal
-qvalues to make the comparison look symmetric.For two mechanisms of the same composition, use one common atom set and ordering across the compared paths.
# Each path is internally atom-consistent; the two clusters use matched boundaries.
pdb2reaction all -i wt_cluster.pdb -l 'GPP:-3,SAM:1' --tsopt --thermo -o result_wt
pdb2reaction all -i mutant_cluster.pdb -l 'GPP:-3,SAM:1' --tsopt --thermo -o result_mutant
YAML configuration¶
Shared sections reuse YAML Reference; adjust only the values you need to change. geom and calc are unchanged from canonical — see geom and calc. The opt block uses the same keys as opt with these tsopt-specific defaults:
opt:
thresh: baker # tsopt default (vs. `gau` for `opt`)
out_dir: ./result_tsopt/ # tsopt default (vs. `./result_opt/` for `opt`)
Note
Energy-plateau stop (opt-in, default off). Hessian-family TS optimizers
(RS-P-RFO, RS-I-RFO, TRIM, and Dimer) honor the shared energy_plateau setting, which
--stop-plateau turns on. An energy range below --stop-plateau-thresh
(default 1×10⁻⁴ au over the last 50 steps) stops the search as stalled and
skips terminal PHVA, as does reaching max_cycles without convergence. This can save cycles when a
backend/model/system-specific force floor prevents the selected force threshold
from being reached. It is off unless you ask for it, because a TS search that
stops on a flat energy typically still carries extra imaginary modes.
Dimer mode (--opt-mode grad)¶
Used with --opt-mode grad (Hessian-Guided Dimer + L-BFGS translation). The full hessian_dimer block, including its sibling dimer: and lbfgs: sections, is documented in hessian_dimer. The option names under hessian_dimer.lbfgs follow the lbfgs schema, and tsopt reads their values from this sibling section:
hessian_dimer:
lbfgs:
out_dir: ./result_tsopt/ # tsopt override (defaults.py value is ./result_opt/)
RS-P-RFO / RS-I-RFO mode (--opt-mode hess, default → RS-P-RFO)¶
Used with --opt-mode hess (RS-P-RFO, the default; rsirfo selects RS-I-RFO and trim selects TRIM — all three share this block). The full rsirfo block is documented in rsirfo (which inherits trust-region and Hessian-update keys from rfo). tsopt-specific overrides:
rsirfo:
trust_max: 0.10 # maximum trust radius (bohr)
out_dir: ./result_tsopt/ # tsopt override (defaults.py value is ./result_opt/)
hessian_recalc: 500 # rebuild exact Hessian every N macro steps
saddle_recovery_max_cycles: 0 # automatic n_imag=0 recovery is disabled
Tip
Set rsirfo.track_mode_by_overlap: true if the TS mode switches root during optimization (e.g. when multiple imaginary frequencies are present). If TS convergence is slow, lowering hessian_recalc (e.g. to 50–200) gives more frequent exact Hessian updates at the cost of additional evaluations. Automatic curvature recovery can be enabled through YAML by setting saddle_recovery_max_cycles above zero, but it is not part of the default search.
Notes¶
Imaginary frequencies smaller than the configured threshold (5 cm⁻¹ by default) are ignored consistently by final TS validation, mode-file output, and flattening.
Hessian-family optimizers follow exactly one root for a first-order TS. Set it as a one-item YAML list (for example,
rsirfo.roots: [0]); empty or multi-root lists are rejected. Dimer uses the separate singularhessian_dimer.rootkey (default0).tsopthas no--rootCLI flag, unlikeirc.Use
--opt-modeto choose the algorithm directly (rsprfoby default) rather than editing YAML mode mappings.Dimer orientation, rotation forces, flattening, and final exact PHVA validation use the same constrained projector as
freq. The Dimer rebuilds this basis whenever its central image changes. It never subtracts translations of the active fragment unless they are actual rigid null directions compatible with every frozen anchor. Hessian RFO optimization itself operates on the active-DOF Cartesian Hessian without this projection. See Frozen Atoms.See CLI Conventions: Configuration precedence for the full resolution order.
See Also¶
Common Error Recipes · Troubleshooting · path-search · irc · freq · all · YAML Reference · Glossary.