diff --git a/doc/fix_rigid.html b/doc/fix_rigid.html index acf9fcedb3..c06d03efd1 100644 --- a/doc/fix_rigid.html +++ b/doc/fix_rigid.html @@ -72,7 +72,11 @@ rigid fixes to be defined, but it is more expensive. temperature and pressure computations. Similary, the rigid body contribution to the pressure virial is also accounted for. The latter is only correct if forces within the bodies have been turned off, and -there is only a single fix rigid defined. +there is only a single fix rigid defined. For each linear rigid body +of three or more atoms, one degree-of-freedom must be added using a +temp_modify command (i.e. for a simulation of 10 +such rigid bodies, use "temp_modify mine extra -7", where 3 is the +default setting and -10 degrees-of-freedom are subtracted).
Note that this fix uses constant-energy integration, so you need to impose additional constraints to control the temperature of an diff --git a/doc/fix_rigid.txt b/doc/fix_rigid.txt index 8d8305a69c..efac5e4e98 100644 --- a/doc/fix_rigid.txt +++ b/doc/fix_rigid.txt @@ -65,7 +65,11 @@ The degrees-of-freedom removed by rigid bodies are accounted for in temperature and pressure computations. Similary, the rigid body contribution to the pressure virial is also accounted for. The latter is only correct if forces within the bodies have been turned off, and -there is only a single fix rigid defined. +there is only a single fix rigid defined. For each linear rigid body +of three or more atoms, one degree-of-freedom must be added using a +"temp_modify"_temp_modify.html command (i.e. for a simulation of 10 +such rigid bodies, use "temp_modify mine extra -7", where 3 is the +default setting and -10 degrees-of-freedom are subtracted). Note that this fix uses constant-energy integration, so you need to impose additional constraints to control the temperature of an diff --git a/src/fix_rigid.cpp b/src/fix_rigid.cpp index 4f6a1a721a..4b84f42b5d 100644 --- a/src/fix_rigid.cpp +++ b/src/fix_rigid.cpp @@ -832,11 +832,14 @@ int FixRigid::dof(int igroup) int *nall = new int[nbody]; MPI_Allreduce(ncount,nall,nbody,MPI_INT,MPI_SUM,world); - // remove 3N - 6 dof for each rigid body if at least 2 atoms are in igroup + // remove 3N - 6 dof for each rigid body if more than 2 atoms are in igroup + // remove 3N - 5 dof for each diatomic rigid body int n = 0; - for (int ibody = 0; ibody < nbody; ibody++) + for (int ibody = 0; ibody < nbody; ibody++) { if (nall[ibody] > 2) n += 3*nall[ibody] - 6; + else if (nall[ibody] == 2) n++; + } delete [] ncount; delete [] nall;