Physics-inspired basis functions for machine learning on atomic-scale systems.
Project description
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:
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:
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
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file physical_basis-1.0.0.tar.gz
.
File metadata
- Download URL: physical_basis-1.0.0.tar.gz
- Upload date:
- Size: 15.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b545636efa87ef048be036b5d5c61627d2aca367fa4bb27300e93b593202fb04 |
|
MD5 | 80a4d44dc78a869e863c7e1afdff374d |
|
BLAKE2b-256 | 81c266c005f882c2c0f524abfd8cec48287a43c5f2f5a91df2968017519964cd |
File details
Details for the file physical_basis-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: physical_basis-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adaa701a6f4d13b00b20151c0d257a71d9e342c032a11d2bba9f29d26691d90b |
|
MD5 | 013124cd738e4130b217b85e937f19ff |
|
BLAKE2b-256 | 4dff9198fdbae41b42dd68184b90ad5ed5939e9f077e5232249feec5d502d260 |