Closed dprada closed 3 years ago
Or we could probably make a temporary set of methods to choose the unit engine to work with between i.e. simtk.unit, pint, or unyt. Something like:
import unit_wizard
var = 1.0 * unit_wizard.unit('nanometers', form='simtk.unit')
var2 = unit_wizard.translate(var, to_form='pint')
var2 = unit_wizard.convert(var, 'milimeters')
var2 = unit_wizard.convert(var, 'milimeters', to_form='pint')
Why? Because OpenMM and relatives work with simkt.unit, but there might be a situation where the user would like to work with other unit libraries.
An auxiliary python library to help choose the quantity form (simtk.unit, Pint, unyt, ...) is beginning to be implemented as PyUnitWizard. It can be useful in MolSysMT in case different external libraries, accepting different forms, are joined in the same workflow. For example, Psi4 works with QCElemental and OpenMM with simtk.unit. (Can we find more examples?)
The library to work with units should probably be changed from simtk.unit to pint or unyt. See issue https://github.com/openmm/openmm/issues/2966