Fixed a bug in computing the langevin torques applied to rigid bodies #2367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses the issue reported by #2288 where the langevin thermostat inside fix rigid and fix rigid/small (and their variants) does not function as expected.
Related Issues
Closes #2288
Author(s)
Trung Nguyen (Northwestern)
Licensing
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
Backward Compatibility
The PR should respect backward compatibility.
Implementation Notes
From the tests done by @valesori regarding the issue #2288, it seems that the body rotational degrees of freedom are not thermostated properly. This is because the langevin torques (langextra[3], langextra[4] and langextra[5]) to be added to the bodies should be in the space frame. Originally these torques were computed from the principal moments of inertia (defined in the body frame) and the body angular velocities in the space frame (omega), which are inconsistent with each other. The changes in this PR do the following: 1) converting the body angular velocities from the space frame into the body frame, then 2) computing the langevin torques in the body frame, and 3) converting the torques from the body frame back to the space frame.
Since other fix rigid variants derive from FixRigid or from FixRigidSmall, the changes in this PR are applicable to those variants as well.
Currently, the temporary variables wbody[3] and tbody[3] and the convertion back and forth between the space and body frames are for code readability.
Post Submission Checklist