optimizer¶
Optimizers for refining TS-constrained conformers.
Constructor parameters:
conf_id_ref: int = -1: reference conformer ID on the TS moleculeforce_constant: float = 1e6: force constant of distance constraints to TS reference points
MMFFOptimizer¶
Optimizes each conformer with MMFF94:
- Align to the TS reference conformer (on
align_indices)- Create RDKit force-field extra points at the TS coordinates for each
align_indicesatom and add distance constraints withforce_constant- Minimize and set the conformer
energyproperty fromff.CalcEnergy()in kcal/mol- Re-align to the TS reference
UFFOptimizer¶
Same flow as MMFF_optimizer using the RDKit implementation of UFF.
Note
- MMFF: Good general-purpose performance, if MMFF parameters are available.
- UFF: Use if no MMFF parameters available or as fallback.
ASEOptimizer (optional dependency)¶
ASEOptimizer uses the Atomic Simulation Environment (ASE):
- Align to the TS reference conformer on
align_indices- Convert each RDKit conformer to ASE
Atoms- Apply
FixAtoms(indices=align_indices)to freeze these atoms- Optimize with an ASE optimizer (
BFGSby default) and the provided ASE calculator (calculator=..., instance or callable)- Write positions back to RDKit and set conformer
energyin kcal/mol (eV * 23.06054783061903)- Re-align to the TS reference
Note
align_indices follow standard Python indexing (0-based), consistent with RDKit and ASE atom indices.
Install ASE support with:
pip install racerts[ase]
Example with a calculator instance:
from ase.calculators.lj import LennardJones
from racerts.optimizer import ASEOptimizer
optimizer = ASEOptimizer(
calculator=LennardJones(),
fmax=0.05,
max_steps=100,
)
Example with a calculator callable:
from ase.calculators.lj import LennardJones
from racerts.optimizer import ASEOptimizer
optimizer = ASEOptimizer(
calculator=LennardJones,
num_threads=4,
)