Envelopes¶
Available Envelopes¶
graph-pes
exposes the Envelope
base class, together with implementations of a few common envelope functions:
- class graph_pes.models.components.distances.PolynomialEnvelope(cutoff, p=6)[source]¶
Bases:
Envelope
A thrice differentiable envelope function.
\[E_p(r) = 1 - \frac{(p+1)(p+2)}{2}\cdot r^p + p(p+2) \cdot r^{p+1} - \frac{p(p+1)}{2}\cdot d^{p+2}\]where \(r_\text{cut}\) is the cutoff radius, and \(p \in \mathbb{N}\).
- class graph_pes.models.components.distances.SmoothOnsetEnvelope(cutoff, onset)[source]¶
Bases:
Envelope
A smooth cutoff function with an onset.
\[\begin{split}f(r, r_o, r_c) = \begin{cases} \hfill 1 \hfill & \text{if } r < r_o \\ \frac{(r_c - r)^2 (r_c + 2r - 3r_o)}{(r_c - r_o)^3} & \text{if } r_o \leq r < r_c \\ \hfill 0 \hfill & \text{if } r \geq r_c \end{cases}\end{split}\]where \(r_o\) is the onset radius and \(r_c\) is the cutoff radius.
Implementing a new Envelope¶
- class graph_pes.models.components.distances.Envelope(*args, **kwargs)[source]¶
Any envelope function, \(E(r)\), for smoothing potentials must implement a forward method that takes in a tensor of distances and returns a tensor of the same shape, where the values outside the cutoff are set to zero.
- forward(r)[source]¶
Perform the envelope function.
- Parameters:
r (torch.Tensor) – The distances to envelope.
- Return type: