Compute 'next-to-last' and 'final' Energies

To whom it may concern,

I’m currently working on a project and I am trying to write a minimization script which varies the maximum number iterations.
I need to vary the max iterations based on the three minimization figures which are the “next-to-last” and “final” energies (or the last “etol”).

I’d like to ask if I can actually compute these values so that I can store them into variables for subsequent processing.
I’ve looked at the compute arguments listed in the main website, however I still wasn’t able to find a definite answer.

Kind Regards,

a) you can look at the variable doc page, section
Immediate eval of varialbes, which discusses how
to define variables with “old” values.

b) if you print thermo every step when you minimize
the next-to-last step energy value will be in the log file.
So you could write a Python script which extracts any
old values you want, and invoke it from a LAMMPS
script using the “shell” command, then write the derived
value to a file and read it into a new variable