vasppy.kpoints module¶
- class AutoKPoints(title: str, subdivisions: ndarray, grid_centering: str | None = 'G', shift: ndarray | None = None)[source]¶
Bases:
object
Class for automatic k-point generation data in KPOINTS.
Initialise an AutoKPoints object.
- Parameters:
title (str) – The first line of the file, treated as a comment by VASP.
subdivisions – (np.ndarray(int, int, int)): Numbers of subdivisions along each reciprocal lattice vector.
grid_centering (str, optional) – Specify gamma-centered (G) or the original Monkhorst-Pack scheme (MP). Default is ‘G’.
shift – (np.ndarray(float, float, float), optional): Optional shift of the mesh (s_1, s_2, s_3). Default is ( [ 0., 0., 0. ] ).
- Returns:
None
- Raises:
ValueError – If an unrecognised grid-centering option is passed in.
- get_convergence_testing_kspacing(reciprocal_lattice_vectors: ndarray, kspacing_range: tuple[float, float] = (0.1, 0.8), step: float = 0.02) tuple[float, ...] [source]¶
Generate a range of minimum allowed distances between k-points (KSPACING) for convergence testing. This function ensures that no two values of KSPACING are generated that correspond to the same k-point mesh.
- Parameters:
reciprocal_lattice_vectors (np.ndarray) – The reciprocal lattice vectors. These can be retrieved from ASE as atoms.cell.reciprocal() or from Pymatgen as
structure.lattice.reciprocal_lattice_crystallographic.matrix. –
kspacing_range (tuple[float, float]) – The minimum and maximum KSPACING values. Defaults to (0.1, 0.8).
step (float) – The interval between KSPACING values to be tested. Defaults to 0.02.
- Returns:
A range of KSPACING values which all correspond to distinct k-point grids.
- Return type:
tuple[float, …]
- get_subdivisions_from_kspacing(kspacing: float, reciprocal_lattice_vectors: ndarray) tuple[int, ...] [source]¶
Calculate subdivisions along reciprocal lattice vectors from the miniumum allowed distance between k-points (KSPACING).
- Parameters:
kspacing (float) – The minimum allowed distance between k-points.
reciprocal_lattice_vectors (np.ndarray) – The reciprocal lattice vectors. These can be retrieved from ASE as atoms.cell.reciprocal() or from Pymatgen as
structure.lattice.reciprocal_lattice_crystallographic.matrix. –
- Returns:
The subdivisions along each reciprocal lattice vector.
- Return type:
tuple[int, …]