-
Notifications
You must be signed in to change notification settings - Fork 132
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
HDF5 logger does not check data type correctly #1620
Comments
You can work around this for now with:
We should document the behavior better and show examples with explicit type casting in custom logged quantities. I don't see how it is possible for HOOMD to predict what future data types your custom log routine might return. It not a performance penalty, we could consider adding warnings when the data type changes from one frame to the next. @b-butler how can we generically handle coercing any "floating point" type into "f8"? |
I was asking Brandon about this. Right now it's almost like the default type is |
Yes, but under what somewhat complete set of conditions should HDF5Log store integer types? So that another user who provides a numpy.int64 (or some other integer type) does not run into problems where there is a loss of precision during the conversion to float? |
Description
Currently
hoomd.write.HDF5Log
checks the data type of the values withdtype = "f8" if isinstance(value, float) else "i8"
, which does not account for data types such asnumpy.float64
. We should either include these types because users might define custom quantities which are calculated from NumPy etc, or provide an option for the user to specify the data type? In the following example, originally the acceptance ratio is an integer, but after several trial moves are made it will be float. We will probably also need to account for this when checking the data types, or document this behavior.Script
Input files
No response
Output
Expected output
No response
Platform
Linux
Installation method
glotzerlab-software container
HOOMD-blue version
4.1.0
Python version
3.11.3
The text was updated successfully, but these errors were encountered: