problem with "fix rigid/nvt"


I have a problem about the "fix rigid/nvt" command in the latest version of Lammps.

my simulation box is non-periodic in Z- direction, the command is :

boundary p p s

I want to keep the molecules as rigid bodies and perform constant NVT integration, the command is :

fix NVT mol rigid/nvt molecule temp 3.47 3.47 5.0

there was no problem in the old version of Lammps without "fix rigid/npt" and "fix rigid/nph" commands, but in the latest version, it reports an error:

ERROR: Cannot use fix rigid npt/nph with non-periodic dimension (fix_rigid_nh.cpp:59)

I am 100% sure that I am not using "fix rigid/npt" or "fix rigid/nph" command in my script.

At fix_rigid_nh.cpp, line 58, the code is :

if (domain->nonperiodic)
               "Cannot use fix rigid npt/nph with non-periodic dimension");

as I understand, it may need one more condition in the if sentence to exclude the NVT integration.


Best wishes,


Hi Wei,

please use the attached fix_rigid_nh.cpp for recompilation. You are
right that the error check at line 58 is incorrect for rigid/nvt. I
removed that portion of the code because there are already other
checks for the nonperiodic dimensions (lines 80-88) when barostats are
used with fix rigid npt/nph.

Let me know if the new version of the source file works.


--- a/src/fix_rigid_nh.cpp
+++ b/src/fix_rigid_nh.cpp
@@ -55,10 +55,7 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) :
       (p_flag[1] == 1 && p_period[1] <= 0.0) ||
       (p_flag[2] == 1 && p_period[2] <= 0.0))
     error->all(FLERR,"Fix rigid npt/nph period must be > 0.0");
- if (domain->nonperiodic)
- error->all(FLERR,
- "Cannot use fix rigid npt/nph with non-periodic dimension");

fix_rigid_nh.cpp (40.6 KB)

Hi Trung,

Thank you very much,

the new file works!

Best wishes,


Hi Wei, glad to hear that. Thanks for pointing out the issue.

Steve: could you please include the updated fix_rigid_nh.cpp in this
thread in the next patch?


will be in the next patch - thanks