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

Enhancement/md pair gaussian value check #1810

Merged
merged 11 commits into from
Jun 24, 2024

Conversation

josephburkhart
Copy link
Contributor

Description

I have modified the TypeParameterDict for md.pair.Gaussian, md.pair.ExpandedGaussian, and md.pair.LJGaussian so that sigma must be a positive real number. Correspondingly, I have updated docstrings and pytests to reflect the new requirement.

Motivation and context

This change ensures that users cannot accidentally or mistakenly set sigma equal to 0 for any of the Gaussian-type pair potentials, since doing so would cause divide-by-zero errors during simulation execution.

Resolves #1806

How has this been tested?

I have added new invalid parameter dictionaries to the constructor function _invalid_params() in hoomd/md/pytest/test_potential.py.

I have built the documentation using Sphinx and confirmed that the changes I made to the docstrings display properly.

Change log

Added a positive-number check to parameters for Gaussian-type pair potentials.

Checklist:

@josephburkhart
Copy link
Contributor Author

@joaander do you have any suggestions on how I can get the pre-commit.ci check to pass? As far as I can tell, I have ensured that my additions a) have no trailing whitespace and b) satisfy the yapf settings in setup.cfg. Am I missing something?

@josephburkhart
Copy link
Contributor Author

pre-commit.ci autofix

@joaander joaander added the validate Execute long running validation tests on pull requests label Jun 12, 2024
@josephburkhart josephburkhart marked this pull request as ready for review June 14, 2024 14:12
@josephburkhart josephburkhart requested review from a team as code owners June 14, 2024 14:12
@josephburkhart josephburkhart requested review from joaander, tommy-waltmann and Charlottez112 and removed request for a team June 14, 2024 14:12
Copy link
Contributor

@tommy-waltmann tommy-waltmann left a comment

Choose a reason for hiding this comment

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

Thanks for this, just a small fix in where the positive value is documented.

hoomd/md/pair/pair.py Outdated Show resolved Hide resolved
hoomd/md/pair/pair.py Outdated Show resolved Hide resolved
josephburkhart and others added 3 commits June 21, 2024 18:35
Co-authored-by: Tommy Waltmann <53307607+tommy-waltmann@users.noreply.github.com>
Co-authored-by: Tommy Waltmann <53307607+tommy-waltmann@users.noreply.github.com>
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!

hoomd/md/pair/pair.py Outdated Show resolved Hide resolved
Copy link
Contributor

@tommy-waltmann tommy-waltmann left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for working on this!

@joaander joaander merged commit 9f19af0 into trunk-patch Jun 24, 2024
40 checks passed
@joaander joaander deleted the enhancement/md-pair-gaussian-value-check branch June 24, 2024 13:59
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.

hoomd.md should warn or error on submission of certain invalid parameters for pair forces
3 participants