Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug in computing the langevin torques applied to rigid bodies #2367

Merged
merged 2 commits into from
Sep 17, 2020

Conversation

ndtrung81
Copy link
Contributor

@ndtrung81 ndtrung81 commented Sep 16, 2020

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

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • Suitable new documentation files and/or updates to the existing docs are included
  • The added/updated documentation is integrated and tested with the documentation build system
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system
  • Suitable tests have been added to the unittest tree.
  • A package specific README file has been included or updated
  • One or more example input decks are included

Copy link
Contributor

@sjplimp sjplimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment in code ...

@sjplimp
Copy link
Contributor

sjplimp commented Sep 16, 2020

Thanks for fixing this issue @ndtrung81

Copy link
Contributor

@sjplimp sjplimp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my earlier comment, I meant thanks Trung for fixing the Langevin issue raised by the user.

@akohlmey akohlmey merged commit c14fd31 into lammps:master Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] fix rigid/nve langevin not working as expected
3 participants