PAOFLOW.pyskeaf.interp#

4-point Lagrange tricubic interpolation of band energies.

Faithful port of the Fortran pinterpolation function (lines 3300–3764 of skeaf_v1p3p0_r149.F90) plus a vectorised batch interface.

Conventions#

The Fortran routine uses 1-based continuous coordinates intpointx ∈ [1, nx], with the convention that the BXSF General Grid is periodic: energies at index 1 and nx correspond to the same physical k-point (opposite faces of one BZ). Out-of-range stencil nodes wrap as

if x2 == 1 then x1 -> nx - 1 if x3 == nx then x4 -> 2

Internally we work in 0-based coordinates u ∈ [0, nx - 1]; the equivalent wrap is

if i2 == 0 then i1 -> nx - 2 if i3 == nx - 1 then i4 -> 1

Stencil#

For a fractional position u between integer grid nodes, we use the 4-node stencil (i2 - 1, i2, i2 + 1, i2 + 2) where i2 = floor(u) and i3 = i2 + 1. When u lies exactly on an integer node we collapse to that node (mirrors the Fortran integer-coordinate fast path and avoids the x2 == x3 zero-divide that the general formula would otherwise hit).

Performance#

  • interpolate_point() — single (x, y, z) evaluation, kept for unit-test parity with the Fortran scalar function.

  • interpolate_grid() — vectorised tensor-product evaluation over separable axis grids xs, ys, zs (typical for SKEAF: a full 4·numint × 4·numint × 4·numint supercell sample, or a 2D slice). Builds the four Lagrange weights per axis once and contracts via numpy.einsum().

Attributes#

Functions#

interpolate_point(energies, x, y, z)

Interpolate energies at a single (x, y, z) point (0-based coords).

interpolate_grid(energies, xs, ys, zs)

Interpolate energies on the tensor-product grid (xs, ys, zs).

supercell_axis_coords(numint, n_axis)

Return the 0-based supercell sample coordinates along one axis.

Module Contents#

PAOFLOW.pyskeaf.interp.ArrayLike[source]#
PAOFLOW.pyskeaf.interp.interpolate_point(energies, x, y, z)[source]#

Interpolate energies at a single (x, y, z) point (0-based coords).

Mirrors the Fortran pinterpolation scalar function exactly.

PAOFLOW.pyskeaf.interp.interpolate_grid(energies, xs, ys, zs)[source]#

Interpolate energies on the tensor-product grid (xs, ys, zs).

Parameters:
  • energies (ndarray, shape (nx, ny, nz)) – Source energies in Rydbergs (or any scalar field).

  • xs (1-D array-like) – 0-based continuous coordinates along each axis. Coordinates must lie in [0, nx - 1], [0, ny - 1], [0, nz - 1] respectively.

  • ys (1-D array-like) – 0-based continuous coordinates along each axis. Coordinates must lie in [0, nx - 1], [0, ny - 1], [0, nz - 1] respectively.

  • zs (1-D array-like) – 0-based continuous coordinates along each axis. Coordinates must lie in [0, nx - 1], [0, ny - 1], [0, nz - 1] respectively.

Returns:

out – Interpolated values, with axes in (x, y, z) order.

Return type:

ndarray, shape (len(xs), len(ys), len(zs))

PAOFLOW.pyskeaf.interp.supercell_axis_coords(numint, n_axis)[source]#

Return the 0-based supercell sample coordinates along one axis.

Reproduces the Fortran formula

dintpoint = ((ti - 1) / (4*numint - 1)) * (n - 1) + 1 (1-based)

in 0-based form

u_i = i / (4*numint - 1) * (n - 1) for i in [0, 4*numint - 1]

Parameters:
  • numint (int) – User-requested interpolated points per single-side; the supercell is sampled at 4 * numint points along each axis.

  • n_axis (int) – Original BXSF grid size along this axis.