Grid Optimization
Grid optimizations perform geometry optimizations on a grid of chosen coordinates, or in other words give relaxed scans of the potential energy surface. They can be useful for:
- Exploring a relevant region of a potential energy surface (PES)
- Helping to find a particular transition state
- Developing force field parameters, e.g. dihedral force constants
A grid optimization is specified via the GridOptimizationInput
object, which requires an initial_molecule
, an optimization_method
for the energy method used in the optimizations, and a scans
field that specifies both the set of coordinates for the scan, as well as the initial and final values.
There are two optional fields: energy_method
and constraints
.
The energy_method
field can be specified to evaluate the final energy at the optimized geometries at each grid point. If it is not specified, the optimization_method
is used for final energy evaluation.
The constraints
field can be specified to add geometrical constraints to the remaining coordinates (e.g. for freezing the rotation of the -CH3 groups while performing relaxed scan on a C-C bond).
The results of a grid optimization are stored in the GridOptimizationResult
object.
Example
The following example demonstrates how to perform grid optimizations:
import sierra
from sierra.inputs import *
import numpy as np
# Geometry of an HOOH molecule
# note the coordinates are in Angstrom
HOOH = Molecule(
data="""
H 0 -0.3 1
O 0 0 0
O 0 1.2 0
H 0 1.5 1
"""
)
# Perform a grid optimization along the dihedral angle
# at GFN1-xTB level of theory
# Note: the angles are in degrees
inp = GridOptimizationInput(
molecule=HOOH,
scans=[
{
"indices": [0, 1, 2, 3],
"span": {"start": -20, "stop": 20, "nsteps": 3},
}
],
optimization_method=XTBMethod(model="GFN1"),
)
result = sierra.run(inp)
final_relative_energies = {
k: v - min(result.energies.values()) for k, v in result.energies.items()
}
print("Final relative energies (in Hartree) at each grid point:")
#> Final relative energies (in Hartree) at each grid point:
print(final_relative_energies)
"""
{
(1,): 0.0008328854665666796,
(0,): 8.881784197001252e-15,
(2,): 0.0,
}
"""
GridOptimizationInput
Fields
constraints
-
Constraints to place on the geometry optimizations.
- Type:
List[
CoordinateConstraint
]
- Default:
[]
- Type:
energy_method
-
The method for final energy evaluation. If None the final energies are computed using the level of theory specified by optimization_method.
- Type: One of:
[
XTBMethod
,
HFMethod
,
DFTMethod
,
EMFTMethod
,
OrbNetMethod
]
- Default:
XTBMethod(model='GFN0')
- Type: One of:
initial_molecule
-
The initial molecule for the grid optimization.
- Type:
List[
Molecule
]
- Type:
optimization_method
-
The method with which to optimize the molecule at each grid point.
- Type: One of:
[
XTBMethod
,
HFMethod
,
DFTMethod
,
EMFTMethod
]
- Default:
XTBMethod(model='GFN0')
- Type: One of:
scans
-
Specifies the coordinates and grid density to scan over.
- Type:
List[
Scan
]
- Type:
GridOptimizationResult
Fields
All of the fields in GridOptimizationInput and the following:
energies
-
The energies of the optimized molecules at each grid point.
- Type:
Mapping[int, float]
- Default:
{}
- Type:
optimizations
-
A record of each optimization evaluation that the GridOptimization workflow completed.
- Type:
Mapping[int,
OptimizationResult
]
- Default:
{}
- Type:
optimized_molecules
-
The optimized molecules at each grid point.
- Type:
Mapping[int,
Molecule
]
- Default:
{}
- Type: