### Seekpath Installation and Exceptions Source: https://context7.com/materialscloud-org/seekpath/llms.txt Information on how to install the Seekpath library and handle potential exceptions and warnings during its use. ```APIDOC ## Installation and exceptions ### Installation ```python # Install core package (numpy + spglib) # pip install seekpath # Install with BZ visualization support (adds scipy) # pip install seekpath[bz] ``` ### Version Check ```python import seekpath # Version check print(seekpath.__version__) # Example output: '2.2.1' ``` ### Exceptions and Warnings Handle the following exceptions and warnings: - **`seekpath.hpkot.SymmetryDetectionError`**: Raised when `spglib` fails to detect symmetry (e.g., due to a malformed structure). ```python from seekpath.hpkot import SymmetryDetectionError import seekpath cell = [[3.0, 0, 0], [0, 3.0, 0], [0, 0, 3.0]] positions = [[0.0, 0.0, 0.0]] numbers = [1] try: res = seekpath.get_path((cell, positions, numbers)) except SymmetryDetectionError as e: print("Cannot detect symmetry:", e) ``` - **`seekpath.hpkot.EdgeCaseWarning`**: Issued when lattice parameters are on a boundary (e.g., `a ≈ c` in tetragonal systems), which might affect symmetry detection precision. - **`seekpath.SupercellWarning`**: Issued for issues related to supercell calculations. ```python from seekpath.hpkot import EdgeCaseWarning import seekpath import warnings # Tetragonal cell with a == c (edge case: tI1/tI2 boundary) cell_ec = [[3.0,0,0],[0,3.0,0],[0,0,3.0]] with warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") seekpath.get_path((cell_ec, [[0,0,0],[0.5,0.5,0.5]], [26,26])) for w in caught: if issubclass(w.category, EdgeCaseWarning): print("Edge case:", w.message) ``` ``` -------------------------------- ### Install Seekpath and Handle Exceptions Source: https://context7.com/materialscloud-org/seekpath/llms.txt Provides installation commands for the core library and optional BZ visualization package. Demonstrates how to handle SymmetryDetectionError and EdgeCaseWarning. ```python # Install # pip install seekpath # core (numpy + spglib) # pip install seekpath[bz] # + BZ visualization (adds scipy) import seekpath # Version check print(seekpath.__version__) # '2.2.1' # Exceptions and warnings you should handle: from seekpath.hpkot import EdgeCaseWarning, SymmetryDetectionError from seekpath import SupercellWarning import warnings # SymmetryDetectionError — spglib could not detect symmetry (malformed structure) cell = [[3.0, 0, 0], [0, 3.0, 0], [0, 0, 3.0]] positions = [[0.0, 0.0, 0.0]] numbers = [1] try: res = seekpath.get_path((cell, positions, numbers)) except SymmetryDetectionError as e: print("Cannot detect symmetry:", e) # EdgeCaseWarning — lattice parameters on a boundary (e.g. a ≈ c in tI) with warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") # Tetragonal cell with a == c (edge case: tI1/tI2 boundary) cell_ec = [[3.0,0,0],[0,3.0,0],[0,0,3.0]] seekpath.get_path((cell_ec, [[0,0,0],[0.5,0.5,0.5]], [26,26])) for w in caught: if issubclass(w.category, EdgeCaseWarning): print("Edge case:", w.message) ``` -------------------------------- ### Install Twine for PyPi Uploads Source: https://github.com/materialscloud-org/seekpath/wiki/PyPiInstructions Install the twine utility, which is used for uploading Python packages to PyPi. This command only needs to be run once. ```bash pip install twine ``` -------------------------------- ### Get k-point path for a crystal structure Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/maindoc.rst Use this function to obtain the k-point path for a given crystal structure. Requires a structure definition and a boolean indicating time-reversal symmetry. Optional parameters include recipe, threshold, symprec, and angle_tolerance. ```python seekpath.get_path(structure, with_time_reversal, recipe, threshold, symprec, angle_tolerance) ``` -------------------------------- ### Get k-point path in original cell basis for hexagonal graphite Source: https://context7.com/materialscloud-org/seekpath/llms.txt Retrieves the k-point path in the fractional coordinates of the input unit cell's reciprocal lattice without standardizing the cell. Useful for non-standard or rotated cells. Issues a SupercellWarning if the input is a supercell. ```python import warnings import seekpath from seekpath import SupercellWarning # Hexagonal graphite — non-standard orientation (c not along z) # Rotated cell: c axis along x cell = [ [6.708, 0.0, 0.0 ], [0.0, 2.461, 0.0 ], [0.0, -1.2305, 2.131], ] positions = [ [0.0, 0.0, 0.0 ], [0.0, 1.0/3.0, 2.0/3.0 ], [0.5, 0.0, 0.0 ], [0.5, 1.0/3.0, 2.0/3.0 ], ] numbers = [6, 6, 6, 6] # Carbon structure = (cell, positions, numbers) with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") result = seekpath.get_path_orig_cell(structure, symprec=1e-4) for warning in w: if issubclass(warning.category, SupercellWarning): print("Supercell detected:", warning.message) print("Is supercell:", result['is_supercell']) print("Bravais lattice:", result['bravais_lattice']) print("Space group:", result['spacegroup_international']) print("\nK-points in ORIGINAL cell reciprocal basis:") for label, coords in result['point_coords'].items(): print(f" {label:8s}: [{coords[0]:7.4f}, {coords[1]:7.4f}, {coords[2]:7.4f}]") print("\nSuggested path:") path_str = " | ".join(f"{s}-{e}" for s, e in result['path']) print(" ", path_str) ``` -------------------------------- ### Get k-point path for non-standard unit cells Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/maindoc.rst This function provides a k-point path for non-standardized unit cells. It calculates the path based on the symmetrized structure without symmetrizing the input structure itself. Be aware that if symmetry is broken below 'symprec', k points might not be exactly on high-symmetry points. ```python seekpath.get_path_orig_cell ``` -------------------------------- ### Get Implicit Band Path with seekpath.get_path Source: https://context7.com/materialscloud-org/seekpath/llms.txt Obtain high-symmetry k-point coordinates and an ordered band path for a crystal structure. This function standardizes the structure, identifies its Bravais lattice, and re-expresses it as the primitive cell. Use the returned primitive cell for subsequent calculations. Handles time-reversal symmetry by default and supports the 'hpkot' recipe. ```python import seekpath import warnings from seekpath.hpkot import EdgeCaseWarning, SymmetryDetectionError # FCC silicon (cubic face-centered, space group 227) # cell: lattice vectors in Angstroms (rows) # positions: fractional coordinates of atoms # numbers: integer atom types (e.g. atomic number) cell = [ [0.0, 2.715, 2.715], [2.715, 0.0, 2.715], [2.715, 2.715, 0.0 ], ] positions = [[0.0, 0.0, 0.0], [0.25, 0.25, 0.25]] numbers = [14, 14] # Silicon structure = (cell, positions, numbers) try: result = seekpath.get_path( structure, with_time_reversal=True, # assume time-reversal symmetry (default) recipe='hpkot', # only supported recipe threshold=1.0e-7, # edge-case detection threshold symprec=1e-5, # spglib symmetry precision angle_tolerance=-1.0, # spglib angle tolerance (-1 = auto) ) except SymmetryDetectionError as e: print(f"Symmetry detection failed: {e}") raise print("Bravais lattice :", result['bravais_lattice']) # cF print("Extended Bravais :", result['bravais_lattice_extended']) # cF2 print("Space group number :", result['spacegroup_number']) # 227 print("Space group symbol :", result['spacegroup_international']) # Fd-3m print("Has inversion sym :", result['has_inversion_symmetry']) # True print("Augmented path :", result['augmented_path']) # False print("\nSpecial k-point coordinates (fractional, primitive reciprocal cell):") for label, coords in result['point_coords'].items(): print(f" {label:8s}: {coords}") # Example output: # GAMMA : [0.0, 0.0, 0.0] # X : [0.5, 0.0, 0.5] # L : [0.5, 0.5, 0.5] # W : [0.5, 0.25, 0.75] # ... print("\nSuggested band path segments:") for seg in result['path']: print(f" {seg[0]} -> {seg[1]}") # Example output: # GAMMA -> X # X -> U # K -> GAMMA # GAMMA -> L # L -> W # W -> X print("\nPrimitive lattice vectors (Angstroms):") print(result['primitive_lattice']) print("Reciprocal primitive lattice vectors (1/Angstrom):") print(result['reciprocal_primitive_lattice']) # Volume ratio: original cell vs primitive cell print("Volume ratio (orig/prim):", result['volume_original_wrt_prim']) # Warn on edge cases (e.g. tI with a ≈ c) with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") seekpath.get_path(structure) for warning in w: if issubclass(warning.category, EdgeCaseWarning): print("Edge case warning:", warning.message) ``` -------------------------------- ### Upload Package to PyPi Source: https://github.com/materialscloud-org/seekpath/wiki/PyPiInstructions Upload the built package distributions to PyPi. Use 'twine upload dist/*' for the main PyPi repository. ```bash twine upload dist/* ``` -------------------------------- ### Configure PyPi Authentication Source: https://github.com/materialscloud-org/seekpath/wiki/PyPiInstructions Create or update the ~/.pypirc file to configure authentication for PyPi and TestPyPi. This file stores your username and repository URLs. ```ini [distutils] index-servers = pypi pypitest [pypi] username=gio.piz [pypitest] repository=https://testpypi.python.org/pypi username=gio.piz ``` -------------------------------- ### seekpath.hpkot.tools Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/module_guide/index.rst API documentation for the seekpath.hpkot.tools submodule. This submodule contains utility functions for HPKOT. ```APIDOC ## Module: seekpath.hpkot.tools This submodule offers various tools and helper functions for the HPKOT module. ### Members: - (Functions and classes documented by automodule) ``` -------------------------------- ### Build Python Package Source: https://github.com/materialscloud-org/seekpath/wiki/PyPiInstructions Build the source distribution (sdist) and wheel binary distribution for your Python package. Ensure build artifacts are cleaned before building. ```bash python setup.py sdist bdist_wheel --universal ``` -------------------------------- ### Upload Package to TestPyPi Source: https://github.com/materialscloud-org/seekpath/wiki/PyPiInstructions Upload the built package distributions to TestPyPi for testing. This command is used to test the upload process before deploying to the main PyPi. ```bash twine upload --repository-url https://testpypi.python.org/pypi dist/* ``` -------------------------------- ### Generate Dense Explicit k-points in Original Cell Basis for Monoclinic Structure Source: https://context7.com/materialscloud-org/seekpath/llms.txt Combines `get_path_orig_cell` with explicit path generation, returning a dense k-point list in the fractional coordinates of the original input cell. Useful for post-processing band structures from calculations run with a non-standard primitive cell. ```python import seekpath import numpy as np # Monoclinic cell (non-standard setting) cell = [ [5.0, 0.0, 0.0 ], [0.0, 3.0, 0.0 ], [1.5, 0.0, 4.5 ], ] positions = [[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]] numbers = [22, 22] # Titanium structure = (cell, positions, numbers) result = seekpath.get_explicit_k_path_orig_cell( structure, with_time_reversal=True, reference_distance=0.02, symprec=1e-4, ) kpts = result['explicit_kpoints_rel'] labels = result['explicit_kpoints_labels'] lcoord = result['explicit_kpoints_linearcoord'] # Build tick positions and labels for matplotlib ticks, tick_labels = [], [] for i, lbl in enumerate(labels): if lbl: if not ticks or ticks[-1] != lcoord[i]: ticks.append(lcoord[i]) tick_labels.append(lbl if lbl != 'GAMMA' else r'$\\\Gamma$') print(f"K-points in original cell basis: {len(kpts)}") print(f"Bravais lattice: {result['bravais_lattice_extended']}") print(f"Tick positions: {ticks}") print(f"Tick labels : {tick_labels}") # Example: pair with eigenvalues from a DFT calculation # (eigenvalues shape: [n_kpts, n_bands]) # import matplotlib.pyplot as plt # eigenvalues = np.load('eigenvalues.npy') # for band in eigenvalues.T: ``` -------------------------------- ### Generate Explicit k-path for Body-Centered Tetragonal Indium Source: https://context7.com/materialscloud-org/seekpath/llms.txt Generates an explicit k-point path for a body-centered tetragonal structure, including high-symmetry points and segment boundaries. The output can be written to a VASP KPOINTS file. ```python import seekpath a, c = 3.253, 4.946 # Angstroms cell = [ [a, 0, 0], [0, a, 0], [0, 0, c], ] positions = [[0.0, 0.0, 0.0]] numbers = [49] # Indium structure = (cell, positions, numbers) result = seekpath.get_explicit_k_path( structure, with_time_reversal=True, reference_distance=0.025, # ~0.025 Å⁻¹ spacing between k-points recipe='hpkot', symprec=1e-5, ) # Explicit k-point arrays kpts_rel = result['explicit_kpoints_rel'] # shape (N, 3), fractional coords kpts_abs = result['explicit_kpoints_abs'] # shape (N, 3), Cartesian 1/Å labels = result['explicit_kpoints_labels'] # length-N list; '' for non-special lin_coord= result['explicit_kpoints_linearcoord'] # x-axis values for plotting print(f"Total k-points generated: {len(kpts_rel)}") print(f"Bravais lattice: {result['bravais_lattice_extended']}") # e.g. tI1 or tI2 # Print only the labeled (high-symmetry) points print("\nHigh-symmetry points:") for i, lbl in enumerate(labels): if lbl: print(f" [{lin_coord[i]:6.3f}] {lbl:8s} {kpts_rel[i]}") # Segment boundaries for band-structure plot print("\nSegments (start_idx, end_idx):") for seg in result['explicit_segments']: start_lbl = labels[seg[0]] end_lbl = labels[seg[1] - 1] print(f" indices {seg}: {start_lbl} -> {end_lbl}") # Write k-points in VASP KPOINTS format with open('KPOINTS', 'w') as f: f.write("Explicit k-path from SeeK-path\n") f.write(f"{len(kpts_rel)}\n") f.write("Reciprocal\n") for k, lbl in zip(kpts_rel, labels): f.write(f" {k[0]:10.6f} {k[1]:10.6f} {k[2]:10.6f} 1 {lbl}\n") ``` -------------------------------- ### get_path Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/maindoc.rst Obtains and visualizes band paths in the Brillouin zone of crystal structures. This function standardizes the crystal structure and computes suggested band paths for standardized primitive cells. ```APIDOC ## get_path ### Description This function computes the high-symmetry k-points and band path for a given crystal structure. It requires a structure definition and symmetry information. ### Signature `seekpath.get_path(structure, with_time_reversal, recipe='hpkot', threshold=0.01, symprec=1e-05, angle_tolerance=5.0)` ### Parameters - **structure** (tuple) - A tuple in the format `(cell, positions, numbers)`: - `cell` (list of lists of floats): A 3x3 list representing the lattice vectors. - `positions` (list of lists of floats): An Nx3 list of atomic coordinates in scaled coordinates. - `numbers` (list of ints): A list of integers identifying the atoms. - **with_time_reversal** (bool) - A boolean flag indicating if time-reversal symmetry is present. - **recipe** (str, optional) - The recipe to use for path generation. Currently, only 'hpkot' is supported. Defaults to 'hpkot'. - **threshold** (float, optional) - A numerical threshold used for identifying axes in cells. Defaults to 0.01. - **symprec** (float, optional) - Symmetry precision passed to spglib. Defaults to 1e-05. - **angle_tolerance** (float, optional) - Angle tolerance passed to spglib. Defaults to 5.0. ### Returns A dictionary containing k-vector coefficients, the suggested band path, inversion symmetry information, crystallographic primitive lattice, and reciprocal primitive lattice. ``` -------------------------------- ### Compute Brillouin Zone Geometry with seekpath.brillouinzone.BZ Source: https://context7.com/materialscloud-org/seekpath/llms.txt Calculates the faces and triangulated surface of the first Brillouin zone using reciprocal lattice vectors. Supports point-in-BZ queries via Delaunay triangulation. Requires numpy and scipy. ```python from seekpath.brillouinzone.brillouinzone import BZ import numpy as np # FCC reciprocal lattice (BCC in reciprocal space) # Reciprocal vectors of FCC with a=4.05 Å (e.g. aluminum) a = 4.05 b = 2 * np.pi / a b1 = [b, b, -b] b2 = [b, -b, b] b3 = [-b, b, b] bz = BZ(b1, b2, b3) # Triangulated faces (for 3D rendering with e.g. matplotlib Poly3DCollection) print(f"Number of triangles : {len(bz.triangles)}") print(f"Number of flat faces: {len(bz.faces)}") print(f"Triangle vertices shape: {np.array(bz.triangles_vertices).shape}") # Count polygon types of flat faces from collections import Counter face_sides = Counter(len(f) for f in bz.faces) print("Face polygon distribution:", dict(face_sides)) # FCC BZ (truncated octahedron): {4: 6, 6: 8} # Check if a k-point is inside the BZ gamma_point = [0.0, 0.0, 0.0] boundary_point = [b, 0.0, 0.0] outside_point = [2*b, 0.0, 0.0] print(f"Gamma inside BZ : {bz.is_inside_bz(gamma_point)}") # True print(f"Boundary inside : {bz.is_inside_bz(boundary_point)}") # may be True/False print(f"Far point inside: {bz.is_inside_bz(outside_point)}") # False # Visualize with matplotlib try: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.art3d import Poly3DCollection fig = plt.figure(figsize=(6, 6)) ax = fig.add_subplot(111, projection='3d') poly = Poly3DCollection( bz.faces, linewidth=0.5, alpha=0.3, edgecolor='navy', facecolor='lightblue' ) ax.add_collection(poly) ax.set_xlim(-b*1.5, b*1.5) ax.set_ylim(-b*1.5, b*1.5) ax.set_zlim(-b*1.5, b*1.5) ax.set_title('FCC Brillouin Zone (truncated octahedron)') plt.tight_layout() plt.savefig('bz_fcc.png', dpi=150) print("Saved bz_fcc.png") except ImportError: print("matplotlib not available for plotting") # Access raw convex hull and Delaunay objects hull = bz.hull # scipy.spatial.ConvexHull delaunay = bz.delaunay # scipy.spatial.Delaunay b_vecs = bz.b_vectors # (b1, b2, b3) tuple ``` -------------------------------- ### seekpath.get_explicit_k_path Source: https://context7.com/materialscloud-org/seekpath/llms.txt Returns the same information as `get_path` plus a dense, ordered list of k-points along the band path suitable for direct input into DFT codes. The spacing between adjacent k-points is controlled by `reference_distance` (in 1/Å). ```APIDOC ## seekpath.get_explicit_k_path ### Description Returns the same information as `get_path` plus a dense, ordered list of k-points along the band path suitable for direct input into DFT codes. The spacing between adjacent k-points is controlled by `reference_distance` (in 1/Å). ### Method `seekpath.get_explicit_k_path(structure, reference_distance, with_time_reversal=True, recipe='hpkot', threshold=1.0e-7, symprec=1e-5, angle_tolerance=-1.0)` ### Parameters - **structure** (tuple): A spglib-compatible `(cell, positions, numbers)` tuple representing the crystal structure. - **cell** (list of lists): Lattice vectors in Angstroms (rows). - **positions** (list of lists): Fractional coordinates of atoms. - **numbers** (list of int): Integer atom types (e.g., atomic number). - **reference_distance** (float): The reference distance in 1/Å, controlling the spacing between k-points. - **with_time_reversal** (bool, optional): Assume time-reversal symmetry. Defaults to `True`. - **recipe** (str, optional): The recipe to use. Currently only `'hpkot'` is supported. - **threshold** (float, optional): Edge-case detection threshold. Defaults to `1.0e-7`. - **symprec** (float, optional): spglib symmetry precision. Defaults to `1e-5`. - **angle_tolerance** (float, optional): spglib angle tolerance. Defaults to `-1.0` (auto). ### Response Includes all fields from `seekpath.get_path` plus: - **explicit_k_path** (list of lists): A dense, ordered list of k-points along the band path, suitable for DFT input. ### Request Example ```python import seekpath import numpy as np # Example structure (e.g., FCC silicon) cell = [ [0.0, 2.715, 2.715], [2.715, 0.0, 2.715], [2.715, 2.715, 0.0 ], ] positions = [[0.0, 0.0, 0.0], [0.25, 0.25, 0.25]] numbers = [14, 14] # Silicon structure = (cell, positions, numbers) # Get explicit k-point path with a reference distance of 0.1 1/Angstrom result = seekpath.get_explicit_k_path(structure, reference_distance=0.1) print("Explicit k-point path:") for kpt in result['explicit_k_path']: print(f" {kpt}") # You can also access other fields like in get_path print("\nBravais lattice:", result['bravais_lattice']) ``` ### Response Example ```json { "bravais_lattice": "cF", "bravais_lattice_extended": "cF2", "spacegroup_number": 227, "spacegroup_international": "Fd-3m", "has_inversion_symmetry": true, "augmented_path": false, "point_coords": { "GAMMA": [0.0, 0.0, 0.0], "X": [0.5, 0.0, 0.5], "L": [0.5, 0.5, 0.5], "W": [0.5, 0.25, 0.75] }, "path": [ ["GAMMA", "X"], ["X", "U"], ["K", "GAMMA"], ["GAMMA", "L"], ["L", "W"], ["W", "X"] ], "primitive_lattice": [ [0.0, 2.715, 2.715], [2.715, 0.0, 2.715], [2.715, 2.715, 0.0 ] ], "reciprocal_primitive_lattice": [ [0.0, 0.2315, 0.2315], [0.2315, 0.0, 0.2315], [0.2315, 0.2315, 0.0 ] ], "volume_original_wrt_prim": 1.0, "explicit_k_path": [ [0.0, 0.0, 0.0], [0.025, 0.0, 0.075], [0.05, 0.0, 0.1], // ... more k-points [0.5, 0.5, 0.5] ] } ``` ``` -------------------------------- ### seekpath.getpaths Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/module_guide/index.rst API documentation for the seekpath.getpaths module. This module contains functions for retrieving paths. ```APIDOC ## Module: seekpath.getpaths This module provides functions for pathfinding and related operations. ### Members: - (Functions and classes documented by automodule) ``` -------------------------------- ### Seekpath Brillouin Zone (BZ) Class Source: https://context7.com/materialscloud-org/seekpath/llms.txt The BZ class computes the faces and triangulated surface of the first Brillouin zone using a Voronoi construction. It also supports point-in-BZ queries via Delaunay triangulation. ```APIDOC ## `seekpath.brillouinzone.BZ` — Brillouin zone geometry for 3-D visualization Computes the faces and triangulated surface of the first Brillouin zone (Wigner–Seitz cell in reciprocal space) from the three reciprocal lattice vectors using a Voronoi construction. Supports point-in-BZ queries via Delaunay triangulation. ### Usage ```python from seekpath.brillouinzone.brillouinzone import BZ import numpy as np # FCC reciprocal lattice (BCC in reciprocal space) # Reciprocal vectors of FCC with a=4.05 Å (e.g. aluminum) a = 4.05 b = 2 * np.pi / a b1 = [b, b, -b] b2 = [b, -b, b] b3 = [-b, b, b] bz = BZ(b1, b2, b3) # Triangulated faces (for 3D rendering with e.g. matplotlib Poly3DCollection) print(f"Number of triangles : {len(bz.triangles)}") print(f"Number of flat faces: {len(bz.faces)}") print(f"Triangle vertices shape: {np.array(bz.triangles_vertices).shape}") # Count polygon types of flat faces from collections import Counter face_sides = Counter(len(f) for f in bz.faces) print("Face polygon distribution:", dict(face_sides)) # FCC BZ (truncated octahedron): {4: 6, 6: 8} # Check if a k-point is inside the BZ gamma_point = [0.0, 0.0, 0.0] boundary_point = [b, 0.0, 0.0] outside_point = [2*b, 0.0, 0.0] print(f"Gamma inside BZ : {bz.is_inside_bz(gamma_point)}") # True print(f"Boundary inside : {bz.is_inside_bz(boundary_point)}") # may be True/False print(f"Far point inside: {bz.is_inside_bz(outside_point)}") # False # Access raw convex hull and Delaunay objects hull = bz.hull # scipy.spatial.ConvexHull delaunay = bz.delaunay # scipy.spatial.Delaunay b_vecs = bz.b_vectors # (b1, b2, b3) tuple ``` ### Attributes - **triangles**: List of triangles forming the BZ surface. - **faces**: List of polygons representing the flat faces of the BZ. - **triangles_vertices**: Vertices of the triangles. - **hull**: The `scipy.spatial.ConvexHull` object. - **delaunay**: The `scipy.spatial.Delaunay` object. - **b_vectors**: A tuple containing the three reciprocal lattice vectors (b1, b2, b3). ``` -------------------------------- ### seekpath.SupercellWarning Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/module_guide/index.rst Documentation for the SupercellWarning class in the seekpath module. ```APIDOC ## Class: seekpath.SupercellWarning This is a custom warning class used within the seekpath library, likely to indicate issues related to supercells. ### Inheritance: - Warning ### Usage: (Details on when and how this warning is raised would typically be found in the methods that raise it.) ``` -------------------------------- ### seekpath.hpkot.spg_mapping Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/module_guide/index.rst API documentation for the seekpath.hpkot.spg_mapping submodule. This submodule likely handles space group mappings within HPKOT. ```APIDOC ## Module: seekpath.hpkot.spg_mapping This submodule provides utilities for mapping space groups within the HPKOT context. ### Members: - (Functions and classes documented by automodule) ``` -------------------------------- ### seekpath.get_path Source: https://context7.com/materialscloud-org/seekpath/llms.txt Returns the high-symmetry k-point coordinates and ordered band path for a crystal structure after standardizing and identifying its Bravais lattice. The structure is re-expressed as the crystallographic primitive cell; all subsequent calculations should use the primitive cell returned in the output, not the original input cell. ```APIDOC ## seekpath.get_path ### Description Returns the high-symmetry k-point coordinates and ordered band path for a crystal structure after standardizing and identifying its Bravais lattice. The structure is re-expressed as the crystallographic primitive cell; all subsequent calculations should use the primitive cell returned in the output, not the original input cell. ### Method `seekpath.get_path(structure, with_time_reversal=True, recipe='hpkot', threshold=1.0e-7, symprec=1e-5, angle_tolerance=-1.0)` ### Parameters - **structure** (tuple): A spglib-compatible `(cell, positions, numbers)` tuple representing the crystal structure. - **cell** (list of lists): Lattice vectors in Angstroms (rows). - **positions** (list of lists): Fractional coordinates of atoms. - **numbers** (list of int): Integer atom types (e.g., atomic number). - **with_time_reversal** (bool, optional): Assume time-reversal symmetry. Defaults to `True`. - **recipe** (str, optional): The recipe to use. Currently only `'hpkot'` is supported. - **threshold** (float, optional): Edge-case detection threshold. Defaults to `1.0e-7`. - **symprec** (float, optional): spglib symmetry precision. Defaults to `1e-5`. - **angle_tolerance** (float, optional): spglib angle tolerance. Defaults to `-1.0` (auto). ### Response - **bravais_lattice** (str): The Bravais lattice symbol (e.g., 'cF'). - **bravais_lattice_extended** (str): The extended Bravais lattice symbol (e.g., 'cF2'). - **spacegroup_number** (int): The space group number. - **spacegroup_international** (str): The international space group symbol (e.g., 'Fd-3m'). - **has_inversion_symmetry** (bool): Indicates if the structure has inversion symmetry. - **augmented_path** (bool): Indicates if the path was augmented. - **point_coords** (dict): A dictionary mapping special k-point labels to their fractional coordinates in the primitive reciprocal cell. - **path** (list of lists): A list of segments representing the suggested band path, where each segment is a list of two k-point labels. - **primitive_lattice** (list of lists): The primitive lattice vectors in Angstroms. - **reciprocal_primitive_lattice** (list of lists): The reciprocal primitive lattice vectors in 1/Angstrom. - **volume_original_wrt_prim** (float): The ratio of the original cell volume to the primitive cell volume. ### Request Example ```python import seekpath import warnings from seekpath.hpkot import EdgeCaseWarning, SymmetryDetectionError cell = [ [0.0, 2.715, 2.715], [2.715, 0.0, 2.715], [2.715, 2.715, 0.0 ], ] positions = [[0.0, 0.0, 0.0], [0.25, 0.25, 0.25]] numbers = [14, 14] # Silicon structure = (cell, positions, numbers) try: result = seekpath.get_path( structure, with_time_reversal=True, recipe='hpkot', threshold=1.0e-7, symprec=1e-5, angle_tolerance=-1.0, ) except SymmetryDetectionError as e: print(f"Symmetry detection failed: {e}") raise print("Bravais lattice :", result['bravais_lattice']) print("Extended Bravais :", result['bravais_lattice_extended']) print("Space group number :", result['spacegroup_number']) print("Space group symbol :", result['spacegroup_international']) print("Has inversion sym :", result['has_inversion_symmetry']) print("Augmented path :", result['augmented_path']) print("\nSpecial k-point coordinates (fractional, primitive reciprocal cell):") for label, coords in result['point_coords'].items(): print(f" {label:8s}: {coords}") print("\nSuggested band path segments:") for seg in result['path']: print(f" {seg[0]} -> {seg[1]}") print("\nPrimitive lattice vectors (Angstroms):") print(result['primitive_lattice']) print("Reciprocal primitive lattice vectors (1/Angstrom):") print(result['reciprocal_primitive_lattice']) print("Volume ratio (orig/prim):", result['volume_original_wrt_prim']) with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") seekpath.get_path(structure) for warning in w: if issubclass(warning.category, EdgeCaseWarning): print("Edge case warning:", warning.message) ``` ### Response Example ```json { "bravais_lattice": "cF", "bravais_lattice_extended": "cF2", "spacegroup_number": 227, "spacegroup_international": "Fd-3m", "has_inversion_symmetry": true, "augmented_path": false, "point_coords": { "GAMMA": [0.0, 0.0, 0.0], "X": [0.5, 0.0, 0.5], "L": [0.5, 0.5, 0.5], "W": [0.5, 0.25, 0.75] }, "path": [ ["GAMMA", "X"], ["X", "U"], ["K", "GAMMA"], ["GAMMA", "L"], ["L", "W"], ["W", "X"] ], "primitive_lattice": [ [0.0, 2.715, 2.715], [2.715, 0.0, 2.715], [2.715, 2.715, 0.0 ] ], "reciprocal_primitive_lattice": [ [0.0, 0.2315, 0.2315], [0.2315, 0.0, 0.2315], [0.2315, 0.2315, 0.0 ] ], "volume_original_wrt_prim": 1.0 } ``` ``` -------------------------------- ### seekpath.hpkot Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/module_guide/index.rst API documentation for the seekpath.hpkot module. This module is related to the HPKOT functionality. ```APIDOC ## Module: seekpath.hpkot This module contains functionalities related to the HPKOT algorithm or data structure. ### Members: - (Functions and classes documented by automodule) ``` -------------------------------- ### Handle SupercellWarning in Seekpath Source: https://context7.com/materialscloud-org/seekpath/llms.txt This snippet demonstrates how to catch and print SupercellWarning messages when using seekpath.get_path_orig_cell with a supercell input. ```python with warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") # 2×1×1 supercell of BCC iron cell_sc = [[5.74,0,0],[0,2.87,0],[0,0,2.87]] seekpath.get_path_orig_cell((cell_sc, [[0,0,0],[0.5,0,0]], [26,26])) for w in caught: if issubclass(w.category, SupercellWarning): print("Supercell warning:", w.message) ``` -------------------------------- ### get_path_orig_cell Source: https://github.com/materialscloud-org/seekpath/blob/main/docs/source/maindoc.rst Generates a k-point path for a non-standardized unit cell. This function is useful when working with cells that have not been symmetrized or standardized. ```APIDOC ## get_path_orig_cell ### Description This function computes the k-point path for a non-standard primitive unit cell. If the input cell is a supercell, it returns the k path of the associated primitive cell in the basis of the supercell reciprocal lattice. ### Usage `seekpath.get_path_orig_cell()` ### Notes - Unlike `get_path`, this function does not symmetrize the input structure itself. If the symmetry of the input structure is slightly broken, the output k points may not be exactly on high-symmetry points. - The returned k path is equivalent to the k path for the standard cell if the input is a non-standard primitive unit cell. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.