While Freud attempts to make as few assumptions about your data as possible, in order to be as general and flexible as possible, Freud often has to assume your data exist in some kind of 2D or 3D physical space, henceforth known as a simulation box or just box. Full Box Documentation is available.
from freud import box
box0 = box.Box(Lx=5, Ly=6, Lz=7, xy=0.5, xz=0.6, yz=0.7, is2D=False)
cube_box = box.Box.cube(L=5)
print(cube_box.Lx, cube_box.Lz, cube_box.Ly, cube_box.xy, cube_box.xz, cube_box.yz, cube_box.is2D())
5.0 5.0 5.0 0.0 0.0 0.0 False
If your box is a square, you may use the following:
square_box = box.Box.square(L=5)
print(square_box.Lx, square_box.Lz, square_box.Ly, square_box.xy, square_box.xz, square_box.yz, square_box.is2D())
5.0 0.0 5.0 0.0 0.0 0.0 True
Some data readers may provide box objects which can be directly passed in:
#box_data = some_object.box
#box_from_box = box.Box.from_box(box_data)
#box_matrix = to_matrix(some_object.box)
#box_from_matrix = box.Box.from_matrix(box_matrix)
square_box = box.Box.square(L=5)
square_box.to_matrix()
[[5.0, 0.0, 0.0], [0, 5.0, 0.0], [0, 0, 0.0]]
to_tuple()
¶You may also export as a named tuple (which can be used to initialize another Freud box):
square_box.to_tuple()
BoxTuple(Lx=5.0, Ly=5.0, Lz=0.0, xy=0.0, xz=0.0, yz=0.0)