momentGW.pbc.kpts

k-points helper utilities.

Module Contents

momentGW.pbc.kpts.allow_single_kpt(output_is_kpts=False)

Decorate functions to allow kpts arguments to be passed as a single k-point.

Parameters:

output_is_kpts (bool, optional) – Whether the output of the function is a k-point. Default value is False.

class momentGW.pbc.kpts.KPoints(cell, kpts, tol=1e-06, wrap_around=True)

Helper class for k-points.

Parameters:
  • cell (pyscf.pbc.gto.Cell) – Unit cell.

  • kpts (numpy.ndarray) – K-points.

  • tol (float, optional) – Threshold for determining if two k-points are equal. Default value is 1e-8.

  • wrap_around (bool, optional) – Whether to wrap k-points around the first Brillouin zone. Default value is True.

property tol_decimals

Convert the tolerance into a number of decimal places.

Returns:

tol_decimals – Number of decimal places.

Return type:

int

property kmesh

Guess the k-mesh.

Returns:

kmesh – Size of the k-mesh in each direction.

Return type:

list

property T

Get the transpose of the k-points.

member(kpt)

Find the index of the k-point in the k-point list.

Parameters:

kpt (numpy.ndarray) – The k-point.

Returns:

index – Index of the k-point.

Return type:

int

index(kpt)

Alias for member.

Parameters:

kpt (numpy.ndarray) – The k-point.

Returns:

index – Index of the k-point.

Return type:

int

get_scaled_kpts(kpts)

Convert absolute k-points to scaled k-points for the current cell.

Parameters:

kpts (numpy.ndarray) – Absolute k-points.

Returns:

scaled_kpts – Scaled k-points.

Return type:

numpy.ndarray

get_abs_kpts(kpts)

Convert scaled k-points to absolute k-points for the current cell.

Parameters:

kpts (numpy.ndarray) – Scaled k-points.

Returns:

abs_kpts – Absolute k-points.

Return type:

numpy.ndarray

wrap_around(kpts, window=(-0.5, 0.5))

Handle the wrapping of k-points into the first Brillouin zone.

Parameters:
  • kpts (numpy.ndarray) – Absolute k-points.

  • window (tuple, optional) – Window within which to contain scaled k-points. Default value is (-0.5, 0.5).

Returns:

wrapped_kpts – Wrapped k-points.

Return type:

numpy.ndarray

hash_kpts(kpts)

Convert k-points to a unique, hashable representation.

Parameters:

kpts (numpy.ndarray) – Absolute k-points.

Returns:

hash_kpts – Hashable representation of k-points.

Return type:

tuple

conserve(ki, kj, kk)

Get the index of the k-point that conserves momentum.

Parameters:
  • ki (int) – Indices of the k-points.

  • kj (int) – Indices of the k-points.

  • kk (int) – Indices of the k-points.

Returns:

kconserv – Index of the k-point that conserves momentum.

Return type:

int

loop(depth, mpi=False)

Iterate over all combinations of k-points up to a given depth.

Parameters:
  • depth (int) – Depth of the loop.

  • mpi (bool, optional) – Whether to split the loop over MPI processes. Default value is False.

Yields:

kpts (tuple) – Tuple of k-point indices.

loop_size(depth=1)

Return the size of loop. Without MPI, this is equivalent to len(self)**depth.

Parameters:

depth (int, optional) – Depth of the loop. Default value is 1.

Returns:

size – Size of the loop.

Return type:

int

is_zero(kpts)

Check if the k-point is zero.

Parameters:

kpts (numpy.ndarray) – Absolute k-points.

Returns:

is_zero – Whether the k-point is zero.

Return type:

bool

translation_vectors()

Build translation vectors to construct supercell of which the gamma point is identical to the k-point mesh of the primitive cell.

Returns:

r_vec_abs – Translation vectors.

Return type:

numpy.ndarray

interpolate(other, fk)

Interpolate a function f from the current grid of k-points to those of other. Input must be in a localised basis, i.e. AOs.

Parameters:
  • other (KPoints) – The k-points to interpolate to.

  • fk (numpy.ndarray) – The function to interpolate, expressed on the current k-point grid. Must be a matrix-valued array expressed in k-space, in a localised basis.

Returns:

f – The interpolated function, expressed on the new k-point grid.

Return type:

numpy.ndarray