semvec/pypi-packages huggingface dataset:
physical-basis 1.0.0
Physics-inspired basis functions for machine learning on atomic-scale systems.
Requires Python: >=3.9
Keywords: machine learning, molecular modeling

# Physical basis

This is the "physical basis", a set of radial basis functions specifically designed for atomistic machine learning models.
You can find the theory behind these basis functions here:


## Installation

You can install the package with `pip install physical-basis`.


## Usage

The package contains two classes: one for use in NumPy and one for use in Torch.


### NumPy

The NumPy class can be used as follows:

```python
import numpy as np
from physical_basis import PhysicalBasis

physical_basis = PhysicalBasis()
x = np.array([0.1, 0.2, 0.3])
n = 2
l = 1
result = physical_basis.compute(n, l, x)
derivatives = physical_basis.compute_derivative(n, l, x)
eigenvalue = physical_basis.return_eigenvalue(n, l)
```


### Torch

The Torch class inherits from `torch.nn.Module`, and it can be used as follows:

```python
import torch
from physical_basis.torch import PhysicalBasis

physical_basis = PhysicalBasis()
x = torch.tensor([0.1, 0.2, 0.3])
n = 2
l = 1
result = physical_basis(n, l, x)
eigenvalue = physical_basis.return_eigenvalue(n, l)
```

Especially if you plan to use autograd, splining the functions is recommended for speed,
as the computational graph generated by calls to this class can be large.


# Solving the physical basis eigenvalue equation

The physical basis is generated from an eigenvalue equation that is solved numerically.
This procedure finds coefficients that are then used to calculate the physical basis from
a basis of trigonometric functions.
Scripts to solve the eigenvalue equation, as well as instructions, are available in
`generate_coefficients`.