polymerist.unitutils
Physical constants, dimensional analysis, and unit conversion utilities
Submodules
Exceptions
Common base class for all non-exit exceptions. |
Functions
|
Naive but effective way of checking for pint and openmm units |
|
Sanitize coordinate tuples for cases which require unitless quantities |
|
Check whether a Unit or Quantity dimensionally corresponds to a volume |
|
Check whether two Quantity objects with compatible dimensions |
Package Contents
- exception polymerist.unitutils.MissingUnitsError[source]
Bases:
ExceptionCommon base class for all non-exit exceptions.
- polymerist.unitutils.hasunits(obj: Any) bool[source]
Naive but effective way of checking for pint and openmm units
- polymerist.unitutils.strip_units(coords: T | pint.Quantity | openmm.unit.Quantity) T | numpy.ndarray[Any][source]
Sanitize coordinate tuples for cases which require unitless quantities Specifically needed since OpenMM and pint each have their own Quantity and Units classes
- polymerist.unitutils.is_volume(unitlike: Unit | Quantity) bool[source]
Check whether a Unit or Quantity dimensionally corresponds to a volume Accepts both OpenMM-style and Pint-style unit-like objects
- polymerist.unitutils.quantities_approx_equal(quantity_expected: Quantity, quantity_actual: Quantity, rel_tol: float = 1e-08) bool[source]
Check whether two Quantity objects with compatible dimensions are equal to within some set relative error (default 1E-8)
Accepts both OpenMM-style and Pint-style quantity-like objects