opt
#
Optimize molecule geometrics in internal coordinates.
Notes
- This module is heavily based off of the
optimize
andstep
modules ofgeomeTRIC
. See the LICENSE-3RD-PARTY for license information.
Classes:
-
Step
–The outputs of step in the optimization process.
-
ConvergenceCriteria
–The convergence criteria for the optimization process.
-
Params
–Parameters for the optimization process.
Functions:
-
optimize
–Optimize the geometry of a molecule.
Attributes:
-
CONVERGENCE_CRITERIA
(dict[str, ConvergenceCriteria]
) –Default convergence criteria for optimization.
CONVERGENCE_CRITERIA
module-attribute
#
CONVERGENCE_CRITERIA: dict[str, ConvergenceCriteria] = {
"GAU": {
"energy": 1e-06,
"rms_grad": 0.0003,
"max_grad": 0.00045,
"rms_disp": 0.0012 * _ANGSTROM_TO_BOHR,
"max_disp": 0.0018 * _ANGSTROM_TO_BOHR,
},
"GAU_LOOSE": {
"energy": 1e-06,
"rms_grad": 0.0017,
"max_grad": 0.0025,
"rms_disp": 0.0067 * _ANGSTROM_TO_BOHR,
"max_disp": 0.01 * _ANGSTROM_TO_BOHR,
},
"GAU_TIGHT": {
"energy": 1e-06,
"rms_grad": 1e-05,
"max_grad": 1.5e-05,
"rms_disp": 4e-05 * _ANGSTROM_TO_BOHR,
"max_disp": 6e-05 * _ANGSTROM_TO_BOHR,
},
}
Default convergence criteria for optimization.
Step
#
ConvergenceCriteria
#
Bases: TypedDict
The convergence criteria for the optimization process.
Attributes:
-
energy
(float
) –The energy [Eh] convergence criteria.
-
rms_grad
(float
) –The root mean square of the gradients [Eh/a0] convergence criteria.
-
max_grad
(float
) –The maximum gradient [Eh/a0] convergence criteria.
-
rms_disp
(float
) –The root mean square of the displacements [a0] convergence criteria.
-
max_disp
(float
) –The maximum displacement [a0] convergence criteria.
Params
dataclass
#
Parameters for the optimization process.
Attributes:
-
max_steps
(int
) –The maximum number of steps to take.
-
epsilon
(float
) –The minimum eigenvalue of the Hessian.
-
trust
(float
) –The initial trust radius [a0]. This will be adjusted during the optimization
-
trust_min
(float
) –The lower bound of the trust radius [a0].
-
trust_max
(float
) –The upper bound of the trust radius [a0].
-
criteria
(ConvergenceCriteria
) –The convergence criteria to use.
max_steps
class-attribute
instance-attribute
#
The maximum number of steps to take.
epsilon
class-attribute
instance-attribute
#
The minimum eigenvalue of the Hessian.
trust
class-attribute
instance-attribute
#
The initial trust radius [a0]. This will be adjusted during the optimization process.
trust_min
class-attribute
instance-attribute
#
The lower bound of the trust radius [a0].
trust_max
class-attribute
instance-attribute
#
The upper bound of the trust radius [a0].
criteria
class-attribute
instance-attribute
#
criteria: ConvergenceCriteria = field(
default_factory=lambda: {
None: CONVERGENCE_CRITERIA["GAU"]
}
)
The convergence criteria to use.
optimize
#
optimize(
coords_x: Tensor,
ic: IC,
energy_fn: EnergyFn,
atomic_nums: Tensor,
params: Params | None = None,
) -> tuple[list[Step], bool]
Optimize the geometry of a molecule.
Parameters:
-
coords_x
(Tensor
) –The initial cartesian coordinates [a0].
-
ic
(IC
) –The internal coordinate representation of the molecule.
-
energy_fn
(EnergyFn
) –A function that computes the energy and gradients of the molecule. It should take the cartesian coordinates and return the energy [Eh] and gradients [Eh/a0] in atomic units.
-
atomic_nums
(Tensor
) –The atomic numbers of the atoms in the molecule.
-
params
(Params | None
, default:None
) –The parameters for the optimization.
Returns:
-
tuple[list[Step], bool]
–The history of the optimization process and whether the optimization converged or not.
Source code in tico/opt.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
|