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)[source]¶
Convert from the lengths/angles of the unit cell to the box vectors (Bravais vectors). The angles should be in degrees.
- Parameters:
a_length (scalar or np.ndarray) – length of Bravais unit vector a
b_length (scalar or np.ndarray) – length of Bravais unit vector b
c_length (scalar or np.ndarray) – length of Bravais unit vector c
alpha (scalar or np.ndarray) – angle between vectors b and c, in degrees.
beta (scalar or np.ndarray) – angle between vectors c and a, in degrees.
gamma (scalar or np.ndarray) – angle between vectors a and b, in degrees.
- Returns:
a (np.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)
b (np.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)
c (np.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)
Examples
>>> import numpy as np >>> result = lengths_and_angles_to_box_vectors(1, 1, 1, 90.0, 90.0, 90.0)
Notes
This code is adapted from gyroid, which is licensed under the BSD http://pythonhosted.org/gyroid/_modules/gyroid/unitcell.html