[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] units



As I was running in to issues converting units for handling various bits of data I wrote some classes to help. I have one class for MKS units and one for the KCal/Mol/Angstrom sorts of units that MD expects. And methods to handle conversions between the two. Using them you can write things like PicoJoules(1)/Meter(2) and get something with the right units out and then call convert_to_kcal to convert it to the MD units. Perhaps the latter unit should be called MDUnit or something.

It is written as C++ template classes but specific units can probably be exposed to python. However I think Scientific Python already includes this sort of thing, so it is probably not very useful. However, that means there is no easy way to test any of it with our current test framework.

Since it is written using templates, there is no easy way to integrate it into the attribute table. So don't get any ideas about that, as nice as it would be. On the plus side, there is no runtime penalty.

Attachment: units_and_constants
Description: Binary data



It is used in the soon-to-be-submitted brownian dynamics code among other things.