mdtraj.utils.box_vectors_to_lengths_and_angles¶
- 
mdtraj.utils.box_vectors_to_lengths_and_angles(a, b, c)¶
- Convert box vectors into the lengths and angles defining the box. - Parameters
- anp.ndarray
- the vector defining the first edge of the periodic box (length 3), or an array of this vector in multiple frames, where a[i,:] gives the length 3 array of vector a in each frame of a simulation 
- bnp.ndarray
- the vector defining the second edge of the periodic box (length 3), or an array of this vector in multiple frames, where b[i,:] gives the length 3 array of vector a in each frame of a simulation 
- cnp.ndarray
- the vector defining the third edge of the periodic box (length 3), or an array of this vector in multiple frames, where c[i,:] gives the length 3 array of vector a in each frame of a simulation 
 
- Returns
- 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. 
 
 - Examples - >>> a = np.array([2,0,0], dtype=float) >>> b = np.array([0,1,0], dtype=float) >>> c = np.array([0,1,1], dtype=float) >>> l1, l2, l3, alpha, beta, gamma = box_vectors_to_lengths_and_angles(a, b, c) >>> (l1 == 2.0) and (l2 == 1.0) and (l3 == np.sqrt(2)) True >>> np.abs(alpha - 45) < 1e-6 True >>> np.abs(beta - 90.0) < 1e-6 True >>> np.abs(gamma - 90.0) < 1e-6 True