openforcefield.utils.utils.detach_units¶
-
openforcefield.utils.utils.
detach_units
(unit_bearing_dict, output_units=None)[source]¶ Given a dict which may contain some simtk.unit.Quantity objects, return the same dict with the Quantities replaced with unitless values, and a new dict containing entries with the suffix “_unit” added, containing the units.
- Parameters
- unit_bearing_dictdict
A dictionary potentially containing simtk.unit.Quantity objects as values.
- output_unitsdict[str
A mapping from parameter fields to the output unit its value should be converted to. For example, {‘length_unit’: unit.angstrom}. If no output_unit is defined for a key:value pair in which the value is a simtk.unit.Quantity, the output unit will be the Quantity’s unit, and this information will be included in the unit_dict return value.
- Returns
- unitless_dictdict
The input smirnoff_dict object, with all simtk.unit.Quantity values converted to unitless values.
- unit_dictdict
A dictionary in which keys are keys of simtk.unit.Quantity values in unit_bearing_dict, but suffixed with “_unit”. Values are simtk.unit.Unit .