Implementation of machine learning framework not working with fix_box_relax

Hi Axel,

Thanks for your comments. You are right, the way I was implementing stress calculations was very “hacky”. I’ve rewritten it to follow the second path you suggested, via a new compute pressure/agni method, and it seems to work well, at least when giving reliable pressures during NVT simulations.

However, I realized that the issue with fix_box_relax goes a little deeper than I initially thought. It turns out that even the originally agni implementation (the one that is still the official version in LAMMPS), doesn’t seem compatible with minimization schemes that do not use damped dynamic based minimizers (cg, hftn, sd, etc). When I use these methods the atom positions do not move at all, even when fix_box_relax is not called.

That is because pair style agni does not compute and tally any potential energy as is mentioned under Restrictions in its documentation. It is probably a good idea to expand that statement to be more explicit about minimizers.

I’ve attached a zip file containing a LAMMPS script, an Aluminum data file, and the Al_jpc.agni force field. You can try running the script on the latest version of LAMMPS. You will see that when using the non-damped dynamics minimization schemes that the atom positions will not move and the optimization will end after a few steps. However, as soon as you switch over to something like quickmin or fire, the minimization will actually work correctly and converge the structure towards some minimum.

That is because those algorithms do some kind of quasi-MD simulations.

Do you have any thoughts as to why the agni implementation doesn’t seem to work with these non-damped dynamics minimization schemes? I figured that, if it could be “fixed” with the originally agni implementation, then it should be simple to get it to work with the new version.

Theoretically, the potential energy could be recovered from integration of the forces (minus a constant, which doesn’t matter in this case, anyway). Not sure how that would be doable in the context of a simple minimization.