-
Notifications
You must be signed in to change notification settings - Fork 867
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
coordination_geometry int64 indices breaks on 32-bit systems #4161
Comments
Hi @drew-parsons thanks for reporting this and the analysis, sorry for the trouble caused. We explicitly cast This decision was made with the assumption that very few, if any, users would still be running a 32-bit platform. However, it apparently you are using one. Currently, pymatgen’s CI does not cover 32-bit systems, and I don’t have access to one for testing. I’ll need to set up a 32-bit test environment to investigate this further later. |
Not using it personally, and you're right in practice there are probably few users (maybe some on Raspberry Pi). But the Debian project tries to support as many architectures as feasible, including a few 32-bit ones. Our build logs across the various architectures are listed at https://buildd.debian.org/status/package.php?p=pymatgen. Debian hasn't migrated to numpy 2 yet, so those needful updates are still ahead for us. |
Yep I agree having better compatibility is almost always a good thing, as long as the price is not too high. I would have to look at this a bit later, thanks for sharing the info. |
Okay I just set up a Debian 12 32-bit VM and I could recreate this, would try to fix this soon.
|
Python version
Python 3.12.7
Pymatgen version
2024.10.29
Operating system version
Debian unstable
Current behavior
pymatgen coordination geometry sets an explicit
int64
for separation indices atpymatgen/src/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.py
Line 1738 in bd9fba9
This breaks on 32-bit systems at
pymatgen/src/pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.py
Line 1979 in bd9fba9
(also ll.1981,1989).
On 32-bit systems array indices are int32 (or more precisely,
np.intp
). So usingint64
as the argument to thetake()
function results in an errorError logs can be found at https://buildd.debian.org/status/fetch.php?pkg=pymatgen&arch=armel&ver=2024.10.29%2Bdfsg1-1&stamp=1731068454&raw=0
also armhf,
Expected Behavior
The index type provided to
take()
needs to be compatible.Down-conversion could be down by changing l.1979 to
(likewise at the other 2 lines).
Down conversion could be a problem if you really wanted to use 64-bit indexing on 32-bit systems, but perhaps that's unavoidable. One way of avoiding unexpected problems is to not use int64 in the first place, and define the separation indices at l.1738 as
(in which case the
astype
patch at l.1979 would not be needed)Minimal example
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: