3.2.4. horton.correlatedwfn.stepsearch
– Step search methods for orbital rotations¶
Optimize step length for orbital optimization (kappa
) and rotate orbitals.
Works only with diagonal approximation to the Hessian which is stored as a OneIndex instance.
-
class
horton.correlatedwfn.stepsearch.
StepSearch
(lf, **kw)¶ Bases:
object
Arguments:
- lf
- A LinalgFactory instance
- Keywords:
method: step search method used, one of trust-region
(default),None
,backtracking
alpha: scaling factor for step, used in backtracking
andNone
method (default 0.75)c1: parameter used in backtracking
(default 1e-4)minalpha: minimum step length used in backracking
(default 1e-6)maxiterouter: maximum number of step search steps (default 10) maxiterinner: maximum number of optimization steps in each step search step (used only in pcg, default 500) maxeta: upper bound for estimated vs actual change in trust-region
(default 0.75)mineta: lower bound for estimated vs actual change in trust-region
(default 0.25)upscale: scaling factor to increase trust radius in trust-region
(default 2.0)downscale: scaling factor to decrease trust radius in trust-region
and step length inbacktracking
(float) (default 0.25)trustradius: initial trust radius (default 0.75) maxtrustradius: maximum trust radius (default 0.75) threshold: trust-region optimization threshold, only used in pcg
method oftrust-region
optimizer: optimizes step to boundary of trust radius. One of pcg
,dogleg
,ddl
(default ddl)
-
__call__
(obj, one, two, orb, **kwargs)¶
-
__init__
(lf, **kw)¶ Arguments:
- lf
- A LinalgFactory instance
- Keywords:
method: step search method used, one of trust-region
(default),None
,backtracking
alpha: scaling factor for step, used in backtracking
andNone
method (default 0.75)c1: parameter used in backtracking
(default 1e-4)minalpha: minimum step length used in backracking
(default 1e-6)maxiterouter: maximum number of step search steps (default 10) maxiterinner: maximum number of optimization steps in each step search step (used only in pcg, default 500) maxeta: upper bound for estimated vs actual change in trust-region
(default 0.75)mineta: lower bound for estimated vs actual change in trust-region
(default 0.25)upscale: scaling factor to increase trust radius in trust-region
(default 2.0)downscale: scaling factor to decrease trust radius in trust-region
and step length inbacktracking
(float) (default 0.25)trustradius: initial trust radius (default 0.75) maxtrustradius: maximum trust radius (default 0.75) threshold: trust-region optimization threshold, only used in pcg
method oftrust-region
optimizer: optimizes step to boundary of trust radius. One of pcg
,dogleg
,ddl
(default ddl)
-
update_alpha
(new)¶ Update current scaling factor
-
update_trustradius
(new)¶ Update current trastradius
-
class
horton.correlatedwfn.stepsearch.
RStepSearch
(lf, **kw)¶ Bases:
horton.correlatedwfn.stepsearch.StepSearch
Arguments:
- lf
- A LinalgFactory instance
- Keywords:
method: step search method used, one of trust-region
(default),None
,backtracking
alpha: scaling factor for step, used in backtracking
andNone
method (default 0.75)c1: parameter used in backtracking
(default 1e-4)minalpha: minimum step length used in backracking
(default 1e-6)maxiterouter: maximum number of step search steps (default 10) maxiterinner: maximum number of optimization steps in each step search step (used only in pcg, default 500) maxeta: upper bound for estimated vs actual change in trust-region
(default 0.75)mineta: lower bound for estimated vs actual change in trust-region
(default 0.25)upscale: scaling factor to increase trust radius in trust-region
(default 2.0)downscale: scaling factor to decrease trust radius in trust-region
and step length inbacktracking
(float) (default 0.25)trustradius: initial trust radius (default 0.75) maxtrustradius: maximum trust radius (default 0.75) threshold: trust-region optimization threshold, only used in pcg
method oftrust-region
optimizer: optimizes step to boundary of trust radius. One of pcg
,dogleg
,ddl
(default ddl)
-
__call__
(*args, **kwargs)¶ Optimize Newton-Rapshon step.
Arguments:
- obj
- A class instance containing the objective function.
- one, two
- One- and Two-electron integrals (TwoIndex and FourIndex/Cholesky instances)
- orb
- An Expansion instance. Contains the MO coefficients
Keywords:
-
__init__
(lf, **kw)¶ Arguments:
- lf
- A LinalgFactory instance
- Keywords:
method: step search method used, one of trust-region
(default),None
,backtracking
alpha: scaling factor for step, used in backtracking
andNone
method (default 0.75)c1: parameter used in backtracking
(default 1e-4)minalpha: minimum step length used in backracking
(default 1e-6)maxiterouter: maximum number of step search steps (default 10) maxiterinner: maximum number of optimization steps in each step search step (used only in pcg, default 500) maxeta: upper bound for estimated vs actual change in trust-region
(default 0.75)mineta: lower bound for estimated vs actual change in trust-region
(default 0.25)upscale: scaling factor to increase trust radius in trust-region
(default 2.0)downscale: scaling factor to decrease trust radius in trust-region
and step length inbacktracking
(float) (default 0.25)trustradius: initial trust radius (default 0.75) maxtrustradius: maximum trust radius (default 0.75) threshold: trust-region optimization threshold, only used in pcg
method oftrust-region
optimizer: optimizes step to boundary of trust radius. One of pcg
,dogleg
,ddl
(default ddl)
-
check_line_search_condition
(cetot, petot, kappa, grad)¶ Check if Armijo condition is satisfied (e_tot(0+alpha*kappa)-e_tot(0) <= c1*alpha*(kappa,grad))
-
do_backtracking
(obj, one, two, orb, **kwargs)¶ Backtracking line search.
Arguments:
- obj
- A class instance containing the objctive function.
- one, two
- One- and Two-electron integrals (TwoIndex and FourIndex/Cholesky instances)
- orb
- An Expansion instance. Contains the MO coefficients
- Keywords:
kappa: Initial step size (OneIndex instance) gradient: Orbital gradient (OneIndex instance)
-
do_no_stepsearch
(obj, one, two, orb, **kwargs)¶ Scale step size with factor self.alpha
Arguments:
- obj
- A class instance containing the objective function.
- one, two
- One- and Two-electron integrals (TwoIndex and FourIndex/Cholesky instances)
- orb
- An Expansion instance. Contains the MO coefficients
- Keywords:
kappa: Initial step size (OneIndex instance)
-
do_trust_region
(obj, one, two, orb, **kwargs)¶ Do trust-region optimization.
Arguments:
- obj
- A class instance containing the objective function.
- one/two
- One and Two-body Hamiltonian (TwoIndex and FourIndex/Cholesky instances)
- orb
- (Expansion instance) An MO expansion
- Keywords:
kappa: Initial step size (OneIndex instance) gradient: Orbital gradient (OneIndex instance) hessian: Orbital Hessian (OneIndex instance)
-
update_alpha
(new)¶ Update current scaling factor
-
update_trustradius
(new)¶ Update current trastradius