distance_bins

mdtools.check.distance_bins(box, start, stop, step=None, num=None, precision=9, verbose=True)[source]

Check if start point, end point and step width or number of bins are chosen properly for binning distances that obey the minimum image convention.

start, stop, step and num must meet the following requirements:

  • start must be equal to or greater than zero.

  • stop must be greater than start, but less than half the box diagonal.

  • step must be greater than zero, but not greater than stop - start.

  • num must be an integer and greater than zero.

Todo

This function is not implemented, yet!

Parameters:
  • box (array_like, optional) – TODO: Docstring

  • start (scalar) – Start of interval. The interval includes this value.

  • stop (scalar) – End of interval. The interval includes(!) this value.

  • step (scalar, optional) – Step width.

  • num (int, optional) – Number of steps between start and stop. Note that either step or num or both of them must be given.

  • precision (int, optional) – Precision to use for floating point arithmetics. Default is 9 decimal places.

  • verbose (bool, optional) – If True (default), any changes of the input parameters are printed to standard output.

Returns:

  • start (float) – The input or a corrected start point.

  • stop (float) – The input or a corrected end point.

  • step (float) – The input or a corrected step width.

  • num (int) – The input or a corrected number of bins. Note: If both, step and num, are given, step is tried to be kept fixed while num is changed according to stop - start == num * step.

Raises:

ValueError – If a corrected value cannot be inferred from the given input.

Warning

Works currently only for orthogonal simulation boxes.

See also

mdtools.check.bins()

Check if the input is appropriate for creating bin edges

mdtools.check.bin_edges()

Check if bin edges are chosen properly for binning a given interval

Notes

To check binning that does not need to fulfill the minimum image convention, use mdtools.check.bins().

If you want to ensure that all bins are equidistant, do not parse step but only num. If you parse step, this function tries to keep the input step fixed, even if this implies that the last bin is smaller than all other bins.