htmd.units module#

htmd.units.convert(fromunit, tounit, value, fstep=1, timestep=4)#

Convert values between units.

Parameters:
  • fromunit (str) – Unit to convert from.

  • tounit (str) – Unit to convert to.

  • value (float | list | range | ndarray) – The value or array of values to convert.

  • fstep (float) – Sampling frame step of the simulation in nanoseconds.

  • timestep (float) – Timestep of the simulation in femtoseconds.

Returns:

conv – The converted value. When converting to frame or step units, the result is rounded to the nearest integer.

Return type:

scalar or numpy.ndarray

Examples

>>> convert("ns", "frame", 100, fstep=0.1)
1000