opt¶
Optimizes a single layered enzyme PDB (or XYZ + --ref-pdb) to a local minimum using the ML/MM calculator (MLIP region + movable MM shell + frozen outer environment). Use it to relax a full-system layered structure. --opt-mode grad (default) runs L-BFGS, --opt-mode hess runs RFOptimizer (RFO), --flatten flattens imaginary modes after optimization, and --mm-only minimizes the full system on the MM force field only, skipping the MLIP component (grad/L-BFGS only; microiteration auto-disabled). Microiteration (--microiter, default on) relaxes the movable-MM shell in hess mode.
Examples¶
Command form:
mlmm opt -i INPUT --parm PARM7 --model-pdb ML_REGION -q CHARGE [options]
mlmm opt --help shows core options; mlmm opt --help-advanced shows the full option list.
Minimal L-BFGS optimization (grad mode, default):
# Minimal L-BFGS optimization (grad mode, default)
mlmm opt -i pocket.pdb --parm real.parm7 --model-pdb ml_region.pdb \
-q 0 --out-dir ./result_opt
Tighten convergence and keep an optimization trajectory:
# Tighten convergence and keep an optimization trajectory
mlmm opt -i pocket.pdb --parm real.parm7 --model-pdb ml_region.pdb \
-q 0 --thresh gau_tight --dump --out-dir ./result_opt_tight
# add one harmonic distance restraint: --dist-freeze "[(12,45,2.20)]" --bias-k 20.0
Switch to heavy mode (RFO):
# Switch to heavy mode (RFO)
mlmm opt -i pocket.pdb --parm real.parm7 --model-pdb ml_region.pdb \
-q 0 --opt-mode hess --out-dir ./result_opt_rfo
# use the ORB backend instead of the default: --backend orb
Workflow¶
Input handling – The tool accepts
-i/--inputas a PDB or XYZ file (use--ref-pdbwith XYZ inputs). The optimizer reads coordinates from this PDB viapysisyphus.helpers.geom_loader. ML/MM layer definitions come from--model-pdb,--model-indices, or--detect-layer(B-factor encoding: B=0 ML, B=10 Movable-MM, B=20 Frozen).ML/MM calculator setup – Build the ML/MM calculator (MLIP backend + hessian_ff). The
-b/--backendoption selects the MLIP (uma,orb,mace, oraimnet2; defaultuma).--parmprovides Amber MM topology;--model-pdbdefines the ML region. When--embedchargeis enabled, xTB point-charge embedding is applied to correct for MM-to-ML environmental electrostatic effects.Optimization – The optimizer runs in the selected
--opt-mode(grad= L-BFGS,hess= RFOptimizer); see the CLI options table for the accepted aliases.--flattenenables post-optimization flattening of imaginary modes. All detected imaginary modes are flattened each iteration until none remain or the internal loop cap is reached.
Restraints – Optional harmonic distance restraints via
--dist-freeze/--bias-k(see CLI options).Dumping & conversion –
--dumpwritesoptimization_trj.xyz; when conversion is enabled, trajectories are mirrored to.pdbfor PDB inputs (with B-factor annotations).opt.dump_restartcan emit restart YAML snapshots.Exit codes –
0success,2zero step (step norm <min_step_norm),3optimizer failure,130keyboard interrupt,1unexpected error.
Outputs¶
out_dir/ (default: ./result_opt/)
├─ final_geometry.xyz # Always written
├─ final_geometry.pdb # Only when the input was a PDB and conversion is enabled (B-factors annotated)
├─ optimization_trj.xyz # Only if dumping is enabled
├─ optimization.pdb # PDB conversion of the trajectory (PDB inputs, conversion enabled)
├─ optimization_all_trj.xyz # Concatenated full trajectory (when --dump)
├─ optimization_all.pdb # PDB companion of the full trajectory (PDB inputs, when --dump)
└─ restart_*.yaml # Optional restarts when opt.dump_restart is set
Console output prints resolved configuration blocks (geom, calc, opt, lbfgs), progress every print_every cycles, and a final wall-clock time summary.
CLI options¶
The full flag list is in the generated command reference; the table below covers the options that need explanation. Default values shown are used when the option is not specified.
Option |
Description |
Default |
|---|---|---|
|
Input structure accepted by |
Required |
|
Reference PDB topology when input is XYZ. |
None |
|
Amber parm7 topology for the full enzyme. |
Required |
|
PDB defining the ML region atoms. Optional when |
None |
|
Comma-separated atom indices for the ML region (ranges allowed, e.g. |
None |
|
Index convention for |
1-based |
|
Auto-detect ML/MM layers from B-factors (B=0 ML, B=10 Movable-MM, B=20 Frozen). |
Enabled |
|
Charge of the ML region. |
None (required unless |
|
Per-resname charge mapping (e.g., |
None |
|
Spin multiplicity (2S+1). |
|
|
Comma-separated 1-based indices to freeze. |
None |
|
Distance cutoff (Å) from ML region for movable MM atoms. Atoms beyond this are frozen. Providing this disables |
None |
|
Distance cutoff (Å) from ML region for MM atoms included in Hessian calculation. Combinable with |
None |
|
MM backend (analytical Hessian vs OpenMM finite-difference). |
|
|
Skip the MLIP component and minimize on the MM force field only. Layers are still honored via B-factor / |
|
|
Link-atom placement: scaled ($g$-factor) or fixed 1.09/1.01 Å. |
|
|
Write machine-readable |
|
|
Python-literal |
None |
|
Index convention for |
1-based |
|
Harmonic bias strength (eV/Ų). |
|
|
Hard limit on optimization iterations. |
|
|
Optimizer mode: |
|
|
Microiteration: alternate ML 1-step (RFO) + MM relaxation (LBFGS). Only effective in |
|
|
Enable/disable the post-optimization imaginary-mode flatten loop. |
|
|
Emit trajectory dumps ( |
|
|
Enable or disable XYZ/TRJ to PDB companions for PDB inputs. |
|
|
Output directory for all files. |
|
|
Override convergence preset ( |
None ( |
|
Base YAML configuration file. |
None |
|
Print resolved YAML layer information before execution. |
|
|
MLIP backend for the ML region: |
|
|
Enable xTB point-charge embedding correction for MM-to-ML environmental effects (experimental). |
|
|
Cutoff radius (Å) for embed-charge MM atoms. |
|
|
Enable CMAP (backbone cross-map dihedral correction) in model parm7. Default: disabled (consistent with Gaussian ONIOM). |
|
|
Validate options and print execution plan without running optimization. Shown in |
|
Convergence threshold presets¶
Forces in Hartree/bohr, steps in bohr.
Preset |
Purpose |
max|F| |
RMS(F) |
max|step| |
RMS(step) |
|---|---|---|---|---|---|
|
Loose/quick pre-optimization; rough path searches |
2.5e-3 |
1.7e-3 |
1.0e-2 |
6.7e-3 |
|
Standard Gaussian-like tightness for routine work |
4.5e-4 |
3.0e-4 |
1.8e-3 |
1.2e-3 |
|
Tighter; better structures / freq / TS refinement |
1.5e-5 |
1.0e-5 |
6.0e-5 |
4.0e-5 |
|
Very tight; benchmarking/high-precision final structures |
2.0e-6 |
1.0e-6 |
6.0e-6 |
4.0e-6 |
|
Baker-style rule (converged only when all four force/step values below are met and |
3.0e-4 |
2.0e-4 |
3.0e-4 |
2.0e-4 |
YAML configuration¶
Settings are applied with defaults < config < explicit CLI < override. The accepted sections are geom (coord_type, freeze_atoms), calc / mlmm (ML/MM calculator: backends, devices, Hessian mode, embedding), opt (shared optimizer controls), and the optimizer-specific lbfgs / rfo sections.
geom:
coord_type: cart # cartesian vs dlc internals (dlc needs --opt-mode hess; grad/L-BFGS falls back to cart)
freeze_atoms: [] # 1-based frozen atoms
calc:
charge: 0 # net charge
spin: 1 # spin multiplicity 2S+1
mlmm:
real_parm7: real.parm7 # Amber parm7 topology
model_pdb: ml_region.pdb # ML region definition
backend: uma # uma | orb | mace | aimnet2
hessian_calc_mode: Analytical # or FiniteDifference
opt:
thresh: gau # convergence preset
max_cycles: 10000 # optimizer cycle cap
out_dir: ./result_opt/ # output directory
microiter¶
Used only when --microiter is active with --opt-mode hess. micro_thresh sets the L-BFGS convergence preset for the MM relaxation step. When null or omitted, the micro step uses the same preset as the macro optimizer (--thresh / opt.thresh). There is no --micro-thresh CLI flag; set this in YAML.
Full schema (every section, key, and default): YAML Reference.
See Also¶
Common Error Recipes — Symptom-first failure routing
Troubleshooting — Detailed troubleshooting guide
tsopt — Optimize transition states (saddle points) instead of minima
freq — Vibrational analysis to confirm a minimum was reached
all — End-to-end workflow that pre-optimizes endpoints
YAML Reference — Full
opt,lbfgs,rfoconfiguration optionsGlossary — Definitions of L-BFGS, RFO