core.models.gemnet_gp.layers.basis_utils#

Copyright (c) Meta, Inc. and its affiliates.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Functions#

Jn(r, n)

numerical spherical bessel functions of order n

Jn_zeros(n, k)

Compute the first k zeros of the spherical bessel functions up to order n (excluded)

spherical_bessel_formulas(n)

Computes the sympy formulas for the spherical bessel functions up to order n (excluded)

bessel_basis(n, k)

Compute the sympy formulas for the normalized and rescaled spherical bessel functions up to

sph_harm_prefactor(→ float)

Computes the constant pre-factor for the spherical harmonic of degree l and order m.

associated_legendre_polynomials(L_maxdegree[, ...])

Computes string formulas of the associated legendre polynomials up to degree L (excluded).

real_sph_harm(L_maxdegree, use_theta[, use_phi, ...])

Computes formula strings of the the real part of the spherical harmonics up to degree L (excluded).

Module Contents#

core.models.gemnet_gp.layers.basis_utils.Jn(r: float, n: int)#

numerical spherical bessel functions of order n

core.models.gemnet_gp.layers.basis_utils.Jn_zeros(n: int, k: int)#

Compute the first k zeros of the spherical bessel functions up to order n (excluded)

core.models.gemnet_gp.layers.basis_utils.spherical_bessel_formulas(n)#

Computes the sympy formulas for the spherical bessel functions up to order n (excluded)

core.models.gemnet_gp.layers.basis_utils.bessel_basis(n: int, k: int)#

Compute the sympy formulas for the normalized and rescaled spherical bessel functions up to order n (excluded) and maximum frequency k (excluded).

Returns:

list

Bessel basis formulas taking in a single argument x. Has length n where each element has length k. -> In total n*k many.

Return type:

bess_basis

core.models.gemnet_gp.layers.basis_utils.sph_harm_prefactor(l_degree: int, m_order: int) float#

Computes the constant pre-factor for the spherical harmonic of degree l and order m.

Parameters:
  • l_degree (int) – Degree of the spherical harmonic. l >= 0

  • m_order (int) – Order of the spherical harmonic. -l <= m <= l

Returns:

factor

Return type:

float

core.models.gemnet_gp.layers.basis_utils.associated_legendre_polynomials(L_maxdegree: int, zero_m_only: bool = True, pos_m_only: bool = True)#

Computes string formulas of the associated legendre polynomials up to degree L (excluded).

Parameters:
  • L_maxdegree (int) – Degree up to which to calculate the associated legendre polynomials (degree L is excluded).

  • zero_m_only (bool) – If True only calculate the polynomials for the polynomials where m=0.

  • pos_m_only (bool) – If True only calculate the polynomials for the polynomials where m>=0. Overwritten by zero_m_only.

Returns:

polynomials – Contains the sympy functions of the polynomials (in total L many if zero_m_only is True else L^2 many).

Return type:

list

core.models.gemnet_gp.layers.basis_utils.real_sph_harm(L_maxdegree: int, use_theta: bool, use_phi: bool = True, zero_m_only: bool = True)#

Computes formula strings of the the real part of the spherical harmonics up to degree L (excluded). Variables are either spherical coordinates phi and theta (or cartesian coordinates x,y,z) on the UNIT SPHERE.

Parameters:
  • L_maxdegree (int) – Degree up to which to calculate the spherical harmonics (degree L is excluded).

  • use_theta (bool) –

    • True: Expects the input of the formula strings to contain theta.

    • False: Expects the input of the formula strings to contain z.

  • use_phi (bool) –

    • True: Expects the input of the formula strings to contain phi.

    • False: Expects the input of the formula strings to contain x and y.

    Does nothing if zero_m_only is True

  • zero_m_only (bool) – If True only calculate the harmonics where m=0.

Returns:

Y_lm_real – Computes formula strings of the the real part of the spherical harmonics up to degree L (where degree L is not excluded). In total L^2 many sph harm exist up to degree L (excluded). However, if zero_m_only only is True then the total count is reduced to be only L many.

Return type:

list