14
$\begingroup$

I'm just now starting to use the program CP2K, and I am having trouble understanding the difference between the optimizer options (CG, BFGS, LBFGS). I have seen what they have written on their website, but it didn't help me much since I have no idea what the optimizer is.

If possible could someone also explain to me what relation the optimizer has to the DFT functional and basis set selected when doing a geometry optimization of a single molecule vs a crystal structure?

$\endgroup$
14
$\begingroup$

The question says:

I am having trouble understanding the difference between the optimizer options (CG, BFGS, LBFGS).

These are three optimization algorithms that evidently are implemented in CP2K for geometry optimization. Maybe the documentation should have said "optimization algorithm" instead of "optimizer", to make this more clear:

CG: Conjugate Gradient method

BFGS: Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm

LBFGS: Limited Memory BFGS

As for the second part of the question:

If possible could someone also explain to me what relation the optimizer has to the DFT Functional and Basis Set selected when doing a geometry optimization of a single molecule vs a crystal structure.

Essentially the DFT functional and basis set choice have no rigorous connection to the choice of optimization algorithm. The reason why more than one optimization algorithm is offered, is because some optimization problems are better solved by some algorithms than others. This would usually have much more to do with the shape of the energy surface that is being optimized, than the choice of functional or basis set. The optimization algorithm ("optimizer") that is best for a landscape with thousands of equal-value local minima, might not be the best algorithm for a more smooth surface which could be optimized much faster with a simpler algorithm.

Since CP2K has only these three methods implemented, I would recommend BFGS (the most efficient optimizer) if you have enough RAM and time, CG if the system gets a bit larger and too demanding for BFGS, and LBFGS if the system is very large.

| cite | improve this answer | |
$\endgroup$
13
$\begingroup$

Optimizer refers to the algorithm used for finding the minimum of a function.

In this specific case the optimizer is referring to "geometry optimization" which seeks to find the local minimum of the potential energy surface. However, optimizers can also be used in other areas in DFT, for example, to optimize the wavefunction.

Below I will give a brief overview of the three optimizers that you listed:

  1. CG stands for conjugate gradient, however before describing CG it's easier to first describe "steepest descent". In steepest descent you follow the negative of energy nuclear gradient ($-\displaystyle{dE/d\mathbf{x}}$) downhill to the minimum along that direction using a linesearch algorithm, and repeat this until reaching the local minimum. Because in each prior step you followed a direction to the minimum the subsequent step is by definition orthogonal (perpendicular) to the prior step, but is not orthogonal to a direction searched two steps ago (see figure).Therefore SD is inefficient near the minimum and sometimes oscillates near the solution

    enter image description here

However, note that if the potential energy surface was perfectly circular, instead of elliptical the solution would happen in two steps (N steps for N dimensions). CG takes advantage of this observation by introducing the concept of "conjugate orthogonality" -- essentially it stretches the vectors to become orthogonal in some new space which is perfectly spherical therefore the solution can again happen in N steps. This however assumes that the PES is perfectly Harmonic and we know it's analytic quadratic form ($f(x) = 1/2x^TAx + bx +c$) -- which we do not! Therefore, we aren't guaranteed that all steps will be conjugate orthogonal to all other steps, or that the solution will converge in N steps.

enter image description here

  1. In part 1 it was revealed that CG would converge in N steps if we knew the analytical form of the PES which we don't and this significantly reduces its performance. BFGS and L-BFGS are algorithms that introduce the concept of the local quadratic approximation $E(x) = E(x_0) + g^T\Delta X + 1/2\Delta x^T H_0\Delta X$

    where $H_0$ is the Hessian ($d^2 E/dx^2)$. This is better because we can now gain a better picture of the PES by including local curvature information. However, the Hessian is an expensive quantity to calculate and is typically approximated. The BFGS and L-BFGS algorithms are methods to update this approximate Hessian so that it improves over time, therefore accelerating the optimization. The main difference is that L-BFGS is less memory intensive and should be used if the system is large.

See these references for more information on optimization

References:

  1. An Introduction to the Conjugate Gradient Method Without the Agonizing Pain Edition 1/4 By Jonathan Richard Shewchuk

  2. Schlegel, H. B. Geometry optimization. Wiley Interdiscip. Rev. Comput. Mol. Sci. 1, 790–809 (2011).

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.