# some details about the hftn minimization

Hi LAMMPS developers,

I am trying to understand the hftn minimization method currently coded. There are two criteria, used to determine the acceptance of a trial step, that confused me.

(1)
Basically the inner CG-like loop take in the current energy, force and trust region radius, and returns updated energy and force. Then at determining whether the updated energy and force should be accepted or not, my first question is about the condition below:

---------------- code -----------------
//---- ACCEPT OR REJECT THE STEP PROPOSED BY THE INNER CG LOOP.
//---- WHEN NEAR A SOLUTION, THE FORCE NORM IS PROBABLY MORE ACCURATE,
//---- SO DON’T ACCEPT A STEP THAT REDUCES ENERGY SOME TINY AMOUNT
//---- WHILE INCREASING THE FORCE NORM.
bool bStepAccepted = (dAred > 0.0)
&& ( (dNewForce2 < dCurrentForce2)

(dCurrentForce2 > 1.0e-6));
---------------- code -----------------

“dAred” is the Actual reduction in energy, i.e. current energy minus updated energy. No problem for requiring dAred>0.0.
“dCurrentForce2” and “dNewForce2” are the current and updated force norm, also no problem for those.
But I don’t quite understand why “(dCurrentForce2 > 1.0e-6)” is ORed with “(dNewForce2 < dCurrentForce2)” ?

If I am correct, in such an example case where
“dAred>0 is true, AND
dCurrentForce2>1.0e-6 is true, AND
dNewForce2 > dCurrentForce2 is ture” ,
the boolean bStepAccepted will be true, even if the force norm increases.

While the intention seems to “DON’T ACCEPT A STEP THAT REDUCES ENERGY SOME TINY AMOUNT WHILE INCREASING THE FORCE NORM”, isn’t the example case fails the intention ?

(2)
If bStepAccepted is true, inside “if (bStepAccepted) { … }”, the trust region radius is updated like below:

---------------- code -----------------
//---- UPDATE THE TRUST REGION BASED ON AGREEMENT BETWEEN
//---- THE ACTUAL REDUCTION AND THE PREDICTED MODEL REDUCTION.
if ((dAred > 0.75 * dPred) && (dStepLength2 >= 0.99 * dTrustRadius))
---------------- code -----------------

Two conditions make the dTrustRadius double.

0.75dPred, is the 0.75 here based on experience/experiment, or any other consideration ?
dStepLength2>=0.99

Please forgive me if I asked stupid questions due to my lack of knowledge in trust region kind methods.

Regards,
Liu

I'll see if either Aidan or Todd can answer this ...

Steve

Hi,

Those are both good questions.

(1) The logic might be better understood if you think of the negation (which is what the comment expresses). Step acceptance requires actual reduction (Ared>0). However, even with positive Ared the step is rejected if the force magnitude is near zero (dCurrentForce2 <= 1.0e-6) and the new force magnitude is not an improvement (dNewForce2 >= dCurrentForce2). Otherwise, the step is accepted. The heuristic is addressing small inaccuracies in LAMMPS potentials when the force is very small. If gradients were exact, then the code would just test Ared>0.

Your counterexample is true, but deals with a different regime: areas where the force vector is still of reasonable magnitude. In this case the trust region model accepts a step because it trusts in Ared. If Ared is positive even though the force magnitude increased, then the trust region believes second order (quadratic) curvature is dominating the first order force gradient and takes the step anyway.

(2) The constant 0.75 was chosen based on a few LAMMPS experiments. Trust region theory allows any value less than one to be used. The constant 0.99 allows for roundoff error. Step length is truncated at trust region length, so in exact arithmetic an equals sign would work. In practice, the step length might be a smidgen smaller, so I put in the 0.99 as a safeguard.

Thanks,
Todd

Thank you Todd for the careful explanations, they all make perfect sense to me. I learned a lot !
And, thank you Steve for forwarding my questions around.

Regards,
Liu