-
Notifications
You must be signed in to change notification settings - Fork 127
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
hoomd.md
should warn or error on submission of certain invalid parameters for pair forces
#1806
Comments
For future reference, there is HOOMD has rich Python abstractions for validating parameters. Here is an example: hoomd-blue/hoomd/md/minimize/fire.py Lines 220 to 224 in 04c6c71
hoomd-blue/hoomd/data/typeconverter.py Lines 82 to 91 in 04c6c71
You can apply hoomd-blue/hoomd/md/pair/pair.py Lines 274 to 279 in 04c6c71
hoomd-blue/hoomd/md/pair/pair.py Lines 331 to 337 in 04c6c71
|
Description
When assigning parameters for pairwise forces, it is currently possible to assign values that will cause critical errors such as divide-by-zero in the simulation's execution. It would be beneficial to detect these cases prior to simulation execution and either warn the user about them or throw an error. An example is given below.
In the following MWE, I create a binary ("A" and "B") system of particles that interact with Gaussian pairwise forces. "A" particles are cores, "B" particles are constituents. I only want interactions to happen for B particles, so I set the parameters for A-A and A-B pairs to zero. This should cause an error, since σ is in the denominator in the force's definition.
Indeed, the simulation does throw an error:
RuntimeError: Particle with unique tag 17 has NaN for its position.
. Within this MWE, the cause of the problem is pretty clear, but when working with systems that are more complex, this problem can be much more difficult to diagnose - this is evidenced by the fact that it took me, @tcmoore3 and @joaander multiple meetings and many hours to figure out that this was causing fatal errors in my simulations.Proposed solution
I am not yet familiar enough with Hoomd's architecture to directly propose a solution, but I would expect that the value check should happen in the same place where types are checked at simulation execution. With some assistance/direction from @joaander, this issue may offer a good opportunity for me to make my first pull request in this repo.
Additional context
No response
The text was updated successfully, but these errors were encountered: