opt (geometry optimization)¶
opt optimizes one structure to a local minimum.
What it is for¶
Preparing R, P, and intermediates: relax the reactant, product, and intermediate structures before a path search or a frequency calculation, and confirm each minimum (n_imag = 0) with
freq.Relaxing with distance restraints: pull chosen atom pairs toward a target distance while everything else relaxes.
Turning IRC endpoints into R and P: optimize the endpoints of an
ircrun to the minima they lead to.
The default backend is UMA (Meta); -b/--backend also selects ORB, MACE, AIMNet2, or DFT.
Examples¶
1. Basic minimization¶
Give the charge and the spin multiplicity explicitly, and write a summary with --out-json.
pdb2reaction opt -i input.pdb -q 0 -m 1 --out-json --out-dir ./result_opt
The run converged when the console prints [opt] Converged! and result_opt/result.json has "optimization_status": "converged".
2. Tighter threshold with trajectory¶
Use the gau_tight criteria and keep the optimization trajectory.
pdb2reaction opt -i input.pdb -q 0 -m 1 --thresh gau_tight --dump \
--out-dir ./result_opt_tight
3. Distance restraint¶
Pull atoms 1 and 5 toward 2.0 Å with a weak harmonic restraint (20 eV·Å⁻²).
pdb2reaction opt -i input.pdb -q 0 -m 1 \
--distance-restraint '[(1,5,2.0)]' --restraint-k 20.0 --out-dir ./result_opt_rest
4. RFO¶
Switch to RFO, which starts from an exact Hessian, with --opt-mode hess.
pdb2reaction opt -i input.pdb -q 0 -m 1 --opt-mode hess --out-dir ./result_opt_hess
How it works¶
Reading the structure and freezing the boundary: the charge comes from
-qor-l. With--freeze-links(on by default), the parent atoms of the cap hydrogens of a cut-out cluster are frozen;--freeze-atomsfreezes more atoms.Choosing the optimizer (
--opt-mode):grad(aliaslbfgs) runs L-BFGS, which uses gradients only.hess(aliasrfo) runs RFO, which starts from an exact Hessian, updates it with TS-BFGS (YAMLrfo.hessian_update), and recomputes it every 500 cycles. Intsopt, the same tokens select other methods.Adding distance restraints (
--distance-restraint): each(i, j, target)adds a harmonic term with force constant--restraint-k(eV·Å⁻²) that pulls atoms i and j towardtargetin Å;(i, j)keeps their starting distance. Indices are 1-based unless--zero-basedis given.Minimizing: the optimizer moves the structure until the convergence criteria are met or
--max-cyclesis reached. The default--thresh gauasks for a max force below 4.5 × 10⁻⁴ and an RMS force below 3.0 × 10⁻⁴ hartree/bohr, and a max step below 1.8 × 10⁻³ and an RMS step below 1.2 × 10⁻³ bohr, the same as Gaussian’s default.Removing imaginary modes (only with
--flatten): after the optimization,optcomputes the Hessian, displaces the structure by 0.10 Å along every imaginary mode (ν < −5.00 cm⁻¹), and optimizes again, for up to 50 rounds or until no imaginary mode is left. With--flatten, the console prints n_imag in the line[Imaginary modes] n=…after each round, and[flatten] WARNING: Remaining imaginary modes after the flatten loop: Nwhen modes are left after the last round.
Checking convergence¶
How the run ended is printed on the console and recorded in result.json (--out-json):
How it ended |
|
Console line |
|
|---|---|---|---|
Converged |
|
|
|
Reached |
|
|
|
Stopped on an energy plateau ( |
|
|
|
Each of these lines is followed by [opt] Total cycles: N. For what to change after not_converged or stalled, see max_cycles and plateau stops.
Convergence gives a stationary point, not necessarily a minimum. opt computes no final Hessian unless --flatten is on, so run freq on the final geometry and check that n_imag = 0.
Output files¶
When the run finishes, --out-dir contains:
result_opt/
├─ final_geometry.xyz # Final geometry (always written)
├─ final_geometry.pdb # Same, for PDB/mmCIF input (.gjf for Gaussian input)
├─ optimization_trj.xyz # Optimization trajectory (--dump)
├─ optimization.pdb # Same trajectory as PDB (--dump, PDB/mmCIF input)
├─ restart_NNN.yaml # Optimizer state (--dump with YAML opt.dump_restart)
└─ result.json # Summary (--out-json)
mmCIF input, and PDB input too large for the PDB columns, also get .cif files that keep the original identifiers.
Final geometry:
final_geometry.*is the optimized structure to pass tofreqor to a path search.Summary: with
--out-json,result.jsonrecordsoptimization_status, the final energyenergy_hartree(without the restraint energy), and the number of cyclesn_opt_cycles.Console: the cycle table and the elapsed time; with
-v 3, also thegeom,calc,opt, andlbfgs/rfosettings actually used.
Main options¶
Option |
Type |
Default |
Description |
|---|---|---|---|
|
path |
(required) |
One structure ( |
|
integer |
|
Total charge. Required unless |
|
text |
|
Total ligand charge (for example |
|
integer |
|
Spin multiplicity (2S+1) |
|
path |
|
PDB/mmCIF topology for an |
|
text |
|
Backend ( |
|
|
|
Optimizer: L-BFGS / RFO ( |
|
|
|
Optimization coordinates: Cartesian / redundant internal / delocalized internal (DLC) / translation-rotation internal (TRIC) |
|
preset |
|
Convergence criteria ( |
|
integer |
|
Maximum number of optimization cycles, shared with the |
|
flag |
|
Write the optimization trajectory |
|
text |
|
Harmonic distance restraints, inline ( |
|
float |
|
Force constant of the distance restraints (eV·Å⁻²) |
|
flag |
|
Count |
|
flag |
|
Freeze the parent atoms of cap hydrogens (PDB/mmCIF input or |
|
text |
|
Atoms to freeze (1-based, comma-separated, for example |
|
flag |
|
Remove imaginary modes after the optimization |
|
flag |
|
With |
|
flag |
|
Stop when the energy stops changing (range below 1e-4 hartree over 50 cycles) and report |
|
path |
|
Output directory |
See the generated CLI reference for every option.
Notes¶
Plateau stop:
--stop-plateausaves cycles when force noise keeps the force criteria out of reach, but a flat energy is no evidence of a stationary point.--max-cyclesremains the real limit.--stop-plateau-threshand--stop-plateau-windowset the energy range and the number of cycles.Rigid motions with frozen atoms:
--flattentreats rigid motions asfreqdoes.Frozen atoms and restraints in general: how to choose frozen atoms and restraints for a cluster model is described in Frozen atoms and distance restraints.
Optimizer state dumps: with
--dump, set YAMLopt.dump_restartto a positive integer N to writerestart_NNN.yamlevery N cycles. pdb2reaction does not read this file back, so rerunoptfrom the final geometry to continue a stopped calculation.Model and precision:
--backend-modelselects the model of the backend and--precision(fp32/fp64) its precision; see the generated reference.
See also¶
freq — check that the optimized structure is a minimum (n_imag = 0)
tsopt — optimize a TS (saddle point) instead of a minimum
irc — trace the reaction path from a TS to the endpoints to optimize
extract — cut out the active-site model before optimizing
all — the full workflow, which also optimizes the IRC endpoints
Troubleshooting — when a run fails
YAML Reference — every
opt,lbfgs, andrfosettingGlossary — L-BFGS, RFO, and other terms
Exit codes — what each exit status means