Metadata-Version: 2.1
Name: physical-basis
Version: 1.0.0
Summary: Physics-inspired basis functions for machine learning on atomic-scale systems.
Author: Filippo Bigi
Keywords: machine learning,molecular modeling
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy

# 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`.
