Scattering Kernels#

class elecboltz.kernel.CylindricalKernel(params)#

Bases: ScatteringKernel

Scattering kernel based on real cylindrical harmonics \(\cos(m\phi)\) and \(\sin(m\phi)\).

Parameters:

params (dict or np.ndarray) – A dictionary mapping (m, m') to the non-zero coefficients of the scattering kernel. For the cosine basis functions, m is non-negative, while for the sine basis functions, m is negative. Note that since the scattering kernel should be Hermitian, (real-symmetric in this case), you must only specify one coefficient for each pair of indices. The kernel will automatically fill in the other coefficient.

build_coeffs(params)#

Build the coefficients of the scattering kernel from the given parameters and set the coeffs attribute.

Parameters:

params (dict) – A dictionary of parameters needed to construct the scattering kernel.

Returns:

The coefficients of the scattering kernel.

Return type:

np.ndarray

eval_basis(index, kx, ky, kz)#

Evaluate the basis function with the given index at the given wavevector.

Parameters:
  • index (int) – The index of the basis function to evaluate.

  • kx (float) – The components of the wavevector with units of 1/angstrom.

  • ky (float) – The components of the wavevector with units of 1/angstrom.

  • kz (float) – The components of the wavevector with units of 1/angstrom.

Returns:

The values of the basis functions at the given wavevector.

Return type:

np.ndarray

class elecboltz.kernel.LegendreKernel(params)#

Bases: ScatteringKernel

Scattering kernel based on Legendre polynomials \(P_l(\cos \theta)\).

To preserve normalization, this kernel actually uses the spherical harmonics \(Y^{m=0}_l(\theta, \phi)\), which are proportional to the Legendre polynomials \(P_l(\cos \theta)\).

Parameters:

params (dict) – Either a dictionary mapping (l, l') to the non-zero coefficients of the scattering kernel, or a 2D array of coefficients where the entry at (l, l’) corresponds to the coefficient for the basis functions with indices l and l'. Note that since the scattering kernel should be Hermitian (real-symmetric in this case), if you use a dictionary, you must only specify one coefficient for each pair of indices. The kernel will automatically fill in the other coefficient.

build_coeffs(params)#

Build the coefficients of the scattering kernel from the given parameters and set the coeffs attribute.

Parameters:

params (dict) – A dictionary of parameters needed to construct the scattering kernel.

Returns:

The coefficients of the scattering kernel.

Return type:

np.ndarray

eval_basis(index, kx, ky, kz)#

Evaluate the basis function with the given index at the given wavevector.

Parameters:
  • index (int) – The index of the basis function to evaluate.

  • kx (float) – The components of the wavevector with units of 1/angstrom.

  • ky (float) – The components of the wavevector with units of 1/angstrom.

  • kz (float) – The components of the wavevector with units of 1/angstrom.

Returns:

The values of the basis functions at the given wavevector.

Return type:

np.ndarray

class elecboltz.kernel.SphericalKernel(params)#

Bases: ScatteringKernel

Scattering kernel based on real-valued spherical harmonics \(\sqrt{2} \Re Y^{|m|}_l(\theta, \phi)\) and \(\sqrt{2} \Im Y^{|m|}_l(\theta, \phi)\). The first, cosine-like, basis function corresponds to positive m, while the second, sine-like, basis function corresponds to negative m.

Parameters:

params (dict) – A dictionary mapping tuples of tuples of integers, ((l, m), (l', m')), to the corresponding coefficients of the scattering kernel. Note that since the scattering kernel should be Hermitian (real-symmetric in this case), you must only specify one coefficient for each pair of indices. The kernel will automatically fill in the other coefficient.

build_coeffs(params)#

Build the coefficients of the scattering kernel from the given parameters and set the coeffs attribute.

Parameters:

params (dict) – A dictionary of parameters needed to construct the scattering kernel.

Returns:

The coefficients of the scattering kernel.

Return type:

np.ndarray

eval_basis(index, kx, ky, kz)#

Evaluate the basis function with the given index at the given wavevector.

Parameters:
  • index (int) – The index of the basis function to evaluate.

  • kx (float) – The components of the wavevector with units of 1/angstrom.

  • ky (float) – The components of the wavevector with units of 1/angstrom.

  • kz (float) – The components of the wavevector with units of 1/angstrom.

Returns:

The values of the basis functions at the given wavevector.

Return type:

np.ndarray

class elecboltz.kernel.SumKernel(kernels)#

Bases: ScatteringKernel

Scattering kernel that is a sum of other kernels.

The resulting basis is a direct sum of each basis for the individual kernels. This means that the vector of the basis functions is just a concatenation of the basis functions for each kernel, and the coefficient matrix would become a block-diagonal matrix with the coefficient matrices of the individual kernels as blocks.

Keep in mind that this creates many unused entries in the scattering matrix. So, always try finding a more general basis before simply adding multiple kernels with this method.

Parameters:

kernels (list of ScatteringKernel) – The kernels to sum together.

build_coeffs(kernels)#

Build the coefficients of the scattering kernel from the given parameters and set the coeffs attribute.

Parameters:

params (dict) – A dictionary of parameters needed to construct the scattering kernel.

Returns:

The coefficients of the scattering kernel.

Return type:

np.ndarray

eval_basis(index, kx, ky, kz)#

Evaluate the basis function with the given index at the given wavevector.

Parameters:
  • index (int) – The index of the basis function to evaluate.

  • kx (float) – The components of the wavevector with units of 1/angstrom.

  • ky (float) – The components of the wavevector with units of 1/angstrom.

  • kz (float) – The components of the wavevector with units of 1/angstrom.

Returns:

The values of the basis functions at the given wavevector.

Return type:

np.ndarray

elecboltz.kernel.build_kernel(kernel, kernel_params)#

Build a scattering kernel based on the given kernel type and parameters.

Parameters:
  • kernel (str or list of str) –

    The type(s) of kernel(s) to build. Supported kernels are:

    • 'spherical': Spherical Harmonics. The parameters are
      indicated by a pair of tuples of integers,
      ((l, m), (l', m')), mapping to the corresponding
      coefficients of the (real-valued) spherical harmonics
      \(P_l^m(\theta, \phi)\)
      and \(P_{l'}^{m'}(\theta, \phi)\).
    • 'cylindrical': Cylindrical Harmonics, which are just
      cosines and sines of the angle in the x-y plane. The
      parameter dictionary keys can be expressed in two ways;
      first, as a pair of integers (m, m'), where
      non-negative m corresponds to cosines and negative m
      corresponds to sines; second, as a string of the form
      '[cos/sin][m][cos/sin][m'], so for example (-2, 3)
      in the previous scheme would correspond to 'sin2cos3'.
      You can set single sines and cosines either by setting the
      other m to zero or by simply omitting it, so for
      example 'cos3'. You can set the constant term by having
      both m and m’ be zero, or just use '1' or 'constant'
      as the key.
    • 'legendre': Legendre polynomials. The parameters are
      indicated by a pair of integers, (l, l'), mapping to
      the corresponding coefficients of the Legendre polynomials
      \(P_l(\cos \theta)\)
      and \(P_{l'}(\cos \theta)\). Note that, to keep the
      normalization consistent, this kernel actually uses the
      spherical harmonics \(Y^{m=0}_l(\theta, \phi)\).

    If a list of kernels is provided, the resulting kernel will be a sum of the individual kernels.

  • kernel_params (dict or list of dict) – The parameters for the kernel(s). If a list of kernels is provided, a list of parameter dictionaries should be provided, where each dictionary corresponds to the parameters for the respective kernel.