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.

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