gpe.gpu.bases#

Updated bases with GPU support.

Classes#

PeriodicBasisGPU

dim-dimensional periodic bases.

SphericalBasis

1-dimensional basis for radial problems.

CylindricalBasis

2D basis for Cylindrical coordinates via a DVR basis.

Module Contents#

class PeriodicBasisGPU(Nxyz, Lxyz, symmetric_lattice=False, axes=None, smoothing_cutoff=0.8, memoization_GB=0.5, _test=False, **_kw)[source]#

Bases: mmfutils.math.bases.PeriodicBasis

dim-dimensional periodic bases.

Parameters:
  • Nxyz ((Nx, Ny, ...)) – Number of lattice points in basis.

  • Lxyz ((Lx, Ly, ...)) – Size of each dimension (length of box and radius)

  • symmetric_lattice (bool) – If True, then shift the lattice so that it is symmetric about the origin. The default is to ensure that there is a lattice point at the origin which will make the lattice asymmetric for even Nxyz.

  • axes ((int, int, ...)) – Axes in array y which correspond to the x, y, … axes here. This is required for cases where y has additional dimensions. The default is the last dim axes (best for performance).

  • smoothing_cutoff (float) – Fraction of maximum momentum used in the function smooth(). The current implementation is a spherically symmetric truncation in momentum space. A smoothing_cutoff of 0.5 is suitable for the TGPE as is 2/3 if the density is additionally truncated at each step. (For details, see https://doi.org/10.1103%2Fphysreve.83.066311)

  • memoization_GB (float) – Memoization threshold. If memoizing factors like the momentum and smoothing factor would exceed this threshold, then memoization is disabled.

xp[source]#
_fft[source]#
class SphericalBasis(N, R)[source]#

Bases: mmfutils.math.bases.SphericalBasis

1-dimensional basis for radial problems.

We represent exactly N positive abscissa, excluding the origin and use the discrete sine transform. We represent the square-root of the wavefunctions here so that a factor of r is required to convert these into the radial functions. Unlike the DVR techniques, this approach allows us to compute the Coulomb interaction for example.

xp[source]#
init()[source]#

Initialize Object.

laplacian(y, factor=None, factors=None, exp=False)[source]#

Return the laplacian of y times factor or the exponential of this.

Parameters:
  • factor (float | None) – Additional factor(s) (mostly used with exp=True). The implementation must be careful to allow the factor to broadcast across the components.

  • factors ([float] | None) – Tuple of scale factors for each dimension. Allows for independent scaling of each direction (used in expanding reference frames).

  • exp (bool) – If True, then compute the exponential of the laplacian. This is used for split evolvers.

coulomb_kernel(k, factors=None)[source]#

Form for the truncated Coulomb kernel.

convolve_coulomb(y, form_factors=(), factors=None)[source]#

Modified Coulomb convolution to include form-factors (if provided).

This version implemented a 3D spherically symmetric convolution.

convolve(y, C=None, Ck=None, factors=None)[source]#

Return the periodic convolution int(C(x-r)*y(r),r).

Note: this is the 3D convolution.

class CylindricalBasis(Nxr, Lxr, axes=(-2, -1), symmetric_x=True, **_kw)[source]#

Bases: mmfutils.math.bases.CylindricalBasis

2D basis for Cylindrical coordinates via a DVR basis.

This represents 3-dimensional problems with axial symmetry, but only has two dimensions (x, r).

Parameters:
  • Nxr ((Nx, Nr)) – Number of lattice points in basis.

  • Lxr ((L, R)) – Size of each dimension (length of box and radius)

  • axes ((int, int)) – Axes in array y which correspond to the x and r axes here. This is required for cases where y has additional dimensions. The default is the last two axes (best for performance).

xp[source]#
init()[source]#

Initialize Object.

apply_exp_K(y, factor, factors=None, kx2=None, **_kw)[source]#

Return exp(K*factor)*y or return precomputed data if K_data is None.

apply_K(y, factors=None, kx2=None, **_kw)[source]#

Return K*y where K = k**2/2

fft(x)[source]#

Perform the fft along the x axes

ifft(x)[source]#

Perform the fft along the x axes

integrate1(n)[source]#

Return the integral of n over y and z.

integrate2(n, y=None, Nz=100)[source]#

Return the integral of n over z (line-of-sight integral) at y.

This is an Abel transform, and is used to compute the 1D line-of-sight integral as would be seen by a photographic image through an axial cloud.

Parameters:
  • n (array) – (Nx, Nr) array of the function to be integrated tabulated on the abscissa. Note: the extrapolation assumes that n = abs(psi)**2 where psi is well represented in the basis.

  • y (array, None) – Ny points at which the resulting integral should be returned. If not provided, then the function will be tabulated at the radial abscissa.

  • Nz (int) – Number of points to use in z integral.