tightbinder.crystal.Crystal#
- class Crystal(bravais_lattice=None, motif=None)[source]#
Bases:
objectImplementation of Crystal class. Defaults to square lattice if no input is given.
- Parameters:
Methods
Method to add one atom from a numbered species into a specific position.
Method to add a list of atoms of specified species at some positions.
Routine to compute a mesh of the first Brillouin zone using the Monkhorst-Pack algorithm.
Method to compute the area of the unit cell.
Method to compute the geometric center of the crystal from the positions of the atoms of the motif.
Determines the crystallographic group associated to the material from the configuration file.
Routine to compute high symmetry points depending on the dimension of the system.
Routine to generate a path in reciprocal space along the high symmetry points (HSPs) indicated.
Deprecated in favour of identify_motif_edges.
Method to obtain the indices of the outermost atoms of the motif.
Method to visualize the crystalline structure (Bravais lattice + motif) in two dimensions.
Method to visualize the crystalline structure (Bravais lattice + motif).
Routine to compute the reciprocal lattice basis vectors from the Bravais lattice basis.
Method to remove the atom at the specified index from the motif.
Method to remove the atoms specified in a list with all their indices.
Routine to initialize or update the intrinsic attributes of the Crystal class whenever the Bravais lattice is changed.
Method to render a 3d visualization of the crystal using the self.vpython library.
Attributes
bravais_latticemotifndim- add_atom(position, species=0)[source]#
Method to add one atom from a numbered species into a specific position.
- add_atoms(atoms, species=None)[source]#
Method to add a list of atoms of specified species at some positions. Built on top of method add_atom.
- brillouin_zone_mesh(mesh)[source]#
Routine to compute a mesh of the first Brillouin zone using the Monkhorst-Pack algorithm.
- Parameters:
mesh (
list) – List with the number of kpoints along each axis.- Return type:
ndarray- Returns:
Array with all kpoints, nk x 3
- compute_unit_cell_area()[source]#
Method to compute the area of the unit cell. TODO: Adapt for 1D and 3D
- Return type:
- Returns:
Value of unit cell area.
- crystal_center()[source]#
Method to compute the geometric center of the crystal from the positions of the atoms of the motif. Calculated as the average of all atomic positions.
- Return type:
ndarray- Returns:
Numpy array with the cartesian coordinates of the center
- crystallographic_group()[source]#
Determines the crystallographic group associated to the material from the configuration file. NOTE: Only the group associated to the Bravais lattice, reduced symmetry due to presence of motif is not taken into account. Its purpose is to provide a path in k-space to plot the band structure. Workflow is the following: First determine length and angles between basis vectors. Then we separate by dimensionality: first we check angles, and then length to determine the crystal group.
- Return type:
- determine_high_symmetry_points()[source]#
Routine to compute high symmetry points depending on the dimension of the system. These symmetry points will be used to plot the band structure along the main reciprocal paths of the system (irreducible BZ). Returns a dictionary with pairs {letter denoting high symmetry point: its coordinates}
- Return type:
- high_symmetry_path(nk, points)[source]#
Routine to generate a path in reciprocal space along the high symmetry points (HSPs) indicated. The HSPs must be within those corresponding to the associated symmetry group, otherwise the method will throw an error.
- identify_convex_hull(loop=6)[source]#
Deprecated in favour of identify_motif_edges. Method to obtain the atoms that correspond to the edges of the system. This method uses directly the ConvexHull method from Scipy to identify the outmost points of the motif. Compute the ConvexHull three times, each time removing the points detected in the previous iteration.
NB: If given 3d points, they must not be coplanar for the algorithm to work. If they are, then the points must be given as 2d
- Parameters:
loop (
int) – Number of times the ConvexHull is applied, to increase number of points in the edge.- Return type:
ndarray- Returns:
Indices of atoms belonging to edges of motif.
- identify_motif_edges(alpha=0.4, ndim=2)[source]#
Method to obtain the indices of the outermost atoms of the motif. Note that this method returns exclusively the outermost atoms, independently of the boundary conditions. To take into account boundary conditions, one should call identify_boundary() from System. NB: Currently works only in 2D
- Parameters:
alpha (
float) – This parameters tunes the shape of the boundary. For alpha=0, the boundary is a convex hull; as alpha increases the boundary becomes more concave. Default value is 0.4ndim (
int) – Dimension of the boundary. If the system lies on a plane, the boundary is two-dimensional, so ndim = 2 (default value).
- Return type:
ndarray- Returns:
Indices of atoms in the boundary.
- Raises:
AssertionError – Crystal dimension different from two raises error.
ValueError – Crystal motif must have at least three atoms. Raised by Delaunay class.
- plot_2d_crystal(ax=None, fontsize=10, size=10)[source]#
Method to visualize the crystalline structure (Bravais lattice + motif) in two dimensions. If the crystal is 3D, it will plot only the x, y coordinates.
- plot_crystal(cell_number=1, crystal_name='')[source]#
Method to visualize the crystalline structure (Bravais lattice + motif).
- reciprocal_lattice()[source]#
Routine to compute the reciprocal lattice basis vectors from the Bravais lattice basis. The algorithm is based on the fact that a_idot b_j=2PIdelta_ij, which can be written as a linear system of equations to solve for b_j. Resulting vectors have 3 components independently of the dimension of the vector space they span.
- Return type:
- remove_atom(index)[source]#
Method to remove the atom at the specified index from the motif. Note that this method does not remove existing bonds corresponding to the removed atom.
- remove_atoms(indices)[source]#
Method to remove the atoms specified in a list with all their indices. Built upon the method remove_atom.