Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

physical_basis-1.0.0.tar.gz (15.8 MB view hashes)

Uploaded Source

Built Distribution

physical_basis-1.0.0-py3-none-any.whl (15.8 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page