[lammps-users] degrees of freedom for linear molecules


I noticed this in the code for fix rigid: fix_rigid.cpp removes 3N-6 degrees of freedom from each rigid body consisting of two or more atoms. While this is in general true, it is not true for diatomic or otherwise linear molecules. In that case, only 3N-5 dof should be subtracted from each rigid body. This effects the calculation of the temperature and pressure, however temp_modify can be used to account for the discrepancy with dof. Perhaps a line can be added to the fix_rigid documentation?



We’ve changed fix_rigid.cpp to correctly deal with the degrees-of-freedom for rigid diatomic molecules. It won’t deal with linear rigid molecules that have 3 or more atoms though, so we added a disclaimer in the fix_rigid documentation. That can be handled using temp_modify as you suggest.

You should consider using fix shake for rigid diatoms since it is almost certainly more efficient and should give the same answers.