htesp.kpath¶
Module to handle kpath for high-symmetry lines
Functions
|
Keep the first |
|
Function to write k-point mesh along the high-symmetry path of the Brillouin zone (BZ). |
|
Main function for executing different modes of k-point generation. |
|
Function to create high symmetry points for line mode using pymatgen. |
|
Split an ASE band-path string into whole high-symmetry labels. |
|
Print k-point mesh within high-symmetry points and between them. |
- htesp.kpath.path_tokens(path)[source]¶
Split an ASE band-path string into whole high-symmetry labels.
'GXWK|UX'->['G', 'X', 'W', 'K', '|', 'U', 'X']. Separators are kept so that''.join(tokens)reproduces the original path string.- Parameters:
path (str) – Band path as produced by
cell.bandpath().path.- Returns:
Labels and separators, in order.
- Return type:
list of str
- htesp.kpath.cut_path(path, kcutoff)[source]¶
Keep the first
kcutoffhigh-symmetry labels ofpath.kcutoff <= 0returns the full path. Separators never count as labels and a trailing separator is dropped.- Parameters:
path (str) – Band path as produced by
cell.bandpath().path.kcutoff (int) – Number of labels to keep.
- Returns:
The truncated path string.
- Return type:
str
Example
>>> cut_path("G1XWK|UX", 3) 'G1XW'
- htesp.kpath.kpath(filename, npoint, kcutoff, plot_bz=False, bz_file='BZ.pdf')[source]¶
Function to write k-point mesh along the high-symmetry path of the Brillouin zone (BZ).
Parameters:
filename (str): Input file to read, which contains the structure or VASP ‘POSCAR’ file.
npoint (int): Size of k-point mesh.
kcutoff (int): Cutoff to use for k-point path in ASE. ‘0’ means full Brillouin zone, ‘n’ > 0 keeps only the first n high-symmetry labels of the BZ path.
plot_bz (bool): Write the Brillouin-zone sketch to bz_file. Default: False (see FIX(12); only printk turns it on).
bz_file (str): Output file for the BZ sketch. Default: ‘BZ.pdf’.
Returns:
kpoints (numpy.ndarray): K-mesh of size (npoint, 3).
sympoint (list): K-point in linear axis ready for plotting after processing.
symname (list): Naming for sympoint.
kpt (list): K-point in linear axis without processing.
spt (list): K-point in linear axis without processing at high-symmetry points.
sym (list): Naming for spt.
Example:
>>> kpoints, sympoint, symname, kpt, sym, spt = kpath("POSCAR", 100, 0)
- htesp.kpath.printk(out_dir='scf_dir', plot_bz=True)[source]¶
Print k-point mesh within high-symmetry points and between them.
This function generates and prints k-points for quantum mechanics calculations, focusing on the Brillouin zone (BZ) and high-symmetry points.
Parameters:
out_dir (str): Directory the two .dat files are written to. Default: ‘scf_dir’. FIX(13): this used to be hard-coded, so a caller could not direct the output at a per-material directory.
plot_bz (bool): Write ‘BZ.pdf’ next to the output. Default: True, because the workflow harvests BZ.pdf from this call (see FIX(12)).
Returns:
None
Usage:
The function expects command-line arguments in the following order:
sys.argv[2]: Filename containing the structure or VASP ‘POSCAR’ file.
sys.argv[3]: Number of k-points.
sys.argv[4]: Cutoff for the k-point path in ASE. ‘0’ for the full Brillouin zone, ‘n’ to keep only the first n labels.
sys.argv[5]: Weight of the k-point.
sys.argv[6]: Output directory (optional, defaults to ‘scf_dir’).
Output:
The function generates two files in
out_dir:‘kpathlines.dat’: Contains the k-point mesh within high-symmetry points and between them.
‘kspecial-points.dat’: Lists the high-symmetry points.
- htesp.kpath.make_line_kpt(filename='KPOINTS')[source]¶
Function to create high symmetry points for line mode using pymatgen.
This function generates high symmetry points for line mode using the provided structure file (“POSCAR”). The number of k-points for the line mode is specified by the second command-line argument.
Parameters: None
Returns: None
Usage: The function expects a command-line argument specifying the number of k-points for line mode.
Output: The function creates a KPOINTS file containing high symmetry points for line mode.