Get lengths and angles from box#
Extracting edge lengths and crystallographic angles from box matrices.
The function molsysmt.pbc.get_lengths_and_angles_from_box() returns both the edge lengths \((a, b, c)\) and the crystallographic angles \((\alpha, \beta, \gamma)\) from a periodic box matrix.
Added in version 1.0.0.
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.pbc.get_lengths_and_angles_from_box().
Basic usage#
Let’s extract both lengths and angles from a truncated octahedral box:
import molsysmt as msm
import pyunitwizard as puw
box = msm.pbc.get_box_with_shape(shape='truncated octahedral', length='4.0 nm')
lengths, angles = msm.pbc.get_lengths_and_angles_from_box(box)
print('Box lengths:', lengths)
print('Box angles (degrees):', puw.convert(angles, to_unit='degrees'))
Box lengths: [[4.0 4.0 4.0]] nanometer
Box angles (degrees): [[70.5287554536443 109.47120709841901 70.5287554536443]] degree
See also
Related Tools & References
Get box with shape: Generate standard boxes with
molsysmt.pbc.get_box_with_shape().Get box from lengths and angles: Rebuild box matrices with
molsysmt.pbc.get_box_from_lengths_and_angles().Get shape from angles: Determine shape from angles with
molsysmt.pbc.get_shape_from_angles().