shenoynikhil/annotated-dimenet

[Doubts] Envelope Function

Closed this issue · 2 comments

  • Why do the radial basis function and the spherical basis function need to be doubly differentiable?
  • why are we using $p - 1$ exponent
class Envelope(torch.nn.Module):
    def __init__(self, exponent: int):
        super().__init__()
        self.p = exponent + 1
        self.a = -(self.p + 1) * (self.p + 2) / 2
        self.b = self.p * (self.p + 2)
        self.c = -self.p * (self.p + 1) / 2

    def forward(self, x: Tensor) -> Tensor:
        p, a, b, c = self.p, self.a, self.b, self.c
        x_pow_p0 = x.pow(p - 1)
        x_pow_p1 = x_pow_p0 * x
        x_pow_p2 = x_pow_p1 * x
        
        return (
            1. / x + a * x_pow_p0 + b * x_pow_p1 +
            c * x_pow_p2) * (x < 1.0).to(x.dtype)
  • equation according to the implementation looks like, was unable to understand why?

$$ u(d) = \begin{cases} \frac{1}{d}(1 - \frac{(p + 1)(p + 2)}{2}d^p + p(p + 2)d^{p+1} - \frac{p(p + 1)}{2}d^{p + 2}),& \text{if } d < 1.\\ 0, & \text{otherwise} \end{cases} $$

@gasteigerjo I had a few questions, I'll be really grateful if you could answer them.

  1. Sorry, that wasn't exactly accurate. They only need to be continuously differentiable, not twice differentiable. That's to ensure a smooth force.
  2. That's because the implementation pulls the 1/d of Equation 7 into the envelope function in Equation 8, to save some computation. Might be worth mentioning.