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

Overflow Error #11

Closed
dr-aspirinas opened this issue Feb 20, 2024 · 3 comments · Fixed by #12
Closed

Overflow Error #11

dr-aspirinas opened this issue Feb 20, 2024 · 3 comments · Fixed by #12

Comments

@dr-aspirinas
Copy link

Hi Jackson,

I am also interested in maintaining mordred because they are quite handy.
Although you silenced the warning concerning overflow, this avoids some descriptors to be calculated. I found that there is another way to avoid overflowing (not throwing an error at all). Just modify the code like this:

#from numpy import product
from numpy import product, array, float128

    with self.rethrow_zerodiv():
        Dvv = array(Dv, dtype=float128)             # this avoids the overflow error
        dx = product(Dvv) ** (1.0 / (2.0 * n))
    return n / (dx ** 2)

I have tested with the largest molecule that I could think of (cyclosporin, MW ~1200 Da) without errors.
Only with PEG-2000 (MW 2000 Da) I got the error again (so it is related with size).

Hope it helps!

@JacksonBurns
Copy link
Owner

@dr-aspirinas thanks for the suggestion! Do you notice any timing differences with this change?

@dr-aspirinas
Copy link
Author

@JacksonBurns, no I haven't noticed any slowdown.

@JacksonBurns
Copy link
Owner

Great! I have implemented this in #12, could you take a look and make sure it looks good? I had to use longdouble instead of float128, since it turned out the latter is only a valid alias on unix-based platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants