Skip to main content

Lattice

Class that represents a crystal lattice (Bravais lattice and atomic basis)

To create a lattice one should use the lattice factory class. Parameters to the lattice class always follow the convention that a, b, and c correspond to side length, and theta and phi correspond to angles. The predefined lattices and their parameters are: | Name | Parameters | | :----: | :--------- | | square | a intercell spacing | | rectangular | a intercell spacing along dimension 11<br/> b intercell spacing along dimension 22 | | triangular | a intercell spacing | | oblique | a intercell spacing along dimension 11 <br/> b side length along dimension 22<br/> theta angle between primitive vectors | | honeycomb | a intersite spacing | Also included is the two dimensional honeycomb lattice.

Factories

lattice(const RealMatrix primitive_vectors, const List<integer> dimensions) -> Lattice

Constructor for lattice class.

Parameters

  • primitive_vectors: Primitive vectors of lattice, must give a vector for each dimension.
  • dimensions: Dimensions of the lattice.

lattice(const string geometry, const List<integer> dimensions) -> Lattice

Constructor for lattice.

Parameters

  • geometry: One of the predefined lattice geometries: honeycomb, honeycomb, square, oblique, triangular, rectangular, chain
  • dimensions: Size of the lattice along each dimension

Example

var my_lattice = lattice("square", [100, 120])

lattice(const RealMatrix primitive_vectors, const RealMatrix basis, const List<integer> dimensions) -> Lattice

Constructor for lattice.

Parameters

  • primitive_vectors: Primitive vectors of lattice, must give a vector for each dimension.
  • basis: Positions of basis associated with each Bravais lattice point.
  • dimensions: Dimensions of the lattice.

lattice(const RealMatrix primitive_vectors, const List<integer> dimensions, const List<BC> boundary conditions) -> Lattice

Constructor for lattice class.

Parameters

  • primitive_vectors: Primitive vectors of lattice, must give a vector for each dimension.
  • dimensions: Dimensions of the lattice.
  • boundary conditions: Boundary conditions of the lattice.

lattice(const string geometry, const List<integer> dimensions, const List<BC> boundary condition) -> Lattice

Constructor for lattice.

Parameters

  • geometry: One of the predefined lattice geometries: honeycomb, honeycomb, square, oblique, triangular, rectangular, chain
  • dimensions: Size of the lattice along each dimension
  • boundary condition: Boundary conditions for each dimension.

Example

var my_lattice = lattice("triangular", [100, 120], [boundary_condition.open, boundary_condition.periodic])

lattice(const string geometry, const List<integer> dimensions, const Map parameters) -> Lattice

Constructor for lattice.

Parameters

  • geometry: One of the predefined lattice geometries: honeycomb, honeycomb, square, oblique, triangular, rectangular, chain
  • dimensions: Size of the lattice along each dimension
  • parameters: Lattice parameters. These are interpreted differently depending on the lattice.

Example

var my_lattice = lattice("oblique", [100, 120], ["a" : 1.2, "b" : 0.1, "theta" : 0.2*pi])

lattice(const RealMatrix primitive vectors, const RealMatrix basis, const List<integer> dimensions, const List<BC> boundary condition) -> Lattice

Constructor for lattice.

Parameters

  • primitive vectors: Primitive vectors of lattice, must give a vector for each dimension.
  • basis: Positions of basis associated with each Bravais lattice point.
  • dimensions: Dimensions of the lattice.
  • boundary condition: Boundary conditions for each dimension.

lattice(const string geometry, const List<integer> dimensions, const Map parameters, const List<BC> boundary condition) -> Lattice

Constructor for lattice.

Parameters

  • geometry: One of the predefined lattice geometries: honeycomb, honeycomb, square, oblique, triangular, rectangular, chain
  • dimensions: Size of the lattice along each dimension
  • parameters: Lattice parameters. These are interpreted differently depending on the lattice.
  • boundary condition: Boundary conditions for each dimension.

Example

var my_lattice = lattice("square", [10, 4], ["a" : 1.2], [boundary_condition.open, boundary_condition.open])

Constructors

Lattice(const Lattice lattice) -> Lattice

Constructs a copy of the given Lattice

Parameters

Symbols

NameDescription
=Assignment operator for Lattice.

Members

NameDescription
add_basisAdd a site to the atomic basis of the lattice.
add_dimensionAdds a dimension to the lattice along the given primitive vector. The new primitive vector must be linearly independent from the current primitive vectors.
basis_positionsReturns the positions of the basis sites relative to unit cell origin.
basis_sizeReturns the size of the atomic basis in the lattice.
boundariesReturns the boundary conditions of the lattice.
boundaryReturns the boundary condition of the lattice corresponding to the dimension index.
containsChecks whether the given coordinate is in the lattice
dimensionReturns the size of the lattice along the primitive vector corresponding to the given index.
dimension_sizeReturns the number of dimensions.
dimensionsReturns a List containing the size of the lattice along each primitive vector.
num_sitesReturns the number of unit cells in the lattice.
num_unit_cellsReturns the number of unit cells in the lattice.
primitive_vectorsReturns the primitive vectors of the lattice.
resize_dimensionResizes the given dimension.
to_coordinateCompute the site index of a given lattice coordinate. If the coordinate isn't in the lattice, throws an exception.
to_indexComputes the linear index for the given coordinate. If the coordinate isn't in the lattice, throws an exception.
to_positionCompute the position of a given lattice coordinate. If the coordinate isn't in the lattice, throws an exception.