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.

Ep(r)=1(p+1)(p+2)2rp+p(p+2)rp+1p(p+1)2dp+2

where rcut is the cutoff radius, and pN.

Parameters:
  • cutoff (float) – The cutoff radius.

  • p (int) – The order of the envelope function.

class graph_pes.models.components.distances.SmoothOnsetEnvelope(cutoff, onset)[source]

Bases: Envelope

A smooth cutoff function with an onset.

f(r,ro,rc)={1if r<ro(rcr)2(rc+2r3ro)(rcro)3if ror<rc0if rrc

where ro is the onset radius and rc is the cutoff radius.

Parameters:
  • cutoff (float) – The cutoff radius.

  • onset (float) – The onset radius.

class graph_pes.models.components.distances.CosineEnvelope(cutoff)[source]

Bases: Envelope

A cosine envelope function.

Ec(r)=12(1+cos(πrrcut))

where rcut is the cutoff radius.

Parameters:

cutoff (float) – 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:

Tensor