CG vs BFGS optimizer

732 views
Skip to first unread message

Tobias Kraemer

unread,
Jul 18, 2014, 7:29:12 AM7/18/14
to cp...@googlegroups.com
Dear all,


I was wondering if someone could clarify for which system size the CG optimizers should be preferred over BFGS?
The manual states that CG is "OK for large systems", while BFGS is "most efficient for 'small' systems".
One of my systems contains 520 atoms, and I have tried both optimizers, on the same starting structure. While
BFGS converged within 40 geometry optimisation cycles (~15 hrs walltime), CG is still going (started at same time).
It is showing signs of convergence though, which is  good. So I understand that BFGS is much more efficient in this
particular case. Is there a rule of thumb for the system size in terms of number of atoms?

Another question in the context of geometry optimisations, is there a way to output both the cell axis along with the current
geometry of the model? The xyz does not contain info about the cell axis, while I seem to be unable to analyse each
step of the optimiation if I set the format in the output to pdb. Is there a viewer which could show both (essentially showing the
individual structures during the geometry optimisation steps and the cell axis).

Your answers are much appreciated ....


Best


Tobias

 

Matthias Krack

unread,
Jul 18, 2014, 7:52:47 AM7/18/14
to cp...@googlegroups.com
Dear Tobias,

BFGS should be fine up to the order of  (a few) 1000 atoms depending on your computational resources, because it involves the diagonalisation of a matrix with the dimensions of 3 times the number of atoms. This becomes readily a bottleneck.

For large systems I would recommend LBFGS which shows an efficiency close to BFGS and it workw for 100,000s of atoms. The CG can show a very slow convergence, but it is usually quite robust and can be used for cases where LBFGS troubles.

You may also dump in the formats dcd or dcd_aligned_cell see
http://manual.cp2k.org/trunk/CP2K_INPUT/MOTION/PRINT/TRAJECTORY.html#desc_FORMAT
DCD is a binary dump, but this saves time and disk space for large systems. DCD files can be displayed for instance with vmd, but they contain no atomic information. Thus you have first to load a pdb or xyz file of your system (just one configuration, but same atomic order, e.g. the intial one) and then you load the dcd file into this molecule. This allows a plotting of the atoms and the cell for each configuration, which is useful for variable cells.

Best,

Matthias

Tobias Kraemer

unread,
Jul 18, 2014, 9:07:05 AM7/18/14
to cp...@googlegroups.com
Dear Matthias,


thanks for your quick response. This clarifies a lot about the optimizer. Admittedly, 500 odd atoms is not a large system
on this scale then. Thanks also for pointing out LBFGS to me.
I will play around with the output format, VMD is installed on my machine, and I have worked with it. I will give it a try.


Thanks so much


Best

Tobias

Julian Garrec

unread,
Jul 21, 2014, 5:49:59 PM7/21/14
to cp...@googlegroups.com


On Friday, July 18, 2014 1:29:12 PM UTC+2, Tobias Kraemer wrote:
Dear all,



Another question in the context of geometry optimisations, is there a way to output both the cell axis along with the current
geometry of the model? The xyz does not contain info about the cell axis, while I seem to be unable to analyse each
step of the optimiation if I set the format in the output to pdb. Is there a viewer which could show both (essentially showing the
individual structures during the geometry optimisation steps and the cell axis).

I would try to output a dcd

&MOTION
 
  ...

    &PRINT
        &TRAJECTORY
            FILENAME =traj.dcd
            FORMAT  DCD
            &EACH
                MD 10
            &END
        &END TRAJECTORY

&END MOTION

then
   vmd -f your_initial_config[.xyx|.pdb] traj.dcd
Finally, in the tk console:
   pbc box

 

ma455...@gmail.com

unread,
May 5, 2024, 9:32:28 PM5/5/24
to cp2k
Dear all,

I am currently conducting simulations on molecular adsorption onto a slab comprising 800 atoms, and I am seeking advice on the reliability of optimizers, specifically BFGS and CG.

My initial observations show that BFGS tends to yield lower energy results compared to CG in less SCF cycles. However, during my experiments with varying freezing layer numbers of the slabs, I noticed that CG consistently produces the same final geometry, while BFGS generates different geometries. This has led me to believe that CG may be slightly more reliable; however, the convergence using CG is really slow.

I would greatly appreciate any insights or suggestions regarding the choice between these optimizers, particularly in the context of molecular adsorption simulations.

Regards,
Hongyang

Reply all
Reply to author
Forward
0 new messages