volume

mdtools.box.volume(box, debug=False, **kwargs)[source]

Calculate the volume of orthogonal boxes.

Parameters:
  • box (array_like) – The box(es) for which to calculate the volume. Must be orthogonal and provided as [lx, ly, lz] (shape (3,)) or as an array of [lx, ly, lz] (shape (k, 3), e.g. one box for each trajectory frame). The box(es) can also contain the angles like in the format returned by MDAnalysis.coordinates.base.Timestep.dimensions: [lx, ly, lz, alpha, beta, gamma]. In this case, it is checked if the box(es) is (are) orthogonal before calculating the volume(s).

  • debug (bool, optional) – If True, check the input arguments.

    Deprecated since version 0.0.0.dev0: This argument is without functionality and will be removed in a future release.

  • kwargs (dict, optional) – Additional keyword arguments to parse to numpy.prod(). See there for possible choices. Note that the keyword axis will be ignored.

Returns:

volume (scalar or numpy.ndarray) – The volume of the box. If box was provided as an array of boxes, volume will be an array containing the volume for each box.

See also

mdtools.box.box_volume()

Calculate the volume of a single (triclinic) box

MDAnalysis.lib.mdamath.box_volume()

Calculate the volume of a single (triclinic) box

numpy.prod()

Calculate the product of array elements over a given axis

Notes

This function calculates the box volume by multiplying all box lengths using numpy.prod().