glotzerlab / hoomd-blue

Molecular dynamics and Monte Carlo soft matter simulation on GPUs.
http://glotzerlab.engin.umich.edu/hoomd-blue
BSD 3-Clause "New" or "Revised" License
335 stars 131 forks source link

Enhancement/md pair gaussian value check #1810

Closed josephburkhart closed 3 months ago

josephburkhart commented 3 months ago

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 commented 3 months ago

@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 commented 3 months ago

pre-commit.ci autofix