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 <br/> b intercell spacing along dimension |
| triangular | a intercell spacing |
| oblique | a intercell spacing along dimension <br/> b side length along dimension <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
- lattice: Lattice to be copied
Symbols
| Name | Description |
|---|---|
= | Assignment operator for Lattice. |
Members
| Name | Description |
|---|---|
| add_basis | Add a site to the atomic basis of the lattice. |
| add_dimension | Adds a dimension to the lattice along the given primitive vector. The new primitive vector must be linearly independent from the current primitive vectors. |
| basis_positions | Returns the positions of the basis sites relative to unit cell origin. |
| basis_size | Returns the size of the atomic basis in the lattice. |
| boundaries | Returns the boundary conditions of the lattice. |
| boundary | Returns the boundary condition of the lattice corresponding to the dimension index. |
| contains | Checks whether the given coordinate is in the lattice |
| dimension | Returns the size of the lattice along the primitive vector corresponding to the given index. |
| dimension_size | Returns the number of dimensions. |
| dimensions | Returns a List containing the size of the lattice along each primitive vector. |
| num_sites | Returns the number of unit cells in the lattice. |
| num_unit_cells | Returns the number of unit cells in the lattice. |
| primitive_vectors | Returns the primitive vectors of the lattice. |
| resize_dimension | Resizes the given dimension. |
| to_coordinate | Compute the site index of a given lattice coordinate. If the coordinate isn't in the lattice, throws an exception. |
| to_index | Computes the linear index for the given coordinate. If the coordinate isn't in the lattice, throws an exception. |
| to_position | Compute the position of a given lattice coordinate. If the coordinate isn't in the lattice, throws an exception. |