pythtb.Mesh#
- class Mesh(axis_types, axis_names=None, dim_k=None)[source]#
Store and manage a mesh in \((k, \lambda)\)-space.
Added in version 2.0.0.
This class is responsible for constructing a mesh sampling of the combined reciprocal space and additional adiabatic parameters, i.e. \((k, \lambda)\)-space. It provides methods to build both grid and path representations of the mesh, or a custom mesh with user-defined points. The mesh can be a pure k-space mesh, a pure parameter space mesh, or a mixed mesh with axes in both spaces. The mesh can also be a grid or a path.
A grid mesh has an axis for each dimension of the mesh, while a path mesh has a single axis that traces a path through the combined \((k, \lambda)\)-space. For example, in 2D k-space, a grid will have 2 axes that sample the kx and ky directions independently, while a path mesh would have a single axis that samples along some direction in the combined space, varying one or more k-components. The last axis of the array represents the vector components in \((k, \lambda)\)-space.
- Parameters:
- axis_typeslist[str]
A list of axis types, which can be
"k"or"l"for k-space and parametric space respectively. The length of this list will determine the number of dimensions in the mesh.- axis_nameslist[str], optional
A list of axis names, which can be used for parametrically populating a
pythtb.WFArray. If unspecified, default names will be generated. See examples listed below for more details.- dim_kint, optional
The dimensionality of k-space. If unspecified, this will default to the number of
"k"axes specified inaxis_types. Specifying this parameter is useful when creating a mesh with fewer k-axes than the full k-space dimensionality, such as when creating a path through 2D k-space using only a single k-axis. This will determine the dimension of the vector at each mesh point. Must be at least equal to the number of"k"axes specified inaxis_types.
See also
Notes
The mesh points are stored in reduced units, i.e., in units of the reciprocal lattice vectors for k-space and in units of the full parameter range for parameter space.
The parameter space is assumed to be orthogonal to the k-space. This means that when varying the parameter along its axis, the k-components are held fixed.
The dimension of parameter space is
dim_kplus the number of"l"axes specified inaxis_types. This means that it is currently not supported to have a path through adiabatic parameter space, we must have a separate axis for each parameter dimension.
Examples
We can create a full grid by specifying the shape of the grid.
>>> mesh = Mesh(axis_types=['k', 'k']) >>> mesh.build_grid(shape=(10, 10), gamma_centered=True) >>> mesh.grid.shape (10, 10, 2)
Or suppose we have a 3D k-space model with an additional lambda dimension.
>>> mesh = Mesh(axis_types=['k', 'k', 'k', 'l']) >>> mesh.build_grid(shape=(10, 10, 10, 100), gamma_centered=True) >>> mesh.grid.shape (10, 10, 10, 100, 4)
Since we have a gamma-centered grid, the k-axes go from [-0.5, 0.5) non-inclusive. The endpoints for the lambda axis are included by default.
>>> mesh.grid[0, 0, 0, 0, 0] array([-0.5, -0.5, -0.5, 0. ]) >>> mesh.grid[-1, -1, -1, -1, -1] array([ 0.49, 0.49, 0.49, 1. ])
Suppose instead we have a custom path through k-space that is not a regular grid. We would then need to initialize the
Meshwith a single ‘k’ axis type.>>> path_points = np.random.rand(100, 2) # 100 point path in 2D k-space >>> mesh = Mesh(axis_types=['k'], dim_k=2) >>> mesh.build_custom(path_points)
Methods#
Build a custom mesh from the given points. |
|
Build a regular Monkhorst-Pack k-space and lambda space grid. |
|
Build a k-path in the Brillouin zone. |
|
Generate a hypercube of points in the specified dimensions. |
|
Return the 1D range along a mesh axis/component pair. |
|
Return the k-point mesh from the full grid, with shape |
|
Return the unique parameter-point mesh from the full grid, with shape |
|
Information summary about the mesh. |
|
Return True iff sampling axis axis_idx winds around the BZ for at least one component. |
|
Return True iff sampling axis axis_idx contains endpoint for at least one component. |
|
Return True iff sampling axis axis_idx wraps at least one component. |
|
Declare an axis loops a specified component of the mesh vector. |
|
Declare an axis as not looping a specified component of the mesh vector. |
Attributes#
List of |
|
List of axis names. |
|
List of axis types. |
|
List of Axis objects that wind around the BZ to form a loop. |
|
Boolean array of shape (naxes, dim_total) marking which axes wind around the BZ. |
|
Tuple of length |
|
Dimension of k-space. |
|
Dimension of lambda-space. |
|
Dimension of the full mesh space ( |
|
List of Axis objects that have equal endpoints. |
|
Boolean array of shape (naxes, dim_total) marking which axes have equal endpoints. |
|
True if the mesh is filled (i.e., contains points). |
|
Mesh point array of shape |
|
True if the mesh is a grid (as opposed to a path). |
|
Does the mesh wind around the BZ in all k-directions? |
|
List of |
|
List of indices of the k-axes. |
|
List of indices of k components of the vector. |
|
List of |
|
List of indices of the lambda-axes. |
|
List of indices of lambda components of the vector. |
|
List of Axis objects that wind to form a loop. |
|
Boolean array of shape (naxes, dim_total) marking which axes wind to form a loop. |
|
Total number of axes. |
|
Number of k-axes. |
|
Number of lambda-axes. |
|
For path meshes, the original nodes used to build the path. |
|
Number of mesh points. |
|
Mesh point array of shape |
|
Shape of mesh points |
|
Tuple of axis sizes |
|
Size of each k-axis. |
|
Size of each lambda-axis. |