JuliaMolSim / Molly.jl

Molecular simulation in Julia
Other
372 stars 51 forks source link

Handling invalid numerical parameters #34

Closed jrdegreeff closed 2 years ago

jrdegreeff commented 3 years ago

I was using Molly for a simulation and initially was using the incorrect units (kg and J). The result of this was that the simulation just hung indefinitely. Initially I thought that it was just taking a long time but after a couple hours of no progress I realized my mistake. Obviously having numbers that are off by 20+ orders of magnitude is an edge case that isn't expected, but perhaps there could be some sort of check to ideally indicate that the input is obviously unphysical or at the very least actually terminate.

Long term, it would be very nice to have integration with a unit package such as Unitful.

jgreener64 commented 3 years ago

Adding Unitful is on the todo list and would definitely help with these issues.

In the mean time it's up to the user to sort out their units, e.g. by using atomic units. I don't want to add specific checks since the scale of possible simulations is broad.

Another thing to add is more flexible reporting during simulations so bad simulations can be stopped early. However it is possible to print in a logger if you want to check things looks sensible during the simulation.

jrdegreeff commented 3 years ago

Yes I agree that creating arbitrary thresholds feels limiting. The underlying issue is really the confusion around units. I am glad to hear that Unitful is on the todo list -- that will certainly help.

jgreener64 commented 2 years ago

As of v0.4.0 you can use Unitful.jl units across the package. See the docs for more.