Dear LAMMPS developers,
In the minimize page, it is written:
It is an error to use fix shake with minimization because it turns off bonds that should be included in the potential energy of the system. The effect of a fix shake can be approximated during a minimization by using stiff spring constants for the bonds and/or angles that would normally be constrained by the SHAKE algorithm.
This appears to be outdated, as the shake documentation states :
Changed in version 15Sep2022.
These fixes may now also be used during minimization. In that case the constraints are approximated by strong harmonic restraints.
The statement on the minimize page is still true, but somewhat misleading, because it is no longer a LAMMPS error to combine the minimize command with fix shake, its just that the trick or the spring constant is automatically taken care of by LAMMPS.
Best,
Simon
@simongravelle Yes, that comment in the minimize command is outdated and should be removed.
It is not quite like that. Bonds are still disabled the same way, only fix shake is being called during minimization now. But since you cannot solve and apply the constraint equations during minimization, the same information about the “topology” of the constraints (which are all bonds, the angle constraint is converted into a bond constraint, too) is now used to add a strong harmonic force. The spring constant of that force is by default a guess, but can be set in the fix shake command line.
For the sake of completeness, I should point out that there was an issue with fix shake during minimization when the change of geometry triggered a neighbor list rebuilt. This has been addressed with the latest update (update 1) to the stable release (22 Jul 2025) and the latest feature release (10 Sep 2025).
@simongravelle I agree that this is an inconsistency. I would suggest modifying the fix shake doc page like this:
One cannot use fix shake directly with minimization because it turns off bonds that should be included in the potential energy of the system. Instead, the effect of a fix shake is approximated during a minimization by using stiff spring constants for the bonds and/or angles that would normally be constrained by the SHAKE algorithm.
@stamoor note this is about the docs for the minimize command.
@simongravelle I’ve made some updates to the minimize command docs in Collected small changes and fixes by akohlmey · Pull Request #4734 · lammps/lammps · GitHub
Please have a look and make suggestions for improvement, if you have any.
1 Like