pele.optimize._lbfgs_py#

class pele.optimize._lbfgs_py.LBFGS[source]

Source

class LBFGS:

minimize a function using the LBFGS routine

Parameters:
Xarray

the starting configuration for the minimization

pot

the potential object

nstepsint

the maximum number of iterations

tolfloat

the minimization will stop when the rms grad is less than tol

iprintint

how often to print status information

maxstepfloat

the maximum step size

maxErisefloat

the maximum the energy is alowed to rise during a step. The step size will be reduced until this condition is satisfied.

Mint

the number of previous iterations to use in determining the optimal step

rel_energybool

if True, then maxErise the the relative maximum the energy is allowed to rise during a step

H0float

the initial guess for the inverse diagonal Hessian. This particular implementation of LBFGS takes all the inverse diagonal components to be the same.

eventslist of callables

these are called after each iteration. events can also be added using attachEvent()

alternate_stop_criterioncallable

this criterion will be used rather than rms gradiant to determine when to stop the iteration

debug

print debugging information

loggerlogger object

messages will be passed to this logger rather than the default

energy, gradientfloat, float array

The initial energy and gradient. If these are both not None then the energy and gradient of the initial point will not be calculated, saving one potential call.

armijobool

Use the Armijo criterion instead of maxErise as the criterion for accepting a step size. The Armijo criterion is the first wolfe criterion and is a condition that the energy decrease sufficiently

armijo_cfloat

This adjusts how strong the armijo rule is. 0 < armijo_c < 1. Default 1e-4

fortranbool

use the fortran version of the LBFGS. Only the step which computes the step size and direction from the memory is in fortran.

See also

MYLBFGS

this implemented in a compiled language

pele.optimize.lbfgs_py

a function wrapper

Notes

This each iteration of this minimization routine is composed of the following parts

  1. determine a step size and direction using the LBFGS algorithm

  2. ensure the step size is appropriate (see maxErise and maxstep). Reduce the step size until conditions are satisfied.

  3. take step

http://dx.doi.org/10.1007/BF01589116

LBFGS.get_state()[source]

Source

def get_state(self):

return the state of the LBFGS memory

LBFGS.set_state()[source]

Source

def set_state(self, state):

set the LBFGS memory from the passed state

LBFGS.update_coords()[source]

Source

def update_coords(self, X, E, G):

change the location of the minimizer manually

If the position change is too great the LBFGS memory will not accurately represent the local curvature.

LBFGS.getStep()[source]

Source

def getStep(self, X, G):

update the LBFGS memory and compute a step direction and size

http://en.wikipedia.org/wiki/Limited-memory_BFGS

Liu and Nocedal 1989 http://dx.doi.org/10.1007/BF01589116

LBFGS.adjustStepSize()[source]

Source

def adjustStepSize(self, X, E, G, stp):

We now have a proposed step. This function will make sure it is a good step and then take it. This is known as a Backtracking linesearch

http://en.wikipedia.org/wiki/Backtracking_line_search

  1. if the step is not anti-aligned with the gradient (i.e. downhill), then reverse the step

  2. if the step is larger than maxstep, then rescale the step

  3. calculate the energy and gradient of the new position

  4. if the step increases the energy by more than maxErise,

    then reduce the step size and go to 3)

  5. if the step is reduced more than 10 times and the energy is still not acceptable, then increment nfail, reset the lbfgs optimizer and continue

  6. if nfail is greater than 5 abort the quench

LBFGS.reset()[source]

Source

def reset(self):

reset the LBFGS memory and H0

LBFGS.one_iteration()[source]

Source

def one_iteration(self):

do one iteration of the LBFGS loop

LBFGS.stop_criterion_satisfied()[source]

Source

def stop_criterion_satisfied(self):

test the stop criterion

LBFGS.run()[source]

Source

def run(self):

run the LBFGS minimizer

stop when the stop criterion is satisfied or when the maximum number of steps is reached

Returns:
return a results object
LBFGS.get_result()[source]

Source

def get_result(self):

return a results object