moldesign.min package

moldesign.min.bfgs(*args, **kwargs)
moldesign.min.sequential_least_squares(*args, **kwargs)
moldesign.min.gradient_descent(*args, **kwargs)

A careful (perhaps overly careful) gradient descent implementation designed to relax structures far from equilibrium.

A backtracking line search is performed along the steepest gradient direction.

The maximum move for any single atom is also limited by max_atom_move

Note

This algorithm is good at stably removing large forces, but it’s very poorly suited to
locating any type of critical point; don’t use this to find a minimum!

References

https://www.math.washington.edu/~burke/crs/408/lectures/L7-line-search.pdf

Parameters:
  • mol (moldesign.Molecule) – molecule to minimize
  • max_atom_move (Scalar[length]) – maximum displacement of a single atom
  • scaling (Scalar[length/force]) – unit of displacement per unit force
  • gamma (float) – number between 0 and 1 indicating scale factor for backtracking search
  • control (float) – threshold for terminating line search; this is a proportion (0<=``control``<=1) of the expected function decrease
  • **kwargs (dict) – kwargs from MinimizerBase
moldesign.min.minimize(*args, **kwargs)

Uses gradient descent until forces fall below a threshold, then switches to BFGS (unconstrained) or SLSQP (constrained).

Parameters:gd_threshold (u.Scalar[force]) – Use gradient descent if there are any forces larger than this; use an approximate hessian method (BFGS or SLSQP) otherwise

Note

Not really that smart.

Submodules

moldesign.min.base module

class moldesign.min.base.MinimizerBase(mol, nsteps=20, force_tolerance=<Quantity(0.00514220566583, 'eV / ang')>, frame_interval=None, _restart_from=0, _restart_energy=None)[source]

Bases: object

callback(*args)[source]

To be called after each minimization step

Parameters:*args – ignored
grad(vector)[source]

Callback function to calculate the objective’s gradient

objective(vector)[source]

Callback function to calculate the objective function

run()[source]

moldesign.min.descent module

class moldesign.min.descent.GradientDescent(mol, max_atom_move=<Quantity(0.05, 'ang')>, scaling=<Quantity(0.01, 'ang ** 2 / eV')>, gamma=0.4, control=0.25, **kwargs)[source]

Bases: moldesign.min.base.MinimizerBase

A careful (perhaps overly careful) gradient descent implementation designed to relax structures far from equilibrium.

A backtracking line search is performed along the steepest gradient direction.

The maximum move for any single atom is also limited by max_atom_move

Note

This algorithm is good at stably removing large forces, but it’s very poorly suited to
locating any type of critical point; don’t use this to find a minimum!

References

https://www.math.washington.edu/~burke/crs/408/lectures/L7-line-search.pdf

Parameters:
  • mol (moldesign.Molecule) – molecule to minimize
  • max_atom_move (Scalar[length]) – maximum displacement of a single atom
  • scaling (Scalar[length/force]) – unit of displacement per unit force
  • gamma (float) – number between 0 and 1 indicating scale factor for backtracking search
  • control (float) – threshold for terminating line search; this is a proportion (0<=``control``<=1) of the expected function decrease
  • **kwargs (dict) – kwargs from MinimizerBase
run()[source]
scale_move(grad)[source]
moldesign.min.descent.gradient_descent(*args, **kwargs)

A careful (perhaps overly careful) gradient descent implementation designed to relax structures far from equilibrium.

A backtracking line search is performed along the steepest gradient direction.

The maximum move for any single atom is also limited by max_atom_move

Note

This algorithm is good at stably removing large forces, but it’s very poorly suited to
locating any type of critical point; don’t use this to find a minimum!

References

https://www.math.washington.edu/~burke/crs/408/lectures/L7-line-search.pdf

Parameters:
  • mol (moldesign.Molecule) – molecule to minimize
  • max_atom_move (Scalar[length]) – maximum displacement of a single atom
  • scaling (Scalar[length/force]) – unit of displacement per unit force
  • gamma (float) – number between 0 and 1 indicating scale factor for backtracking search
  • control (float) – threshold for terminating line search; this is a proportion (0<=``control``<=1) of the expected function decrease
  • **kwargs (dict) – kwargs from MinimizerBase

moldesign.min.scipy module

class moldesign.min.scipy.BFGS(mol, nsteps=20, force_tolerance=<Quantity(0.00514220566583, 'eV / ang')>, frame_interval=None, _restart_from=0, _restart_energy=None)[source]

Bases: moldesign.min.scipy.ScipyMinimizer

moldesign.min.scipy.bfgs(*args, **kwargs)
class moldesign.min.scipy.SequentialLeastSquares(mol, nsteps=20, force_tolerance=<Quantity(0.00514220566583, 'eV / ang')>, frame_interval=None, _restart_from=0, _restart_energy=None)[source]

Bases: moldesign.min.scipy.ScipyMinimizer

moldesign.min.scipy.sequential_least_squares(*args, **kwargs)

moldesign.min.smart module

class moldesign.min.smart.SmartMin(*args, **kwargs)[source]

Bases: moldesign.min.base.MinimizerBase

Uses gradient descent until forces fall below a threshold, then switches to BFGS (unconstrained) or SLSQP (constrained).

Parameters:gd_threshold (u.Scalar[force]) – Use gradient descent if there are any forces larger than this; use an approximate hessian method (BFGS or SLSQP) otherwise

Note

Not really that smart.

run()[source]
moldesign.min.smart.minimize(*args, **kwargs)

Uses gradient descent until forces fall below a threshold, then switches to BFGS (unconstrained) or SLSQP (constrained).

Parameters:gd_threshold (u.Scalar[force]) – Use gradient descent if there are any forces larger than this; use an approximate hessian method (BFGS or SLSQP) otherwise

Note

Not really that smart.