-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7b293f
commit 0555c97
Showing
14 changed files
with
1,960 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: GAP tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
# Check all PR | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-22.04 | ||
python-version: "3.11" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- run: pip install tox | ||
|
||
- name: run SparseGAP tests | ||
run: tox -e gap-tests | ||
env: | ||
# Use the CPU only version of torch when building/running the code | ||
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu | ||
|
||
- name: Upload codecoverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./tests/coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
.. _architecture-sparse-gap: | ||
|
||
GAP | ||
=== | ||
|
||
This is an implementation of the sparse `Gaussian Approximation Potential | ||
<GAP_>`_ (GAP) using `Smooth Overlap of Atomic Positions <SOAP_>`_ (SOAP) | ||
implemented in `rascaline <RASCALINE_>`_. | ||
|
||
|
||
.. _SOAP: https://doi.org/10.1103/PhysRevB.87.184115 | ||
.. _GAP: https://doi.org/10.1002/qua.24927 | ||
.. _RASCALINE: https://github.com/Luthaf/rascaline | ||
|
||
The GAP model in metatensor-models can only train on CPU, but evaluation | ||
is also supported on GPU. | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
To install the package, you can run the following command in the root directory | ||
of the repository: | ||
|
||
.. code-block:: bash | ||
pip install .[gap] | ||
This will install the package with the GAP dependencies. | ||
|
||
|
||
Hyperparameters | ||
--------------- | ||
|
||
:param name: ``experimental.gap`` | ||
|
||
model | ||
##### | ||
soap | ||
^^^^ | ||
:param cutoff: Spherical cutoff (Å) to use for atomic environments | ||
:param max_radial: Number of radial basis function to use | ||
:param max_angular: Number of angular basis function to use also denoted by the maximum | ||
degree of spherical harmonics | ||
:param atomic_gaussian_width: Width of the atom-centered gaussian creating the atomic | ||
density | ||
:param center_atom_weight: Weight of the central atom contribution to the features. If | ||
1.0 the center atom contribution is weighted the same as any other contribution. If | ||
0.0 the central atom does not contribute to the features at all. | ||
:param cutoff_function: cutoff function used to smooth the behavior around the cutoff | ||
radius. The supported cutoff function are | ||
|
||
- ``Step``: Step function, 1 if ``r < cutoff`` and 0 if ``r >= cutoff``. This cutoff | ||
function takes no additional parameters and can set as in ``.yaml`` file: | ||
|
||
.. code-block:: yaml | ||
cutoff_function: | ||
Step: | ||
- ``ShiftedCosine``: Shifted cosine switching function ``f(r) = 1/2 * (1 + cos(π (r | ||
- cutoff + width) / width ))``. This cutoff function takes the ``width``` as | ||
additional parameter and can set as in ``options.yaml`` file as: | ||
|
||
.. code-block:: yaml | ||
cutoff_function: | ||
ShiftedCosine: | ||
width: 1.0 | ||
:param radial_scaling: Radial scaling can be used to reduce the importance of neighbor | ||
atoms further away from the center, usually improving the performance of the model. | ||
The supported radial scaling functions are | ||
|
||
- ``None``: No radial scaling. | ||
|
||
.. code-block:: yaml | ||
radial_scaling: | ||
None: | ||
- ``Willatt2018`` Use a long-range algebraic decay and smooth behavior at :math:`r | ||
\rightarrow 0`: as introduced by :footcite:t:`willatt_feature_2018` as ``f(r) = | ||
rate / (rate + (r / scale) ^ exponent)`` This radial scaling function can be set | ||
in the ``options.yaml`` file as. | ||
|
||
.. code-block:: yaml | ||
radial_scaling: | ||
Willatt2018: | ||
rate: 1.0 | ||
scale: 2.0 | ||
exponent: 7.0 | ||
.. note:: | ||
|
||
Currently, we only support a Gaussian type orbitals (GTO) as radial basis functions | ||
and radial integrals. | ||
|
||
krr | ||
^^^^ | ||
:param degree: degree of the polynomial kernel | ||
:param num_sparse_points: number of pseudo points to select (by farthest point sampling) | ||
|
||
training: | ||
^^^^^^^^^ | ||
:param regularizer: value of the energy regularizer | ||
:param regularizer_forces: value of the forces regularizer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from .model import GAP | ||
from .trainer import Trainer | ||
|
||
__model__ = GAP | ||
__trainer__ = Trainer | ||
|
||
__authors__ = [ | ||
("Alexander Goscinski <[email protected]>", "@agosckinski"), | ||
("Davide Tisi <[email protected]>", "@DavideTisi"), | ||
] | ||
|
||
__maintainers__ = [ | ||
("Davide Tisi <[email protected]>", "@DavideTisi"), | ||
] |
28 changes: 28 additions & 0 deletions
28
src/metatensor/models/experimental/gap/default-hypers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# default hyperparameters for the SparseGAP model | ||
name: gap | ||
|
||
model: | ||
soap: | ||
cutoff: 5.0 | ||
max_radial: 8 | ||
max_angular: 6 | ||
atomic_gaussian_width: 0.3 | ||
radial_basis: | ||
Gto: {} | ||
center_atom_weight: 1.0 | ||
cutoff_function: | ||
ShiftedCosine: | ||
width: 1.0 | ||
radial_scaling: | ||
Willatt2018: | ||
rate: 1.0 | ||
scale: 2.0 | ||
exponent: 7.0 | ||
|
||
krr: | ||
degree: 2 # degree of the polynomial kernel | ||
num_sparse_points: 500 # number of pseudo points to select, farthest point sampling is used | ||
|
||
training: | ||
regularizer: 0.001 | ||
regularizer_forces: null |
Oops, something went wrong.