xnn.common.models.dispersion.switching_function#

xnn.common.models.dispersion.switching_function(r, cutoff, width)[source]#

Quintic switching window: 1 below cutoff - width, 0 above cutoff.

width <= 0 gives the sharp cutoff (the upstream default). Inside the window x = (cutoff - r) / width runs from 0 to 1 and the switch is x^3 (10 - 15 x + 6 x^2), with zero slope at both ends.

Parameters:
  • r (Tensor) – Distances, any shape.

  • cutoff (float) – End of the window (same unit as r).

  • width (float) – Width of the window; <= 0 disables it.

Returns:

The switch value in [0, 1], same shape as r.

Return type:

Tensor