Get box with shape#

Constructing periodic box matrices for standard space-filling geometries.

The function molsysmt.pbc.get_box_with_shape() builds canonical \(3\times 3\) box matrices for standard unit cell shapes including cubic, truncated octahedral, and rhombic dodecahedral.

Added in version 1.0.0.

Basic usage#

Let’s construct standard cubic, truncated octahedral, and rhombic dodecahedral periodic boxes:

import molsysmt as msm
import pyunitwizard as puw
box_cubic = msm.pbc.get_box_with_shape(shape='cubic', length='2.0 nm')
box_octahedral = msm.pbc.get_box_with_shape(shape='truncated octahedral', length='2.0 nm')
box_dodecahedral = msm.pbc.get_box_with_shape(shape='rhombic dodecahedral', length='2.0 nm')

print('Cubic box:\n', box_cubic)
print('Truncated octahedral box:\n', box_octahedral)
print('Rhombic dodecahedral box:\n', box_dodecahedral)
Cubic box:
 [[[2.0 0.0 0.0]  [0.0 2.0 0.0]  [0.0 0.0 2.0]]] nanometer
Truncated octahedral box:
 [[[2.0 0.0 0.0]  [0.6666666666666666 1.885618083164127 0.0]  [-0.6666666666666666 0.9428090415820635 1.6329931618554518]]] nanometer
Rhombic dodecahedral box:
 [[[2.0 0.0 0.0]  [0.0 2.0 0.0]  [1.0 1.0 1.4142135623730951]]] nanometer

Generating multi-structure box arrays#

Using the n_structures argument, we can generate homogeneous box arrays with shape (n_structures, 3, 3):

box_traj = msm.pbc.get_box_with_shape(shape='cubic', length='3.0 nm', n_structures=10)
print('Multi-structure box shape:', box_traj.shape)
Multi-structure box shape: (10, 3, 3)