box_mat
- mdtools.check.box_mat(box_mat, orthorhombic=False, x_aligned=False, dim=None, dtype=None)[source]
Check if the input array satisfies the conditions for a simulation box matrix.
Arrays that contain simulation box matrices must meet the following requirements:
Must be of an array_like type, i.e. a type that can be converted to a
numpy.ndarray
.Must be of shape
(3, 3)
or(k, 3, 3)
, wherek
is the number of frames.
- Parameters:
box_mat (
array_like
) – The array to check. It is assumed that box matrices contain the box vectors as rows not as columns!orthorhombic (
bool
, optional) – IfTrue
, the simulation boxes must be orthorhombic, i.e. all given box matrices must be diagonal.x_aligned (
bool
, optional) – IfTrue
, the simulation boxes must align with the x-axis and the xy-plane, i.e. the first box vector must have the form[lx, 0, 0]
and the second box vector must have the form[ly1, ly2, 0]
.dim (
{None, 2, 3}
, optional) – The dimension expected for box_mat. Default isNone
, which means that the dimension of box_mat is not checked. If box_mat should contain the box vectors for only one frame, set dim to 2. If box_mat should contain the box vectors for multiple frames, set dim to 3.dtype (
type
, optional) – The data type expected for box_mat. Default isNone
, which means that the data type of box_mat is not checked.
- Returns:
box_mat (
numpy.ndarray
) – The input array asnumpy.ndarray
.- Raises:
ValueError – If box_mat has an incorrect shape or an incorrect dimensionality. Or if orthorhombic is
True
but the matrices have non-zero off-diagonal elements. Or if x_aligned isTrue
but the values in the upper triangle of the matrices are not zero. Or if dim is notNone
and neither two or three. Seemdtools.check.array()
for further potentially raised exceptions.
See also
mdtools.check.box()
Check if the input array satisfies the conditions for a simulation box array.
mdtools.check.array()
Check if an array meets given requirements
mdtools.check.pos_array()
Check if an array is a suitable position array