xnn.gnn.featurizers.spherical_bessel.SphericalBesselBasis#
- class xnn.gnn.featurizers.spherical_bessel.SphericalBesselBasis(n_spherical=7, n_radial=6, cutoff=5.0)[source]#
Bases:
ModuleThe 2D spherical Fourier-Bessel basis
a_ln(d, alpha)of DimeNet (eq 6).Joint representation of a distance
dand an anglealphain theN_SHBF * N_SRBForthonormal functionssqrt(2 / (c^3 j_{l+1}(z_ln)^2)) j_l(z_ln d / c) Y_l^0(alpha). The basis itself ends with a step at the cutoff; DimeNet multiplies it by the polynomial envelope of eq 8 (PolynomialCutoff) to make it twice continuously differentiable.The radial and angular factors are exposed separately (
radial(),angular()) because in the directional message passing the distance belongs to an edge and the angle to a triplet of atoms, so the radial part is evaluated once per edge and gathered onto the triplets.- Parameters:
- Variables:
zeros (Tensor) – Buffer of shape
(n_spherical, n_radial)holdingz_ln.norm (Tensor) – Buffer of the same shape holding
sqrt(2 / (c^3 j_{l+1}(z_ln)^2)).
- output_dim#
Number of basis functions
n_spherical * n_radial.
- radial(r)[source]#
The radial factors
sqrt(2 / (c^3 j_{l+1}(z_ln)^2)) j_l(z_ln r / c).- Parameters:
r (Tensor) – Distances, shape
(E,).- Returns:
Shape
(E, n_spherical, n_radial), in the dtype ofr.- Return type:
Tensor
- angular(cos_alpha)[source]#
The angular factors
Y_l^0(alpha).- Parameters:
cos_alpha (Tensor) – Cosines of the angles, shape
(T,).- Returns:
Shape
(T, n_spherical).- Return type:
Tensor
- forward(r, cos_alpha)[source]#
Evaluate the full basis for distance/angle pairs.
- Parameters:
r (Tensor) – Distances, shape
(T,).cos_alpha (Tensor) – Cosines of the angles paired with them, shape
(T,).
- Returns:
a_ln(r, alpha)of shape(T, n_spherical * n_radial), the degreelrunning slowest (columnl * n_radial + n - 1).- Return type:
Tensor