Box

class atomman.Box(**kwargs)

Bases: atomman.region.Shape.Shape, object

A representation of a triclinic (parallelepiped) box.

property a

The a lattice parameter (magnitude of avect).

Type

float

property alpha

The alpha lattice angle in degrees (angle between bvect and cvect).

Type

float

property avect

Vector associated with the a box dimension.

Type

numpy.ndarray

property b

The b lattice parameter (magnitude of avect).

Type

float

property beta

The beta lattice angle in degrees (angle between avect and cvect).

Type

float

property bvect

Vector associated with the b box dimension.

Type

numpy.ndarray

property c

The c lattice parameter (magnitude of avect).

Type

float

classmethod cubic(a)

Initializes a Box in standard cubic setting using only cubic lattice parameters.

a = b = c, alpha = beta = gamma = 90

Parameters

a (-) – The a lattice constant

Returns

Return type

atomman.Box

property cvect

Vector associated with the c box dimension.

Type

numpy.ndarray

property gamma

The gamma lattice angle in degrees (angle between avect and bvect).

Type

float

classmethod hexagonal(a, c)

Initializes a Box in standard hexagonal setting using only hexagonal lattice parameters.

a = b != c, alpha = beta = 90, gamma = 120

Parameters
  • a (-) – The a lattice constant

  • c (-) – The c lattice constant

Returns

Return type

atomman.Box

inside(pos, inclusive=True)

Indicates if position(s) are inside the shape.

Parameters
  • pos (array-like object) – Nx3 array of coordinates.

  • inclusive (bool, optional) – Indicates if points on the shape’s boundaries are to be included. Default value is True.

Returns

N array of bool values: True if inside shape

Return type

numpy.NDArray

is_lammps_norm()

Tests if box is compatible with LAMMPS. Note: large box tilt factors not checked. The LAMMPS command ‘box tilt large’ may be needed to run LAMMPS.

property lx

LAMMPS lx box length (avect[0] for normalized boxes).

Type

float

property ly

LAMMPS ly box length (bvect[1] for normalized boxes).

Type

float

property lz

LAMMPS lz box length (cvect[2] for normalized boxes).

Type

float

model(model=None, length_unit='angstrom')

Reads or generates a data model for the box.

Parameters
  • model (str or DataModelDict, optional) – JSON/XML formatted data, or path to file containing said data. If not given, then a model for the current box will be returned.

  • length_unit (str, optional) – Unit of length to save box values in if data model is to be generated. Default value is ‘angstrom’.

Returns

A JSON/XML equivalent data model for the box. Returned if model is not given

Return type

DataModelDict.DataModelDict

classmethod monoclinic(a, b, c, beta)

Initializes a Box in standard monoclinic setting using only monoclinic lattice parameters.

a != b != c, alpha = gamma = 90, beta > 90

Parameters
  • a (-) – The a lattice constant

  • b (-) – The b lattice constant

  • c (-) – The c lattice constant

  • beta (-) – The beta lattice angle in degrees

Returns

Return type

atomman.Box

property origin

Box origin position where vects are added to define the box. Can be set directly.

Type

numpy.ndarray

classmethod orthorhombic(a, b, c)

Initializes a Box in standard orthorhombic setting using only orthorhombic lattice parameters.

a != b != c, alpha = beta = gamma = 90

Parameters
  • a (-) – The a lattice constant

  • b (-) – The b lattice constant

  • c (-) – The c lattice constant

Returns

Return type

atomman.Box

property planes

The box’s planes represented as atomman.region.Plane objects.

Type

tuple

set(**kwargs)

Sets a Box’s dimensions. If parameters besides origin are given they must completely define the box. Allowed parameter sets are:

  • no parameters -> box is set to square unit box with origin = [0,0,0].

  • origin. -> Only origin is changed (same as setting origin directly).

  • vects, (and origin).

  • avect, bvect, cvect, (and origin).

  • a, b, c, (alpha, beta, gamma, and origin).

  • lx, ly, lz, (xy, xz, yz, and origin).

  • xlo, xhi, ylo, yhi, zlo, zhi, (xy, xz, and yz).

See the description of class methods and attributes for more details on the allowed parameters.

set_abc(a, b, c, alpha=90.0, beta=90.0, gamma=90.0, origin=None)

Set the box using crystal cell lattice parameters and angles.

Parameters
  • a (float) – The a lattice parameter.

  • b (float) – The b lattice parameter.

  • c (float) – The c lattice parameter.

  • alpha (float, optional) – The alpha lattice angle in degrees (angle between b and c vectors). Default value is 90.0.

  • beta (float, optional) – The beta lattice angle in degrees (angle between a and c vectors). Default value is 90.0.

  • gamma (float, optional) – The gamma lattice angle in degrees (angle between a and b vectors). Default value is 90.0.

  • origin (numpy.ndarray, optional) – The 3D vector for the box origin position. Default value is (0,0,0).

set_hi_los(xlo, xhi, ylo, yhi, zlo, zhi, xy=0.0, xz=0.0, yz=0.0)

Set the box using LAMMPS box hi’s, lo’s and tilt factors.

Parameters
  • xlo (float) – The LAMMPS xlo box lo term.

  • xhi (float) – The LAMMPS xhi box hi term.

  • ylo (float) – The LAMMPS ylo box lo term.

  • yhi (float) – The LAMMPS yhi box hi term.

  • zlo (float) – The LAMMPS zlo box lo term.

  • zhi (float) – The LAMMPS zhi box hi term.

  • xy (float, optional) – The LAMMPS box tilt factor in the xy direction. Default value is 0.0.

  • xz (float, optional) – The LAMMPS box tilt factor in the xz direction. Default value is 0.0.

  • yz (float, optional) – The LAMMPS box tilt factor in the yz direction. Default value is 0.0.

set_lengths(lx, ly, lz, xy=0.0, xz=0.0, yz=0.0, origin=None)

Set the box using LAMMPS box lengths and tilt factors.

Parameters
  • lx (float) – The LAMMPS box length in the x direction.

  • ly (float) – The LAMMPS box length in the y direction.

  • lz (float) – The LAMMPS box length in the z direction.

  • xy (float, optional) – The LAMMPS box tilt factor in the xy direction. Default value is 0.0.

  • xz (float, optional) – The LAMMPS box tilt factor in the xz direction. Default value is 0.0.

  • yz (float, optional) – The LAMMPS box tilt factor in the yz direction. Default value is 0.0.

  • origin (numpy.ndarray, optional) – The 3D vector for the box origin position. Default value is (0,0,0).

set_vectors(avect, bvect, cvect, origin=None)

Set the box using the three box vectors.

Parameters
  • avect (numpy.ndarray) – The 3D vector for the a box dimension.

  • bvect (numpy.ndarray) – The 3D vector for the b box dimension.

  • cvect (numpy.ndarray) – The 3D vector for the c box dimension.

  • origin (numpy.ndarray, optional) – The 3D vector for the box origin position. Default value is (0,0,0).

classmethod tetragonal(a, c)

Initializes a Box in standard tetragonal setting using only tetragonal lattice parameters.

a = b != c, alpha = beta = gamma = 90

Parameters
  • a (-) – The a lattice constant

  • c (-) – The c lattice constant

Returns

Return type

atomman.Box

classmethod triclinic(a, b, c, alpha, beta, gamma)

Initializes a Box in standard triclinic setting using only triclinic lattice parameters.

a != b != c, alpha != beta != gamma

Parameters
  • a (-) – The a lattice constant

  • b (-) – The b lattice constant

  • c (-) – The c lattice constant

  • alpha (-) – The alpha lattice angle in degrees

  • beta (-) – The beta lattice angle in degrees

  • gamma (-) – The gamma lattice angle in degrees

Returns

Return type

atomman.Box

classmethod trigonal(a, alpha)

Initializes a Box in standard trigonal setting using only trigonal lattice parameters.

a = b = c, alpha = beta = gamma < 120

Parameters
  • a (-) – The a lattice constant

  • alpha (-) – The alpha lattice angle in degrees

Returns

Return type

atomman.Box

property vects

Array containing all three box vectors. Can be set directly.

Type

numpy.ndarray

property volume

The volume of the box.

Type

float

property xhi

LAMMPS xhi box hi term (origin[0] + lx for normalized boxes).

Type

float

property xlo

LAMMPS xlo box lo term (origin[0] for normalized boxes).

Type

float

property xy

LAMMPS xy box tilt factor (bvect[0] for normalized boxes).

Type

float

property xz

LAMMPS xz box tilt factor (cvect[0] for normalized boxes).

Type

float

property yhi

LAMMPS yhi box hi term (origin[1] + ly for normalized boxes).

Type

float

property ylo

LAMMPS ylo box lo term (origin[1] for normalized boxes).

Type

float

property yz

LAMMPS yz box tilt factor (cvect[1] for normalized boxes).

Type

float

property zhi

LAMMPS zhi box hi term (origin[2] + lz for normalized boxes).

Type

float

property zlo

LAMMPS zlo box lo term (origin[2] for normalized boxes).

Type

float