Skip to content

Commit

Permalink
morse potential
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00b1 committed Jul 24, 2024
1 parent e102447 commit b875e67
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 29 deletions.
1 change: 0 additions & 1 deletion docs/reference/beignet.datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
::: beignet.datasets.MartinsBloodBrainBarrierDataset
::: beignet.datasets.NCATSPAMPAPermeabilityDataset
::: beignet.datasets.ObachHalfLifeDataset
::: beignet.datasets.PDB70Dataset
::: beignet.datasets.PDBTrajectoryDataset
::: beignet.datasets.PDBbindDataset
::: beignet.datasets.ParquetDataset
Expand Down
1 change: 0 additions & 1 deletion docs/reference/datasets/sequences.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
::: beignet.datasets.FreeSolvDataset
::: beignet.datasets.GDSC1Dataset
::: beignet.datasets.GDSC2Dataset
::: beignet.datasets.PDB70Dataset
::: beignet.datasets.PDBbindDataset
::: beignet.datasets.REALDatabaseDataset
::: beignet.datasets.SKEMPIDataset
1 change: 1 addition & 0 deletions docs/reference/operators/interatomic-potentials.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
::: beignet.lennard_jones_potential
::: beignet.morse_potential
Empty file.
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ nav:
- "Probabilists’ Hermite polynomial": "reference/operators/special-functions/orthogonal-polynomials/probabilists-hermite-polynomial.md"
- "Laguerre polynomial": "reference/operators/special-functions/orthogonal-polynomials/laguerre-polynomial.md"
- "Legendre polynomial": "reference/operators/special-functions/orthogonal-polynomials/legendre-polynomial.md"
- "Thermodynamics": "reference/operators/thermodynamics.md"
- "beignet.datasets": "reference/beignet.datasets.md"
- "beignet.features":
- "General-purpose": "reference/features/general-purpose.md"
Expand Down
54 changes: 28 additions & 26 deletions src/beignet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
from ._linear_probabilists_hermite_polynomial import (
linear_probabilists_hermite_polynomial,
)
from ._morse_potential import morse_potential
from ._multiply_chebyshev_polynomial import multiply_chebyshev_polynomial
from ._multiply_chebyshev_polynomial_by_x import multiply_chebyshev_polynomial_by_x
from ._multiply_laguerre_polynomial import multiply_laguerre_polynomial
Expand Down Expand Up @@ -370,14 +371,9 @@
"apply_rotation_matrix",
"apply_rotation_vector",
"apply_transform",
"evaluate_chebyshev_polynomial_cartesian_2d",
"evaluate_chebyshev_polynomial_cartesian_3d",
"chebyshev_interpolation",
"linear_chebyshev_polynomial",
"multiply_chebyshev_polynomial_by_x",
"chebyshev_zeros",
"chebyshev_extrema",
"chebyshev_gauss_quadrature",
"chebyshev_interpolation",
"chebyshev_polynomial_companion",
"chebyshev_polynomial_domain",
"chebyshev_polynomial_from_roots",
Expand All @@ -391,6 +387,7 @@
"chebyshev_polynomial_weight",
"chebyshev_polynomial_x",
"chebyshev_polynomial_zero",
"chebyshev_zeros",
"compose_euler_angle",
"compose_quaternion",
"compose_rotation_matrix",
Expand All @@ -416,22 +413,34 @@
"evaluate_chebyshev_polynomial",
"evaluate_chebyshev_polynomial_2d",
"evaluate_chebyshev_polynomial_3d",
"evaluate_chebyshev_polynomial_cartesian_2d",
"evaluate_chebyshev_polynomial_cartesian_3d",
"evaluate_laguerre_polynomial",
"evaluate_laguerre_polynomial_2d",
"evaluate_laguerre_polynomial_3d",
"evaluate_laguerre_polynomial_cartesian_2d",
"evaluate_laguerre_polynomial_cartesian_3d",
"evaluate_legendre_polynomial",
"evaluate_legendre_polynomial_2d",
"evaluate_legendre_polynomial_3d",
"evaluate_legendre_polynomial_cartesian_2d",
"evaluate_legendre_polynomial_cartesian_3d",
"evaluate_physicists_hermite_polynomial",
"evaluate_physicists_hermite_polynomial_2d",
"evaluate_physicists_hermite_polynomial_3d",
"evaluate_physicists_hermite_polynomial_cartesian_2d",
"evaluate_physicists_hermite_polynomial_cartesian_3d",
"evaluate_polynomial",
"evaluate_polynomial_2d",
"evaluate_polynomial_3d",
"evaluate_polynomial_cartesian_2d",
"evaluate_polynomial_cartesian_3d",
"evaluate_polynomial_from_roots",
"evaluate_probabilists_hermite_polynomial",
"evaluate_probabilists_hermite_polynomial_2d",
"evaluate_probabilists_hermite_polynomial_3d",
"evaluate_probabilists_hermite_polynomial_cartersian_2d",
"evaluate_probabilists_hermite_polynomial_cartersian_3d",
"farthest_first_traversal",
"fit_chebyshev_polynomial",
"fit_laguerre_polynomial",
Expand All @@ -443,14 +452,6 @@
"gauss_legendre_quadrature",
"gauss_physicists_hermite_polynomial_quadrature",
"gauss_probabilists_hermite_polynomial_quadrature",
"evaluate_probabilists_hermite_polynomial_cartersian_2d",
"evaluate_probabilists_hermite_polynomial_cartersian_3d",
"linear_probabilists_hermite_polynomial",
"multiply_probabilists_hermite_polynomial_by_x",
"evaluate_physicists_hermite_polynomial_cartesian_2d",
"evaluate_physicists_hermite_polynomial_cartesian_3d",
"linear_physicists_hermite_polynomial",
"multiply_physicists_hermite_polynomial_by_x",
"integrate_chebyshev_polynomial",
"integrate_laguerre_polynomial",
"integrate_legendre_polynomial",
Expand All @@ -462,10 +463,6 @@
"invert_rotation_matrix",
"invert_rotation_vector",
"invert_transform",
"evaluate_laguerre_polynomial_cartesian_2d",
"evaluate_laguerre_polynomial_cartesian_3d",
"linear_laguerre_polynomial",
"multiply_laguerre_polynomial_by_x",
"laguerre_polynomial_companion",
"laguerre_polynomial_domain",
"laguerre_polynomial_from_roots",
Expand All @@ -492,17 +489,26 @@
"legendre_polynomial_weight",
"legendre_polynomial_x",
"legendre_polynomial_zero",
"evaluate_legendre_polynomial_cartesian_2d",
"evaluate_legendre_polynomial_cartesian_3d",
"linear_legendre_polynomial",
"multiply_legendre_polynomial_by_x",
"lennard_jones_potential",
"linear_chebyshev_polynomial",
"linear_laguerre_polynomial",
"linear_legendre_polynomial",
"linear_physicists_hermite_polynomial",
"linear_polynomial",
"linear_probabilists_hermite_polynomial",
"morse_potential",
"multiply_chebyshev_polynomial",
"multiply_chebyshev_polynomial_by_x",
"multiply_laguerre_polynomial",
"multiply_laguerre_polynomial_by_x",
"multiply_legendre_polynomial",
"multiply_legendre_polynomial_by_x",
"multiply_physicists_hermite_polynomial",
"multiply_physicists_hermite_polynomial_by_x",
"multiply_polynomial",
"multiply_polynomial_by_x",
"multiply_probabilists_hermite_polynomial",
"multiply_probabilists_hermite_polynomial_by_x",
"physicists_hermite_polynomial_companion",
"physicists_hermite_polynomial_domain",
"physicists_hermite_polynomial_from_roots",
Expand All @@ -516,10 +522,6 @@
"physicists_hermite_polynomial_weight",
"physicists_hermite_polynomial_x",
"physicists_hermite_polynomial_zero",
"evaluate_polynomial_cartesian_2d",
"evaluate_polynomial_cartesian_3d",
"linear_polynomial",
"multiply_polynomial_by_x",
"polynomial_companion",
"polynomial_domain",
"polynomial_from_roots",
Expand Down
46 changes: 46 additions & 0 deletions src/beignet/_morse_potential.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import torch
from torch import Tensor


def morse_potential(
input: Tensor,
sigma: Tensor | None = 1.0,
epsilon: Tensor | None = 5.0,
alpha: Tensor | None = 5.0,
**_,
) -> Tensor:
"""
Morse interaction between particles with a minimum at `sigma`.
Parameters
----------
input : Tensor, shape=[n, m]
Pairwise distances between particles.
sigma : Tensor, optional
Distance between particles where the energy has a minimum. Should
either be a floating-point scalar or a Tensor of shape `[n, m]`.
epsilon : Tensor, optional
Interaction energy scale. Should either be a floating-point scalar or
a Tensor of shape `[n, m]`.
alpha : Tensor, optional
Range parameter. Should either be a floating-point scalar or a Tensor
of shape `[n, m]`.
Returns
-------
output : Tensor, shape=[n, m]
Energies.
"""
if sigma is None:
sigma = torch.tensor(1.0, dtype=input.dtype)

if epsilon is None:
epsilon = torch.tensor(5.0, dtype=input.dtype)

if alpha is None:
alpha = torch.tensor(5.0, dtype=input.dtype)

return epsilon * (1.0 - torch.exp(-alpha * (input - sigma))) ** 2.0 - epsilon

0 comments on commit b875e67

Please sign in to comment.