gfrd / modern_egfrd

modern C++ implementation of eGfrd
GNU General Public License v2.0
7 stars 8 forks source link

GSL_ERROR: invalid argument supplied by user in brent.c:74 - endpoints do not straddle y=0 #3

Closed Aratz closed 6 years ago

Aratz commented 6 years ago

Hi,

When I run GFRD in custom mode (see SimCustom.hpp and input file in the attachment), with the following command: modern_egfrd/build/bin/RunGfrd --custom -seed 17 -e 0.1 -wsize 1e-06 -in input.txt -out output.txt , the simulation crashes with the following error message:

12:42:03.631 GFRD [FATAL] : GSL_ERROR: invalid argument supplied by user in brent.c:74 - endpoints do not straddle y=0
12:42:03.632 RunGfrd [INFO] : Simulation failed after : 0.104 seconds / 10123 steps.

This error is very specific to the seed and the input file, that is, changing the seed, changing the coordinates of one molecule, or even removing one molecule, fixes the problem.

I do however run many simulations and this issue arose several times. Changing the seed until it works is not really a good solution. I've started investigating the code but would appreciate some help for debugging. The problem seem to originate from one of the GreenFunction files.

Attachment: SimCustom.txt input.txt

Aratz commented 6 years ago

I made an attempt to fix this. The simulation mentioned above now runs properly but the unit tests are broken. It does seem it's only because of rounding errors though. I would appreciate some input here so I can fix the broken test case.

Seynen commented 6 years ago

Hi Adrian, thanks for point this out. We have not encountered this before, but it is easy to reproduce. For some (yet unclear) reason the root is exactly at the high limit of the search interval. GLS's brent root solver wants it to be inside the interval, hence the error. I implemented your suggestion to expand the interval (but not as much as 10%, but a more modest increase). I ran your custom-model with 50 different seeds for 10 seconds simulation-time each, without any errors. The test-case failed, but that is no concern. The result changed by less than one millionth of a percent, good enough. Best regards, Marco