mdtraj.utils.lengths_and_angles_to_box_vectors¶
-
mdtraj.utils.
lengths_and_angles_to_box_vectors
(a_length, b_length, c_length, alpha, beta, gamma)¶ Convert from the lengths/angles of the unit cell to the box vectors (Bravais vectors). The angles should be in degrees.
- Parameters
- a_lengthscalar or np.ndarray
length of Bravais unit vector a
- b_lengthscalar or np.ndarray
length of Bravais unit vector b
- c_lengthscalar or np.ndarray
length of Bravais unit vector c
- alphascalar or np.ndarray
angle between vectors b and c, in degrees.
- betascalar or np.ndarray
angle between vectors c and a, in degrees.
- gammascalar or np.ndarray
angle between vectors a and b, in degrees.
- Returns
- anp.ndarray
If the inputs are scalar, the vectors will one dimesninoal (length 3). If the inputs are one dimension, shape=(n_frames, ), then the output will be (n_frames, 3)
- bnp.ndarray
If the inputs are scalar, the vectors will one dimesninoal (length 3). If the inputs are one dimension, shape=(n_frames, ), then the output will be (n_frames, 3)
- cnp.ndarray
If the inputs are scalar, the vectors will one dimesninoal (length 3). If the inputs are one dimension, shape=(n_frames, ), then the output will be (n_frames, 3)
Notes
This code is adapted from gyroid, which is licensed under the BSD http://pythonhosted.org/gyroid/_modules/gyroid/unitcell.html
Examples
>>> import numpy as np >>> result = lengths_and_angles_to_box_vectors(1, 1, 1, 90.0, 90.0, 90.0)