optimizers
Geometry optimization methods for molecular structures.
This module provides geometry optimization workflows using various computational methods including neural network potentials, machine learning force fields, and semi-empirical quantum chemistry.
Available Optimizers
- GeometryOptimization: Base class for geometry optimization
- ASEOptimizer: Base class for ASE-based optimizers
- AimNet2Optimizer: Neural network potential optimizer
- ORBModelOptimizer: Machine learning force field optimizer
- TBLiteOptimizer: GFN-xTB semi-empirical optimizer
ASEOptimizer
dataclass
Bases: PymatGenMaker[InputType, OutputType], GeometryOptimization
flowchart TD
jfchemistry.optimizers.ASEOptimizer[ASEOptimizer]
jfchemistry.core.makers.pymatgen_maker.PymatGenMaker[PymatGenMaker]
jfchemistry.core.makers.jfchem_maker.JFChemMaker[JFChemMaker]
jfchemistry.core.makers.core_maker.CoreMaker[CoreMaker]
jfchemistry.optimizers.base.GeometryOptimization[GeometryOptimization]
jfchemistry.core.makers.pymatgen_maker.PymatGenMaker --> jfchemistry.optimizers.ASEOptimizer
jfchemistry.core.makers.jfchem_maker.JFChemMaker --> jfchemistry.core.makers.pymatgen_maker.PymatGenMaker
jfchemistry.core.makers.core_maker.CoreMaker --> jfchemistry.core.makers.jfchem_maker.JFChemMaker
jfchemistry.optimizers.base.GeometryOptimization --> jfchemistry.optimizers.ASEOptimizer
click jfchemistry.optimizers.ASEOptimizer href "" "jfchemistry.optimizers.ASEOptimizer"
click jfchemistry.core.makers.pymatgen_maker.PymatGenMaker href "" "jfchemistry.core.makers.pymatgen_maker.PymatGenMaker"
click jfchemistry.core.makers.jfchem_maker.JFChemMaker href "" "jfchemistry.core.makers.jfchem_maker.JFChemMaker"
click jfchemistry.core.makers.core_maker.CoreMaker href "" "jfchemistry.core.makers.core_maker.CoreMaker"
click jfchemistry.optimizers.base.GeometryOptimization href "" "jfchemistry.optimizers.base.GeometryOptimization"
Base class for geometry optimization using ASE optimizers.
Combines geometry optimization workflows with ASE calculator interfaces. This class provides the framework for optimizing molecular structures using various ASE optimization algorithms (LBFGS, BFGS, FIRE, etc.) and different calculators (neural networks, machine learning, semi-empirical).
Units
Pass a float in the listed unit or a pint Quantity (e.g. jfchemistry.ureg
or jfchemistry.Q_):
- fmax: [eV/Å]
Subclasses should inherit from both a specific ASECalculator implementation and ASEOptimizer to create complete optimization workflows.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Name of the optimizer (default: "ASE Optimizer").
TYPE:
|
optimizer |
ASE optimization algorithm to use: - "LBFGS": Limited-memory BFGS (default, recommended) - "BFGS": Broyden-Fletcher-Goldfarb-Shanno - "GPMin": Conjugate gradient - "MDMin": Molecular dynamics minimization - "FIRE": Fast Inertial Relaxation Engine - "FIRE2": FIRE version 2 - "QuasiNewton": Quasi-Newton method
TYPE:
|
fmax |
Maximum force convergence criterion [eV/Å] (default: 0.05). Accepts float in [eV/Å] or pint Quantity.
TYPE:
|
steps |
Maximum number of optimization steps (default: 250000).
TYPE:
|
Examples:
>>> from ase.build import molecule
>>> from pymatgen.core import Molecule
>>> from jfchemistry.optimizers import ASEOptimizer
>>> from jfchemistry.calculators import TBLiteCalculator
>>> molecule = Molecule.from_ase_atoms(molecule("C2H6"))
>>> # Create custom optimizer by inheriting
>>> class MyOptimizer(ASEOptimizer, TBLiteCalculator):
... pass
>>> opt = MyOptimizer(optimizer="LBFGS", fmax=0.01)
>>> job = opt.make(molecule)
Source code in jfchemistry/optimizers/ase.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
make
make(input: InputType | list[InputType], **kwargs) -> Response[_output_model]
Create a workflow job for processing structure(s).
Automatically handles job distribution for lists of structures. Each structure in a list is processed as a separate job for parallel execution.
| PARAMETER | DESCRIPTION |
|---|---|
input
|
Single Pymatgen SiteCollection or list of SiteCollections.
TYPE:
|
**kwargs
|
Additional kwargs to pass to the operation.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Response[_output_model]
|
Response containing: - structure: Processed structure(s) - files: XYZ format file(s) of the structure(s) - properties: Computed properties from the operation |
Examples:
>>> from jfchemistry.conformers import CRESTConformers
>>> from pymatgen.core import Molecule
>>> molecule = Molecule.from_ase_atoms(molecule("C2H6"))
>>> # Generate conformers
>>> conformer_gen = CRESTConformers(ewin=6.0)
>>> job = conformer_gen.make(input)
Source code in jfchemistry/core/makers/jfchem_maker.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
ORCAOptimizer
dataclass
Bases: ORCACalculator, GeometryOptimization, PymatGenMaker[InputType, OutputType]
flowchart TD
jfchemistry.optimizers.ORCAOptimizer[ORCAOptimizer]
jfchemistry.calculators.orca.orca_calculator.ORCACalculator[ORCACalculator]
jfchemistry.calculators.base.WavefunctionCalculator[WavefunctionCalculator]
jfchemistry.calculators.base.Calculator[Calculator]
jfchemistry.optimizers.base.GeometryOptimization[GeometryOptimization]
jfchemistry.core.makers.pymatgen_maker.PymatGenMaker[PymatGenMaker]
jfchemistry.core.makers.jfchem_maker.JFChemMaker[JFChemMaker]
jfchemistry.core.makers.core_maker.CoreMaker[CoreMaker]
jfchemistry.calculators.orca.orca_calculator.ORCACalculator --> jfchemistry.optimizers.ORCAOptimizer
jfchemistry.calculators.base.WavefunctionCalculator --> jfchemistry.calculators.orca.orca_calculator.ORCACalculator
jfchemistry.calculators.base.Calculator --> jfchemistry.calculators.base.WavefunctionCalculator
jfchemistry.optimizers.base.GeometryOptimization --> jfchemistry.optimizers.ORCAOptimizer
jfchemistry.core.makers.pymatgen_maker.PymatGenMaker --> jfchemistry.optimizers.ORCAOptimizer
jfchemistry.core.makers.jfchem_maker.JFChemMaker --> jfchemistry.core.makers.pymatgen_maker.PymatGenMaker
jfchemistry.core.makers.core_maker.CoreMaker --> jfchemistry.core.makers.jfchem_maker.JFChemMaker
click jfchemistry.optimizers.ORCAOptimizer href "" "jfchemistry.optimizers.ORCAOptimizer"
click jfchemistry.calculators.orca.orca_calculator.ORCACalculator href "" "jfchemistry.calculators.orca.orca_calculator.ORCACalculator"
click jfchemistry.calculators.base.WavefunctionCalculator href "" "jfchemistry.calculators.base.WavefunctionCalculator"
click jfchemistry.calculators.base.Calculator href "" "jfchemistry.calculators.base.Calculator"
click jfchemistry.optimizers.base.GeometryOptimization href "" "jfchemistry.optimizers.base.GeometryOptimization"
click jfchemistry.core.makers.pymatgen_maker.PymatGenMaker href "" "jfchemistry.core.makers.pymatgen_maker.PymatGenMaker"
click jfchemistry.core.makers.jfchem_maker.JFChemMaker href "" "jfchemistry.core.makers.jfchem_maker.JFChemMaker"
click jfchemistry.core.makers.core_maker.CoreMaker href "" "jfchemistry.core.makers.core_maker.CoreMaker"
Optimize molecular structures using ORCA DFT calculator.
Inherits all attributes from ORCACalculator.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Name of the optimizer (default: "Orca Optimizer").
TYPE:
|
opt |
The ORCA optimizer to use for the calculation (default: ["OPT"]).
TYPE:
|
Source code in jfchemistry/optimizers/orca.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
make
make(input: InputType | list[InputType], **kwargs) -> Response[_output_model]
Create a workflow job for processing structure(s).
Automatically handles job distribution for lists of structures. Each structure in a list is processed as a separate job for parallel execution.
| PARAMETER | DESCRIPTION |
|---|---|
input
|
Single Pymatgen SiteCollection or list of SiteCollections.
TYPE:
|
**kwargs
|
Additional kwargs to pass to the operation.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Response[_output_model]
|
Response containing: - structure: Processed structure(s) - files: XYZ format file(s) of the structure(s) - properties: Computed properties from the operation |
Examples:
>>> from jfchemistry.conformers import CRESTConformers
>>> from pymatgen.core import Molecule
>>> molecule = Molecule.from_ase_atoms(molecule("C2H6"))
>>> # Generate conformers
>>> conformer_gen = CRESTConformers(ewin=6.0)
>>> job = conformer_gen.make(input)
Source code in jfchemistry/core/makers/jfchem_maker.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
TorchSimOptimizer
dataclass
Bases: PymatGenMaker[InputType, OutputType], GeometryOptimization
flowchart TD
jfchemistry.optimizers.TorchSimOptimizer[TorchSimOptimizer]
jfchemistry.core.makers.pymatgen_maker.PymatGenMaker[PymatGenMaker]
jfchemistry.core.makers.jfchem_maker.JFChemMaker[JFChemMaker]
jfchemistry.core.makers.core_maker.CoreMaker[CoreMaker]
jfchemistry.optimizers.base.GeometryOptimization[GeometryOptimization]
jfchemistry.core.makers.pymatgen_maker.PymatGenMaker --> jfchemistry.optimizers.TorchSimOptimizer
jfchemistry.core.makers.jfchem_maker.JFChemMaker --> jfchemistry.core.makers.pymatgen_maker.PymatGenMaker
jfchemistry.core.makers.core_maker.CoreMaker --> jfchemistry.core.makers.jfchem_maker.JFChemMaker
jfchemistry.optimizers.base.GeometryOptimization --> jfchemistry.optimizers.TorchSimOptimizer
click jfchemistry.optimizers.TorchSimOptimizer href "" "jfchemistry.optimizers.TorchSimOptimizer"
click jfchemistry.core.makers.pymatgen_maker.PymatGenMaker href "" "jfchemistry.core.makers.pymatgen_maker.PymatGenMaker"
click jfchemistry.core.makers.jfchem_maker.JFChemMaker href "" "jfchemistry.core.makers.jfchem_maker.JFChemMaker"
click jfchemistry.core.makers.core_maker.CoreMaker href "" "jfchemistry.core.makers.core_maker.CoreMaker"
click jfchemistry.optimizers.base.GeometryOptimization href "" "jfchemistry.optimizers.base.GeometryOptimization"
Base class for geometry optimization using TorchSim calculators.
Combines geometry optimization with TorchSim calculator interfaces. This class provides the framework for optimizing structures using various TorchSim calculators (neural networks, machine learning, semi-empirical, etc.).
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Name of the optimizer (default: "TorchSim Optimizer").
TYPE:
|
Examples:
>>> from ase.build import molecule
>>> from pymatgen.core import Molecule
>>> from jfchemistry.optimizers import TorchSimOptimizer
>>> from jfchemistry.calculators.torchsim import OrbCalculator
>>> molecule = Molecule.from_ase_atoms(molecule("C2H6"))
>>> # Create custom optimizer by inheriting
>>> class MyOptimizer(TorchSimOptimizer, OrbCalculator):
... pass
>>> opt = MyOptimizer(optimizer="FIRE")
>>> job = opt.make(molecule)
Source code in jfchemistry/optimizers/torchsim.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
make
make(input: InputType | list[InputType], **kwargs) -> Response[_output_model]
Create a workflow job for processing structure(s).
Automatically handles job distribution for lists of structures. Each structure in a list is processed as a separate job for parallel execution.
| PARAMETER | DESCRIPTION |
|---|---|
input
|
Single Pymatgen SiteCollection or list of SiteCollections.
TYPE:
|
**kwargs
|
Additional kwargs to pass to the operation.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
Response[_output_model]
|
Response containing: - structure: Processed structure(s) - files: XYZ format file(s) of the structure(s) - properties: Computed properties from the operation |
Examples:
>>> from jfchemistry.conformers import CRESTConformers
>>> from pymatgen.core import Molecule
>>> molecule = Molecule.from_ase_atoms(molecule("C2H6"))
>>> # Generate conformers
>>> conformer_gen = CRESTConformers(ewin=6.0)
>>> job = conformer_gen.make(input)
Source code in jfchemistry/core/makers/jfchem_maker.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |