htmd.units module#
- htmd.units.convert(fromunit: str, tounit: str, value: float | list | range | ndarray, fstep: float = 1, timestep: float = 4)#
Convert values between units.
- Parameters:
fromunit (str) – Unit to convert from.
tounit (str) – Unit to convert to.
value (scalar or list or range or numpy.ndarray) – The value or array of values to convert.
fstep (float, optional) – Sampling frame step of the simulation in nanoseconds.
timestep (float, optional) – Timestep of the simulation in femtoseconds.
- Returns:
conv – The converted value. When converting to
frameorstepunits, the result is rounded to the nearest integer.- Return type:
scalar or numpy.ndarray
Examples
>>> convert("ns", "frame", 100, fstep=0.1) 1000