I am trying to use lammps (nov 3, 2022 version) to do NPT simulations with holonomic constraints. As mentioned in the documentation, when velocity Verlet is used as the EoM integrator, RATTLE algorithm has to be prefered over SHAKE.
I started my investigations using the rhodo bench. The input
in.rhodo file uses the two following fixes, in this order:
fix 1 all shake 0.0001 5 0 m 1.0 a 232 fix 2 all npt temp 300.0 300.0 100.0 & z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
Everything goes fine in this case.
Then I tried to use the RATTLE fix instead of SHAKE:
fix 2 all npt temp 300.0 300.0 100.0 & z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1 fix 1 all rattle 0.0001 5 0 m 1.0 a 232
Note that, according to the documentation on
fix rattle, it should be called after all other integration fixes. When I run this script, I obtain the following error:
ERROR: Fix rattle must come before any box changing fix (src/RIGID/fix_shake.cpp:365)
Indeed, NPT algorithm changes box dimensions…
Then, I tried to apply the rattle fix before the npt fix (analogously with the shake case):
fix 1 all rattle 0.0001 5 0 m 1.0 a 232 fix 2 all npt temp 300.0 300.0 100.0 & z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
I then get a WARNING and an ERROR:
rattle-npt.log:WARNING: Fix rattle should come after all other integration fixes (src/RIGID/fix_rattle.cpp:138) ... rattle-npt.log:ERROR on proc 6: Out of range atoms - cannot compute PPPM (src/KSPACE/pppm.cpp:1887)
The WARNING is totally in agreement with the documentation. The ERROR must be a consequence of the wrong order of the 2 fixes.
Finally, I have 2 problems:
if the fix rattle is placed after the fix npt, I get an error “Fix rattle must come before any box changing fix…” else if the fix rattle is placed before the fix npt, I obtain a warning “Fix rattle should come after all other integration fixes…”. Thus, the rattle fix can’t be used before nor after the npt fix.
more importantly, is it possible to use rattle with npt?
I (tried to) upload a pack.tgz archive with 4 different in.rhodo files and log files corresponding to most of the cases mentioned here, plus an output of my lmp -h command line (but new users can not upload).