nvalchemiops.math and nvalchemiops.types: Utilities#

Mathematical Utilities#

Mathematical Utilities#

This module provides low-level mathematical functions implemented in Warp for use in GPU-accelerated scientific computing.

Available Submodules#

spherical_harmonics

Real spherical harmonics \(Y_l^m\) for angular momentum \(L \leq 2\). Used in multipole expansions for electrostatics.

gto

Gaussian Type Orbital (GTO) basis functions for multipole charge distributions. Includes real-space densities and Fourier transforms for \(L \leq 2\).

nvalchemiops.math.eval_gto_density_pytorch(positions, sigma, L_max=2, device=None)[source]#

Evaluate GTO densities from PyTorch tensors.

Parameters:
  • positions (torch.Tensor) – Input positions [N, 3] as float64.

  • sigma (float) – Gaussian width parameter.

  • L_max (int) – Maximum angular momentum (0, 1, or 2). Default: 2.

  • device (torch.device, optional) – Device for computation.

Returns:

GTO density values [N, num_components].

Return type:

torch.Tensor

nvalchemiops.math.eval_gto_fourier_pytorch(k_vectors, sigma, L_max=2, device=None)[source]#

Evaluate GTO Fourier transforms from PyTorch tensors.

Parameters:
  • k_vectors (torch.Tensor) – Input wave vectors [K, 3] as float64.

  • sigma (float) – Gaussian width parameter.

  • L_max (int) – Maximum angular momentum (0, 1, or 2). Default: 2.

  • device (torch.device, optional) – Device for computation.

Returns:

(real_part, imag_part) each of shape [K, num_components].

Return type:

tuple[torch.Tensor, torch.Tensor]

nvalchemiops.math.wpdivmod(a, b)[source]#

Warp implementation of the divmod utility.

Parameters:
  • a (int)

  • b (int)

Type Conversion Utilities#

nvalchemiops.types.get_wp_dtype(dtype)[source]#

Get the warp dtype for a given torch dtype.

Parameters:

dtype (dtype)

nvalchemiops.types.get_wp_mat_dtype(dtype)[source]#

Get the warp mat dtype for a given torch dtype.

Parameters:

dtype (dtype)

nvalchemiops.types.get_wp_vec_dtype(dtype)[source]#

Get the warp vec dtype for a given torch dtype.

Parameters:

dtype (dtype)

nvalchemiops.types.get_wp_dtype(dtype)[source]

Get the warp dtype for a given torch dtype.

Parameters:

dtype (dtype)

nvalchemiops.types.get_wp_vec_dtype(dtype)[source]

Get the warp vec dtype for a given torch dtype.

Parameters:

dtype (dtype)

nvalchemiops.types.get_wp_mat_dtype(dtype)[source]

Get the warp mat dtype for a given torch dtype.

Parameters:

dtype (dtype)