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
Compute momentum #1529
Compute momentum #1529
Conversation
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 |
Thanks for looking at this! However I think you missed that this compute will calc the total momentum of all the atoms in a group whereas (as I understand it and I'm new to LAMMPS...) an atom style variable is per-atom. Is that right? |
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. |
I think it's fine to add to USER-MISC as a new compute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just move to USER-MISC, and state that in command doc page,
also edit the USER-MISC/README
In the last few commits I've moved the compute to USER-MISC, updated the docs, and added a test input script. I think this is now ready to go. |
agreed: ready to go when you make the doc page edits. Thanks |
Sorry @sjplimp - I don't follow which doc page needs updated. I've done
|
I just meant the paragraph at the bottom of compute_momentum.txt that I flagged |
OK - I think I've got the grammar error- afraid I didn't see anything explicitly flagged. Also resolved the merge conflicts. Thanks. |
@sjplimp this also seems to be ready and waiting to be approved and assigned to me |
doc/src/compute_momentum.txt
Outdated
|
||
[Output info:] | ||
|
||
This compute calculates a global vector (the summed momentum) on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on -> of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made some cosmetic changes
Summary
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.
Related Issues
Author(s)
Rupert Nash, EPCC, The University of Edinburgh, r.nash@epcc.ed.ac.uk
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
No
Implementation Notes
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