tsopt¶
Overview¶
Summary: Optimize a transition-state candidate using RS‑I‑RFO (Restricted-Step Image Rational Function Optimization) (
--opt-mode hess, default) or, as an alternative when RS‑I‑RFO struggles, Hessian-Guided Dimer (--opt-mode grad).tsoptperforms a final Hessian calculation and imaginary-frequency check automatically; a validated TS (first-order saddle point) should show exactly one imaginary frequency. Always confirm endpoint connectivity withirc.
At a glance¶
Use when: You have a TS guess (HEI from
path-opt/path-search, or your own structure) and need to refine it into an optimized first-order saddle point with a built-in imaginary-frequency check.Method:
--opt-mode hess(rsirfo) = RS‑I‑RFO with full Hessian (default, more reliable for most systems);--opt-mode grad(dimer) = Hessian-Guided Dimer (alternative when RS‑I‑RFO fails to converge or full-Hessian recomputation is prohibitive).--flatten(default disabled) controls surplus-imaginary-mode cleanup.Outputs:
final_geometry.{xyz,pdb,gjf},vib/imag_*_trj.xyz(and.pdbfor PDB inputs); optimization trajectories with--dump.Defaults:
--opt-mode hess(RS-I-RFO),--thresh baker,--hessian-calc-mode FiniteDifference,--max-cycles 10000,--flattendisabled, backenduma.Next step: The result is still a candidate until irc confirms endpoint connectivity. A separate freq run is only needed for full vibrational analysis or thermochemistry.
Choosing --opt-mode¶
Use
--opt-mode hess(RS‑I‑RFO) when you want the default, conservative optimizer and you can afford Hessian work.Use
--opt-mode grad(Dimer) when you want a lighter-weight search, or when you plan to iterate quickly from several TS guesses.
Naming note: The CLI accepts
grad|dimer(= Dimer) andhess|rsirfo(= RS-I-RFO, default). In YAML, use the top-levelhessian_dimer:(Dimer) orrsirfo:(RS-I-RFO) blocks directly.
For XYZ/GJF inputs, --ref-pdb supplies a reference PDB topology while keeping XYZ coordinates, enabling format-aware PDB/GJF output conversion. If you need a TS guess first, run path-opt (two structures) or path-search (two or more structures) and then optimize the HEI with tsopt (which includes an imaginary-frequency check) → irc.
Minimal example¶
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 --out-dir ./result_tsopt
Output checklist¶
result_tsopt/final_geometry.pdb(orfinal_geometry.xyz)result_tsopt/vib/imag_*_trj.xyzresult_tsopt/vib/imag_*.pdb(for PDB inputs)
Common examples¶
Use dimer mode with analytical Hessian when VRAM is sufficient.
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 \
--opt-mode grad --hessian-calc-mode Analytical --out-dir ./result_tsopt_grad
Keep the optimization trajectory for inspection.
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 --dump --out-dir ./result_tsopt_dump
Run rsirfo mode with YAML overrides.
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 \
--opt-mode hess --config tsopt.yaml --out-dir ./result_tsopt_hess
Run rsirfo mode with flattening enabled.
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 \
--opt-mode hess --flatten --out-dir ./result_tsopt_flatten
Usage¶
pdb2reaction tsopt -i INPUT.{pdb|xyz|trj|...} [-q CHARGE] [-l, --ligand-charge <number|'RES:Q,...'>] [-m 2S+1] \
[-b/--backend uma|orb|mace|aimnet2] [--solvent SOLVENT] [--solvent-model alpb|cpcmx] \
[--opt-mode grad|hess|dimer|rsirfo] [--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]
Examples¶
# Recommended baseline: specify charge/multiplicity and use rsirfo
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 --opt-mode hess --out-dir ./result_tsopt/
# Dimer mode with YAML overrides, finite-difference Hessian, and freeze-links handling
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 --freeze-links \
--opt-mode grad --max-cycles 10000 --no-dump \
--out-dir ./result_tsopt/ --config ./args.yaml \
--hessian-calc-mode FiniteDifference
# RS-I-RFO mode driven entirely by YAML
pdb2reaction tsopt -i ts_cand.pdb -q 0 -m 1 --opt-mode hess \
--config ./args.yaml --out-dir ./result_tsopt/
Workflow¶
Charge/spin resolution: Charge is resolved via the standard priority chain (see CLI Conventions: Charge specification for details).
Geometry loading & freeze-links: structures are read via
pysisyphus.helpers.geom_loader. When--freeze-linksis active, link-hydrogen parent atoms are automatically frozen (see Link hydrogen and frozen atoms).MLIP Hessians (default: UMA):
--hessian-calc-modetoggles between analytical and finite-difference evaluations; both honor active (PHVA) subspaces. The MLIP backend may return only the active block when frozen atoms are present. For Hessian evaluation modes, see Hessian evaluation mode.Dimer mode details:
The Hessian Guided Dimer stage periodically refreshes the dimer direction by evaluating an exact Hessian (active subspace, TR-projected) and prefers
torch.lobpcgfor the lowest eigenpair whenroot == 0(falling back totorch.linalg.eigh).When enabled (
--flatten), the flatten loop updates the stored active Hessian via Bofill (SR1/MS ↔ PSB blend; toggle viahessian_dimer.flatten_loop_bofill) using displacements Δx and gradient differences Δg. Each loop estimates imaginary modes, flattens once, refreshes the dimer direction, runs a dimer+LBFGS micro-segment, and (optionally) performs a Bofill update. Once only one imaginary mode remains, a final exact Hessian is computed for frequency analysis.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. When--flattenis enabled and 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: all detected imaginary modes are written to
vib/imag_*_trj.xyzand mirrored to.pdbwhen the input was PDB and conversion is enabled. The optimization trajectory and final geometry are also converted to PDB via the input template when--dump; Gaussian templates receive a.gjfcompanion for the final geometry only.
CLI options¶
Option |
Description |
Default |
|---|---|---|
|
Structure file accepted by |
Required |
|
Net charge. Required unless a |
Required unless template/derivation applies |
|
Per-residue charge mapping (e.g., |
None |
|
MLIP predictor parallelism (workers > 1 disables analytic Hessians). See workers > 1 silent FD downgrade for diagnostic notes. |
|
|
Workers per node, forwarded to the parallel predictor. |
|
|
Spin multiplicity (2S+1). |
|
|
PDB-only. Freeze parents of link hydrogens (merged into |
|
|
Comma-separated 1-based atom indices to freeze explicitly (e.g., |
None |
|
Macro-cycle cap forwarded to |
|
|
Optimizer preset: |
|
|
Dump trajectories. |
|
|
Output directory. |
|
|
Override convergence preset ( |
|
|
Enable the surplus-imaginary-mode flattening loop ( |
|
|
MLIP Hessian mode ( |
|
|
Toggle XYZ/TRJ → PDB/GJF companions for PDB or Gaussian inputs. |
|
|
Reference PDB topology to use when the input is XYZ/GJF (keeps XYZ coordinates). |
None |
|
Base YAML configuration file applied before explicit CLI options. |
None |
|
Print resolved config layers and continue execution. |
|
|
Write a machine-readable |
|
|
MLIP backend. |
|
|
Implicit solvent name for xTB correction (e.g. |
|
|
xTB solvent model. |
|
|
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 (and the YAML table below shows flatten_max_iter: 50), the CLI initializer forces flatten_max_iter = 0 unless --flatten is explicitly passed on the command line. In other words, the effective value is:
CLI
--flattennot passed →flatten_max_iter = 0(surplus-mode cleanup disabled). The YAML value of 50 is ignored.CLI
--flattenpassed → the YAML /defaults.pyvalue applies (defaultflatten_max_iter = 50); you can override via YAMLhessian_dimer.flatten_max_iterorrsirfo.flatten_max_iter.
If your TS candidate has multiple imaginary frequencies, add --flatten to enable the surplus-mode cleanup loop.
Outputs¶
out_dir/ (default:./result_tsopt/)
├─ final_geometry.xyz # Always written
├─ final_geometry.pdb # When the input was PDB (conversion enabled)
├─ final_geometry.gjf # When the input was Gaussian (conversion enabled)
├─ optimization_all_trj.xyz # Dimer-mode dump when --dump is True
├─ optimization_all.pdb # Dimer-mode companion for PDB inputs (conversion enabled, --dump)
├─ optimization_trj.xyz # RSIRFO-mode trajectory when --dump is True
├─ optimization.pdb # RSIRFO-mode PDB companion when conversion is enabled and --dump is True
├─ vib/
│ ├─ imag_±XXXX.Xcm-1_trj.xyz
│ └─ imag_±XXXX.Xcm-1.pdb
└─.dimer_mode.dat # Dimer-mode orientation seed
Exit codes¶
See Exit codes in CLI Conventions.
Notes¶
For symptom-first diagnosis, start with Common Error Recipes, then use Troubleshooting for detailed fixes.
Imaginary-frequency detection threshold defaults to 5.0 cm⁻¹ (configurable via
hessian_dimer.neg_freq_thresh_cm); frequencies with magnitudes below this threshold are not counted as imaginary. The selectedrootcontrols which vibrational mode is followed during optimization. See Imaginary-mode thresholds: 5 cm⁻¹ vs 100 cm⁻¹ in the glossary for the 5 cm⁻¹ detection threshold vs 100 cm⁻¹ quality gate.Use
--opt-modeto choose the algorithm workflow directly (rsirfoby default), instead of manually editing YAML mode mappings.PHVA translation/rotation projection follows the same implementation as
freq, while reducing memory usage and preserving correct active-space eigenvectors.See CLI Conventions: Configuration precedence for the full resolution order.
Shared sections reuse YAML Reference. Adjust only the values you need to change.
Note
Reference duplication. The YAML keys for geom, calc, opt, hessian_dimer, and rsirfo listed below mirror the canonical definitions in YAML Reference. When the two pages disagree, the canonical YAML Reference entries (and pdb2reaction/defaults.py) take precedence; the inline appendix on this page is reproduced only for tsopt-specific defaults (e.g. out_dir: ./result_tsopt/, the --flatten interaction documented above). Note that flatten_max_iter is forced to 0 by the CLI initializer unless --flatten is passed, regardless of the value shown in the inline YAML.
Dimer mode (--opt-mode grad)¶
Used with --opt-mode grad (Hessian Guided Dimer + LBFGS translation).
The full hessian_dimer block (including the inner dimer: and its nested lbfgs:) is documented in hessian_dimer. The inner lbfgs: inherits from the lbfgs section, with this tsopt-specific override:
hessian_dimer:
dimer:
lbfgs:
out_dir: ./result_tsopt/ # tsopt override (defaults.py value is ./result_opt/)
Recall that flatten_max_iter is forced to 0 by the CLI initializer unless --flatten is passed (see --flatten precedence caveat above).
RS-I-RFO mode (--opt-mode hess, default)¶
Used with --opt-mode hess (RS-I-RFO, the default).
The full rsirfo block is documented in rsirfo (which also inherits trust-region and Hessian-update keys from rfo). The tsopt-specific overrides are:
rsirfo:
trust_max: 0.10 # maximum trust radius (bohr); reduced from 0.20 in v0.3.5 to damp near-saddle oscillations on large systems
out_dir: ./result_tsopt/ # tsopt override (defaults.py value is ./result_opt/)
hessian_recalc: 500 # rebuild exact Hessian every N macro steps; lower to 50-200 if TS convergence is slow (see tip below)
Tip
Set rsirfo.track_mode_by_overlap: true if the TS mode switches root during optimization (e.g., when multiple imaginary frequencies are present).
Tip
If TS convergence is slow or the TS mode is lost during optimization, try lowering hessian_recalc (e.g., to 50–200) in the rsirfo section. More frequent exact Hessian recalculations improve robustness at the cost of additional Hessian evaluations.
See Also¶
Common Error Recipes – Symptom-first failure routing
path-search — MEP search that identifies TS candidates (HEI)
irc — Trace the reaction path from an optimized TS
freq — Full vibrational analysis and thermochemistry (imaginary-frequency check is already included in
tsopt)all — End-to-end workflow that chains extraction → MEP → tsopt → IRC (→ optional freq/DFT)
YAML Reference — Full
hessian_dimer(Hessian Guided Dimer) andrsirfoconfiguration optionsGlossary — Definitions of TS, Dimer, RS-I-RFO, Hessian