Get box from lengths and angles#
Building 3x3 periodic box matrices from lengths and angles.
The function molsysmt.pbc.get_box_from_lengths_and_angles() constructs a standard \(3\times 3\) box matrix (or array of matrices) from edge lengths \((a, b, c)\) and crystallographic angles \((\alpha, \beta, \gamma)\).
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_box_from_lengths_and_angles().
Basic usage#
Let’s construct an orthorhombic periodic box matrix from specified dimensions and 90-degree angles:
import molsysmt as msm
import pyunitwizard as puw
lengths = puw.quantity([[4.0, 5.0, 6.0]], 'nm')
angles = puw.quantity([[90.0, 90.0, 90.0]], 'degrees')
box = msm.pbc.get_box_from_lengths_and_angles(lengths, angles)
print('Constructed box matrix:\n', box)
Constructed box matrix:
[[[4.0 0.0 0.0] [0.0 5.0 0.0] [0.0 0.0 6.0]]] nanometer
Constructing triclinic box matrices#
Non-orthogonal angles generate corresponding triclinic/skewed cell matrices:
lengths_tri = puw.quantity([[3.0, 3.0, 3.0]], 'nm')
angles_tri = puw.quantity([[60.0, 60.0, 90.0]], 'degrees')
box_tri = msm.pbc.get_box_from_lengths_and_angles(lengths_tri, angles_tri)
print('Triclinic box matrix:\n', box_tri)
Triclinic box matrix:
[[[3.0 0.0 0.0] [0.0 3.0 0.0] [1.5 1.5 2.12132]]] nanometer
See also
Related Tools & References
Get lengths and angles from box: Extract lengths and angles with
molsysmt.pbc.get_lengths_and_angles_from_box().Get box with shape: Generate standard geometric boxes with
molsysmt.pbc.get_box_with_shape().Get volume from box: Compute box volume with
molsysmt.pbc.get_volume_from_box().