forcezero linesearch infinite loop

Hi all,

I'm facing an infinite loop when using the forcezero line search option in association with cg method for minimization. I checked that it occurs in the "while" cycle which starts at line 713 of min_linesearch.cpp

This is the output (LAMMPS gets stuck after step 22):

LAMMPS (16 Oct 2012)
   using OpenMP capable neighbor list subroutines
Reading data file ...
   orthogonal box = (0 0 0) to (101.909 50.9442 20)
   1 by 1 by 1 MPI processor grid
   2048 atoms
280 atoms in group llead_g
280 atoms in group rlead_g
WARNING: Resetting reneighboring criteria during minimization (min.cpp:173)
Last active /omp style is pair_style airebo/omp
Setting up minimization ...
Memory usage per processor = 5.47567 Mbytes
Step PotEng Lx Ly Lz Press Temp Pxx Pyy Pzz eatoms
        0 -15142.272 101.909 50.9442 20 832.03309 0 -5266.5591 7699.2748 63.383642 -15142.272
        1 -15147.261 101.909 50.9442 20 919.76054 0 -5254.6168 7867.1711 146.72728 -15147.261
        2 -15149.367 101.909 50.9442 20 542.61529 0 -5981.3534 7527.5103 81.688923 -15149.367
        3 -15150.611 101.909 50.9442 20 381.35529 0 -6231.3015 7334.2809 41.086456 -15150.611
        4 -15151.058 101.909 50.9442 20 486.55991 0 -6005.2307 7387.9058 77.004613 -15151.058
        5 -15151.856 101.909 50.9442 20 359.49213 0 -6231.1135 7250.6953 58.894541 -15151.856
        6 -15152.309 101.909 50.9442 20 293.72721 0 -6328.455 7159.5675 50.069101 -15152.309
        7 -15152.659 101.909 50.9442 20 309.26973 0 -6300.584 7170.0465 58.346727 -15152.659
        8 -15152.81 101.909 50.9442 20 295.06347 0 -6331.5348 7161.7655 54.959712 -15152.81
        9 -15152.959 101.909 50.9442 20 251.8733 0 -6370.7283 7082.938 43.410203 -15152.959
       10 -15153.247 101.909 50.9442 20 216.56462 0 -6437.8627 7052.3982 35.158336 -15153.247
       11 -15153.393 101.909 50.9442 20 194.91924 0 -6478.2271 7027.6632 35.321638 -15153.393
       12 -15153.561 101.909 50.9442 20 156.02958 0 -6504.8775 6941.9194 31.046929 -15153.561
       13 -15153.699 101.909 50.9442 20 122.41328 0 -6559.3093 6908.3904 18.158709 -15153.699
       14 -15153.806 101.909 50.9442 20 100.39928 0 -6590.5626 6876.6643 15.096223 -15153.806
       15 -15153.901 101.909 50.9442 20 78.198693 0 -6583.5281 6805.2131 12.911042 -15153.901
       16 -15153.974 101.909 50.9442 20 59.063237 0 -6601.6549 6771.1583 7.6863143 -15153.974
       17 -15154.042 101.909 50.9442 20 46.525476 0 -6638.7233 6773.8881 4.4116645 -15154.042
       18 -15154.082 101.909 50.9442 20 38.678401 0 -6640.2056 6752.0344 4.2063587 -15154.082
       19 -15154.124 101.909 50.9442 20 30.35124 0 -6639.3552 6725.097 5.311953 -15154.124
       20 -15154.141 101.909 50.9442 20 28.609325 0 -6653.6722 6735.3393 4.160866 -15154.141
       21 -15154.173 101.909 50.9442 20 27.453346 0 -6662.13 6741.6389 2.8510883 -15154.173
       22 -15154.199 101.909 50.9442 20 28.409203 0 -6649.3615 6729.7183 4.87085 -15154.199

It happens both in serial and in parallel mode on all machines I tried (AMD, Intel...) but, unfortunately, I didn't manage to reproduce it on a small system (I have 2048 atoms).

My LAMMPS version is 28-Oct-2012 and I use CH.airebo potential.

Could it be that the list of possible exit criteria has not been exhausted in the code? Or, it's just that I have a pathological system?

I attached my script and my data file (script.in and 2_1.gra).

Bests
Fernando

script.in (1.09 KB)

2_1.gra (67.7 KB)

Hi all,

I'm facing an infinite loop when using the forcezero line search option in
association with cg method for minimization. I checked that it occurs in the
"while" cycle which starts at line 713 of min_linesearch.cpp

This is the output (LAMMPS gets stuck after step 22):

[...]

      22 -15154.199 101.909 50.9442 20 28.409203
0 -6649.3615 6729.7183 4.87085 -15154.199

It happens both in serial and in parallel mode on all machines I tried (AMD,
Intel...) but, unfortunately, I didn't manage to reproduce it on a small
system (I have 2048 atoms).

My LAMMPS version is 28-Oct-2012 and I use CH.airebo potential.

Could it be that the list of possible exit criteria has not been exhausted
in the code? Or, it's just that I have a pathological system?

well, your system may be a bit problematic. it seems to work with
quadratic linesearch, though.

I attached my script and my data file (script.in and 2_1.gra).

thanks. i've played around a little bit with it, and it looks as if
the parameter chosen to decide when your change to alpha
becomes smaller than machine precision is chosen a bit too
narrow. it may work on some 32-bit x86 machines, because
they do a lot their math on the FPU (which is using 80-bit
internally) while newer 64-bit machine default to using the
(faster) SSE unit for those operations (which is regular 64-bit).
if you make the following change to the source code, it works.

diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp
index 5ddf719..c282ec5 100644
--- a/src/min_linesearch.cpp
+++ b/src/min_linesearch.cpp
@@ -607,7 +607,7 @@ int MinLineSearch::linemin_forcezero(double eoriginal, doubl
   // fraction to which we want to reduce the directional derivative
   double GRAD_TOL = 0.1;
   // largest alpha increment which will trigger a failed_linesearch
- double MIN_ALPHA_FAC = 1e-20;
+ double MIN_ALPHA_FAC = 1e-16;
   double LIMIT_BOOST = 4.0;

   // fdothall = projection of search dir along downhill gradient

FWIW, the typical relative roundoff error for 64-bit IEEE double
precision floating point math is around 1.1e-16...

cheers,
     axel.