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

Document mode in md.pair.Pair #974 #1015

Merged
merged 12 commits into from Jun 9, 2021
Merged

Document mode in md.pair.Pair #974 #1015

merged 12 commits into from Jun 9, 2021

Conversation

AlainKadar
Copy link
Contributor

Description

Added mode attribute to Pair base class. Also formatted mode attribute in each pair potential

Motivation and context

Mode attribute was missing in md.pair.Pair documentation. There were also inconsistencies in pair potentials documentation.

Resolves #974

How has this been tested?

Documentation was locally rendered in HTML.

Change log

Added mode attribute to documentation

Checklist:

@AlainKadar AlainKadar requested review from a team as code owners May 25, 2021 20:08
@AlainKadar AlainKadar requested review from joaander and bdice and removed request for a team May 25, 2021 20:08
@AlainKadar
Copy link
Contributor Author

The Checks claim that pair.py was changed by the hook (i.e. white space was deleted) but I cannot see this deletion in the Files Changed. How are changes made by the hook reflected in the file on this PR/is there a further action I need to take?

@vyasr
Copy link
Contributor

vyasr commented May 26, 2021

@AlainKadar Some of our other repos have pre-commit.ci enabled, which actually makes commits to open PRs when style fixes are needed. HOOMD doesn't currently have that enabled, so the style checks don't commit changes if any are necessary. The check you see changed the files locally when it ran, but those changes never got committed and were lost as soon as the Check ended. You need to make the same change and push, either manually (it looks like just deleting some whitespace on an otherwise empty line in pair.py) or by executing pre-commit run trailing-whitespace --file=hoomd/md/pair/pair.py.

@joaander
Copy link
Member

It looks like the issue preventing pre-commit.ci from working on HOOMD is now fixed: pre-commit-ci/issues#53 . I will enable it and see if it works. It will push changes for all the fixers except for clang-format which we still need to run manually until pre-commit-ci/issues#63 is solved.

@joaander joaander added the validate Execute long running validation tests on pull requests label May 26, 2021
Copy link
Member

@joaander joaander left a comment

Choose a reason for hiding this comment

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

Thanks!

I have a few change requests.

hoomd/md/pair/pair.py Outdated Show resolved Hide resolved
hoomd/md/pair/pair.py Outdated Show resolved Hide resolved
Comment on lines 501 to 503
Use the `params` dictionary to set
potential coefficients. The coefficients must be set per unique pair of
particle types.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Use the `params` dictionary to set
potential coefficients. The coefficients must be set per unique pair of
particle types.

Most of the potentials don't have this sentence any longer. Since we are updating them for consistency in this PR, let's remove this from all of them. The requirement is implicit in the definition of the TypeParameter type of params and it is covered in the tutorial.

Copy link
Contributor Author

@AlainKadar AlainKadar left a comment

Choose a reason for hiding this comment

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

References/formatting fixed, thanks for the feedback.

Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Copy link
Member

@joaander joaander left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Minor comments attached -- overall this is fine and I don't need to re-review.

Comment on lines 116 to 117
*mode*, *optional*: defaults to ``none``.
Possible values: ``none``, ``shift``, ``xplor``
Copy link
Member

@bdice bdice May 28, 2021

Choose a reason for hiding this comment

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

String literal values should be wrapped in quotes. If this change is accepted, please also update the formatting in the docstring above these lines.

Suggested change
*mode*, *optional*: defaults to ``none``.
Possible values: ``none``, ``shift``, ``xplor``
*mode*, *optional*: defaults to ``"none"``.
Possible values: ``"none"``, ``"shift"``, ``"xplor"``

@@ -323,7 +326,7 @@ class SLJ(Pair):
nlist (`hoomd.md.nlist.NList`): Neighbor list
r_cut (float): Default cutoff radius (in distance units).
r_on (float): Default turn-on radius (in distance units).
mode (str): Energy shifting/smoothing mode
mode (str): Energy shifting mode
Copy link
Member

Choose a reason for hiding this comment

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

Some of these attributes end with periods and others do not. Try to make that consistent across all force parameter docstrings. Specifically I see periods missing from mode and nlist (nlist (`hoomd.md.nlist.NList`): Neighbor list).

Also it's unclear to me why the word "smoothing" was deleted here but kept in the description below.

Suggested change
mode (str): Energy shifting mode
mode (str): Energy shifting/smoothing mode.

@@ -428,9 +429,7 @@ class Yukawa(Pair):
\end{eqnarray*}

See `Pair` for details on how forces are calculated and the available
Copy link
Member

Choose a reason for hiding this comment

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

Very minor nit, feel free to ignore this: the last word on this line, "available," is wrapped onto the next line in several of the Pair docstrings. Consistency might help future documentation writers that perform find/replace operations.

@@ -635,9 +629,7 @@ class DPD(Pair):
utilize the DPD functionality in your work.

`DPD` does not implement and energy shift / smoothing modes due to the
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing this is supposed to say "any," but I suppose it might support the default behavior of "none"?

Suggested change
`DPD` does not implement and energy shift / smoothing modes due to the
`DPD` does not implement any energy shift / smoothing modes due to the

@@ -718,9 +710,7 @@ class DPDConservative(Pair):


`DPDConservative` does not implement and energy shift / smoothing modes due
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`DPDConservative` does not implement and energy shift / smoothing modes due
`DPDConservative` does not implement any energy shift / smoothing modes due

of the dpd thermostat pair force with other integrators will result in
unphysical behavior.

DPDLJ does not support xplor smoothing mode. See `Pair` for details on
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
DPDLJ does not support xplor smoothing mode. See `Pair` for details on
`DPDLJ` does not support smoothing with ``mode="xplor"``. See `Pair` for details on

@@ -1454,7 +1435,7 @@ class LJ0804(Pair):
nlist (`hoomd.md.nlist.NList`): Neighbor list
r_cut (float): Default cutoff radius (in distance units).
r_on (float): Default turn-on radius (in distance units).
mode (str): energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mode (str): Energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode.

@@ -1398,7 +1380,7 @@ class LJ1208(Pair):
nlist (`hoomd.md.nlist.NList`): Neighbor list
r_cut (float): Default cutoff radius (in distance units).
r_on (float): Default turn-on radius (in distance units).
mode (str): energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mode (str): Energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode.

@@ -1343,7 +1326,7 @@ class Buckingham(Pair):
nlist (`hoomd.md.nlist.NList`): Neighbor list
r_cut (float): Default cutoff radius (in distance units).
r_on (float): Default turn-on radius (in distance units).
mode (str): energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mode (str): Energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode.

@@ -1174,7 +1158,7 @@ class ReactionField(Pair):
nlist (`hoomd.md.nlist.NList`): Neighbor list
r_cut (float): Default cutoff radius (in distance units).
r_on (float): Default turn-on radius (in distance units).
mode (str): energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mode (str): Energy shifting/smoothing mode
mode (str): Energy shifting/smoothing mode.

@joaander joaander merged commit 971e595 into master Jun 9, 2021
@joaander joaander deleted the pair_docs branch June 9, 2021 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validate Execute long running validation tests on pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document mode in md.pair.Pair
5 participants