Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Compute momentum #1529
Add a compute for the total momentum of a group on atoms, in the style of compute KE
For now, I have added this to the main LAMMPS src/ directory but you may prefer that I contribute this to USER-MISC. If this is the case, please let me know and I will alter the PR to make it so.
This compute is useful for a larger suite of fixes (for coupling between LAMMPS an other codes using MUI https://github.com/MxUI/MUI) I plan to contribute back as a user package in the coming months.
Rupert Nash, EPCC, The University of Edinburgh, email@example.com
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).
I cribbed the class definition from compute_ke.h/.cpp, changing from scalar to vector
This was tested on a variety of input scripts by also dumping atom velocities masses.
No other features are affected.
Post Submission Checklist
Please check the fields below as they are completed after the pull request has been submitted. Delete lines that don't apply
Further Information, Files, and Links
Thanks for putting in the effort to submit a pull request. But why not simply define the following atom style variables:
and then access
with access through
you are correct, I missed that. however, that would just be one more line of input.
OK! Thanks for the comments Axel. I guess this is a risk with LAMMPS being so big.
However since the code now exists, and would save users some effort/learning, I'm still willing to tick off the remaining items above, if you think it's of value to the users. If you think on balance it's better to use the variable + reduce compute in script then I'm happy if you just close the PR.
I am coming out neutral on this one. On one hand, this command allows to do with one line of input script, what otherwise requires four, on the other hand, it is additional code (albeit simple code) to maintain. I was asking for a particular use case for this command versus input script to tip the scales toward including it. If added, it should definitely go into the USER-MISC package, though.
I'll assign the PR to @sjplimp for a second opinion.
Sorry @sjplimp - I don't follow which doc page needs updated. I've done