xnn.common.featurizers.cutoff.CosineCutoff#

class xnn.common.featurizers.cutoff.CosineCutoff(cutoff)[source]#

Bases: Module

Behler cosine cutoff function.

Computes 0.5 * (cos(pi * r / rc) + 1) for distances inside the cutoff and returns zero beyond it, giving a smooth decay to zero at r = rc.

Parameters:

cutoff (float) – Cutoff radius rc, in the same units as the input distances.

forward(r)[source]#

Evaluate the cosine cutoff.

Parameters:

r (Tensor) – Interatomic distances of arbitrary shape (...).

Returns:

Cutoff weights of the same shape as r, in [0, 1] and zero where r >= cutoff.

Return type:

Tensor