diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..a07e6b0ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +target/ +**/*.rs.bk +Cargo.lock + +.tox/ +build/ +dist/ +*.egg-info +__pycache__/ diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/_redirect.html b/_redirect.html new file mode 100644 index 000000000..4f607eaeb --- /dev/null +++ b/_redirect.html @@ -0,0 +1,9 @@ + + +
+ + + + + + diff --git a/index.html b/index.html new file mode 100644 index 000000000..e22946da0 --- /dev/null +++ b/index.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/latest/.buildinfo b/latest/.buildinfo new file mode 100644 index 000000000..43dee279f --- /dev/null +++ b/latest/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: d612f0f0c6523c4cadb32515af98a626 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/latest/.doctrees/devdoc/explanations/architecture.doctree b/latest/.doctrees/devdoc/explanations/architecture.doctree new file mode 100644 index 000000000..2f3abb85d Binary files /dev/null and b/latest/.doctrees/devdoc/explanations/architecture.doctree differ diff --git a/latest/.doctrees/devdoc/explanations/index.doctree b/latest/.doctrees/devdoc/explanations/index.doctree new file mode 100644 index 000000000..63b2bde61 Binary files /dev/null and b/latest/.doctrees/devdoc/explanations/index.doctree differ diff --git a/latest/.doctrees/devdoc/explanations/interfaces.doctree b/latest/.doctrees/devdoc/explanations/interfaces.doctree new file mode 100644 index 000000000..c388fa00d Binary files /dev/null and b/latest/.doctrees/devdoc/explanations/interfaces.doctree differ diff --git a/latest/.doctrees/devdoc/explanations/radial-integral.doctree b/latest/.doctrees/devdoc/explanations/radial-integral.doctree new file mode 100644 index 000000000..3e196e70f Binary files /dev/null and b/latest/.doctrees/devdoc/explanations/radial-integral.doctree differ diff --git a/latest/.doctrees/devdoc/get-started.doctree b/latest/.doctrees/devdoc/get-started.doctree new file mode 100644 index 000000000..a915babe9 Binary files /dev/null and b/latest/.doctrees/devdoc/get-started.doctree differ diff --git a/latest/.doctrees/devdoc/how-to/index.doctree b/latest/.doctrees/devdoc/how-to/index.doctree new file mode 100644 index 000000000..f891491f3 Binary files /dev/null and b/latest/.doctrees/devdoc/how-to/index.doctree differ diff --git a/latest/.doctrees/devdoc/how-to/new-calculator.doctree b/latest/.doctrees/devdoc/how-to/new-calculator.doctree new file mode 100644 index 000000000..d835e13ed Binary files /dev/null and b/latest/.doctrees/devdoc/how-to/new-calculator.doctree differ diff --git a/latest/.doctrees/devdoc/how-to/profiling.doctree b/latest/.doctrees/devdoc/how-to/profiling.doctree new file mode 100644 index 000000000..d1e648cb8 Binary files /dev/null and b/latest/.doctrees/devdoc/how-to/profiling.doctree differ diff --git a/latest/.doctrees/devdoc/index.doctree b/latest/.doctrees/devdoc/index.doctree new file mode 100644 index 000000000..066696c48 Binary files /dev/null and b/latest/.doctrees/devdoc/index.doctree differ diff --git a/latest/.doctrees/environment.pickle b/latest/.doctrees/environment.pickle new file mode 100644 index 000000000..00c8dff0e Binary files /dev/null and b/latest/.doctrees/environment.pickle differ diff --git a/latest/.doctrees/examples/compute-soap.doctree b/latest/.doctrees/examples/compute-soap.doctree new file mode 100644 index 000000000..056a7363e Binary files /dev/null and b/latest/.doctrees/examples/compute-soap.doctree differ diff --git a/latest/.doctrees/examples/first-calculation.doctree b/latest/.doctrees/examples/first-calculation.doctree new file mode 100644 index 000000000..02ca82465 Binary files /dev/null and b/latest/.doctrees/examples/first-calculation.doctree differ diff --git a/latest/.doctrees/examples/index.doctree b/latest/.doctrees/examples/index.doctree new file mode 100644 index 000000000..aad10614e Binary files /dev/null and b/latest/.doctrees/examples/index.doctree differ diff --git a/latest/.doctrees/examples/keys-selection.doctree b/latest/.doctrees/examples/keys-selection.doctree new file mode 100644 index 000000000..c311ce8fc Binary files /dev/null and b/latest/.doctrees/examples/keys-selection.doctree differ diff --git a/latest/.doctrees/examples/le-basis.doctree b/latest/.doctrees/examples/le-basis.doctree new file mode 100644 index 000000000..cb75d8779 Binary files /dev/null and b/latest/.doctrees/examples/le-basis.doctree differ diff --git a/latest/.doctrees/examples/long-range-descriptor.doctree b/latest/.doctrees/examples/long-range-descriptor.doctree new file mode 100644 index 000000000..0a853fa43 Binary files /dev/null and b/latest/.doctrees/examples/long-range-descriptor.doctree differ diff --git a/latest/.doctrees/examples/profiling.doctree b/latest/.doctrees/examples/profiling.doctree new file mode 100644 index 000000000..29c889a35 Binary files /dev/null and b/latest/.doctrees/examples/profiling.doctree differ diff --git a/latest/.doctrees/examples/property-selection.doctree b/latest/.doctrees/examples/property-selection.doctree new file mode 100644 index 000000000..5f2991ee6 Binary files /dev/null and b/latest/.doctrees/examples/property-selection.doctree differ diff --git a/latest/.doctrees/examples/sample-selection.doctree b/latest/.doctrees/examples/sample-selection.doctree new file mode 100644 index 000000000..cb455f08f Binary files /dev/null and b/latest/.doctrees/examples/sample-selection.doctree differ diff --git a/latest/.doctrees/examples/sg_execution_times.doctree b/latest/.doctrees/examples/sg_execution_times.doctree new file mode 100644 index 000000000..c06c023fd Binary files /dev/null and b/latest/.doctrees/examples/sg_execution_times.doctree differ diff --git a/latest/.doctrees/examples/splined-radial-integral.doctree b/latest/.doctrees/examples/splined-radial-integral.doctree new file mode 100644 index 000000000..891d37e16 Binary files /dev/null and b/latest/.doctrees/examples/splined-radial-integral.doctree differ diff --git a/latest/.doctrees/examples/understanding-hypers.doctree b/latest/.doctrees/examples/understanding-hypers.doctree new file mode 100644 index 000000000..38a1a9ed1 Binary files /dev/null and b/latest/.doctrees/examples/understanding-hypers.doctree differ diff --git a/latest/.doctrees/explanations/concepts.doctree b/latest/.doctrees/explanations/concepts.doctree new file mode 100644 index 000000000..c2fe6a6f0 Binary files /dev/null and b/latest/.doctrees/explanations/concepts.doctree differ diff --git a/latest/.doctrees/explanations/index.doctree b/latest/.doctrees/explanations/index.doctree new file mode 100644 index 000000000..6df25970d Binary files /dev/null and b/latest/.doctrees/explanations/index.doctree differ diff --git a/latest/.doctrees/explanations/rotation_adapted.doctree b/latest/.doctrees/explanations/rotation_adapted.doctree new file mode 100644 index 000000000..f01b4dd40 Binary files /dev/null and b/latest/.doctrees/explanations/rotation_adapted.doctree differ diff --git a/latest/.doctrees/explanations/soap.doctree b/latest/.doctrees/explanations/soap.doctree new file mode 100644 index 000000000..0b0a5b563 Binary files /dev/null and b/latest/.doctrees/explanations/soap.doctree differ diff --git a/latest/.doctrees/get-started/index.doctree b/latest/.doctrees/get-started/index.doctree new file mode 100644 index 000000000..04aacf08e Binary files /dev/null and b/latest/.doctrees/get-started/index.doctree differ diff --git a/latest/.doctrees/get-started/installation.doctree b/latest/.doctrees/get-started/installation.doctree new file mode 100644 index 000000000..bf6cf7e45 Binary files /dev/null and b/latest/.doctrees/get-started/installation.doctree differ diff --git a/latest/.doctrees/get-started/rascaline.doctree b/latest/.doctrees/get-started/rascaline.doctree new file mode 100644 index 000000000..24afe3c92 Binary files /dev/null and b/latest/.doctrees/get-started/rascaline.doctree differ diff --git a/latest/.doctrees/get-started/tutorials.doctree b/latest/.doctrees/get-started/tutorials.doctree new file mode 100644 index 000000000..db377a4f5 Binary files /dev/null and b/latest/.doctrees/get-started/tutorials.doctree differ diff --git a/latest/.doctrees/how-to/computing-soap.doctree b/latest/.doctrees/how-to/computing-soap.doctree new file mode 100644 index 000000000..196bcc4e4 Binary files /dev/null and b/latest/.doctrees/how-to/computing-soap.doctree differ diff --git a/latest/.doctrees/how-to/index.doctree b/latest/.doctrees/how-to/index.doctree new file mode 100644 index 000000000..2f46f9dac Binary files /dev/null and b/latest/.doctrees/how-to/index.doctree differ diff --git a/latest/.doctrees/how-to/keys-selection.doctree b/latest/.doctrees/how-to/keys-selection.doctree new file mode 100644 index 000000000..465841b23 Binary files /dev/null and b/latest/.doctrees/how-to/keys-selection.doctree differ diff --git a/latest/.doctrees/how-to/le-basis.doctree b/latest/.doctrees/how-to/le-basis.doctree new file mode 100644 index 000000000..501736198 Binary files /dev/null and b/latest/.doctrees/how-to/le-basis.doctree differ diff --git a/latest/.doctrees/how-to/long-range.doctree b/latest/.doctrees/how-to/long-range.doctree new file mode 100644 index 000000000..99ab5ea56 Binary files /dev/null and b/latest/.doctrees/how-to/long-range.doctree differ diff --git a/latest/.doctrees/how-to/property-selection.doctree b/latest/.doctrees/how-to/property-selection.doctree new file mode 100644 index 000000000..5fdc5b99e Binary files /dev/null and b/latest/.doctrees/how-to/property-selection.doctree differ diff --git a/latest/.doctrees/how-to/sample-selection.doctree b/latest/.doctrees/how-to/sample-selection.doctree new file mode 100644 index 000000000..e8c419c8a Binary files /dev/null and b/latest/.doctrees/how-to/sample-selection.doctree differ diff --git a/latest/.doctrees/how-to/splined-radial-integral.doctree b/latest/.doctrees/how-to/splined-radial-integral.doctree new file mode 100644 index 000000000..c99bf89d8 Binary files /dev/null and b/latest/.doctrees/how-to/splined-radial-integral.doctree differ diff --git a/latest/.doctrees/index.doctree b/latest/.doctrees/index.doctree new file mode 100644 index 000000000..2c8075b23 Binary files /dev/null and b/latest/.doctrees/index.doctree differ diff --git a/latest/.doctrees/references/api/c/calculators.doctree b/latest/.doctrees/references/api/c/calculators.doctree new file mode 100644 index 000000000..2205c017a Binary files /dev/null and b/latest/.doctrees/references/api/c/calculators.doctree differ diff --git a/latest/.doctrees/references/api/c/index.doctree b/latest/.doctrees/references/api/c/index.doctree new file mode 100644 index 000000000..7ad2af467 Binary files /dev/null and b/latest/.doctrees/references/api/c/index.doctree differ diff --git a/latest/.doctrees/references/api/c/misc.doctree b/latest/.doctrees/references/api/c/misc.doctree new file mode 100644 index 000000000..a14659723 Binary files /dev/null and b/latest/.doctrees/references/api/c/misc.doctree differ diff --git a/latest/.doctrees/references/api/c/systems.doctree b/latest/.doctrees/references/api/c/systems.doctree new file mode 100644 index 000000000..e537c935b Binary files /dev/null and b/latest/.doctrees/references/api/c/systems.doctree differ diff --git a/latest/.doctrees/references/api/cxx/calculators.doctree b/latest/.doctrees/references/api/cxx/calculators.doctree new file mode 100644 index 000000000..7312aea35 Binary files /dev/null and b/latest/.doctrees/references/api/cxx/calculators.doctree differ diff --git a/latest/.doctrees/references/api/cxx/index.doctree b/latest/.doctrees/references/api/cxx/index.doctree new file mode 100644 index 000000000..b5c68d4da Binary files /dev/null and b/latest/.doctrees/references/api/cxx/index.doctree differ diff --git a/latest/.doctrees/references/api/cxx/misc.doctree b/latest/.doctrees/references/api/cxx/misc.doctree new file mode 100644 index 000000000..76b5fbcf2 Binary files /dev/null and b/latest/.doctrees/references/api/cxx/misc.doctree differ diff --git a/latest/.doctrees/references/api/cxx/systems.doctree b/latest/.doctrees/references/api/cxx/systems.doctree new file mode 100644 index 000000000..68780a338 Binary files /dev/null and b/latest/.doctrees/references/api/cxx/systems.doctree differ diff --git a/latest/.doctrees/references/api/index.doctree b/latest/.doctrees/references/api/index.doctree new file mode 100644 index 000000000..1df67a664 Binary files /dev/null and b/latest/.doctrees/references/api/index.doctree differ diff --git a/latest/.doctrees/references/api/python/calculators.doctree b/latest/.doctrees/references/api/python/calculators.doctree new file mode 100644 index 000000000..951fcdafe Binary files /dev/null and b/latest/.doctrees/references/api/python/calculators.doctree differ diff --git a/latest/.doctrees/references/api/python/index.doctree b/latest/.doctrees/references/api/python/index.doctree new file mode 100644 index 000000000..36ce2432e Binary files /dev/null and b/latest/.doctrees/references/api/python/index.doctree differ diff --git a/latest/.doctrees/references/api/python/misc.doctree b/latest/.doctrees/references/api/python/misc.doctree new file mode 100644 index 000000000..acdeff54e Binary files /dev/null and b/latest/.doctrees/references/api/python/misc.doctree differ diff --git a/latest/.doctrees/references/api/python/systems.doctree b/latest/.doctrees/references/api/python/systems.doctree new file mode 100644 index 000000000..5e5edeb2b Binary files /dev/null and b/latest/.doctrees/references/api/python/systems.doctree differ diff --git a/latest/.doctrees/references/api/python/utils/atomic-density.doctree b/latest/.doctrees/references/api/python/utils/atomic-density.doctree new file mode 100644 index 000000000..2700d71c5 Binary files /dev/null and b/latest/.doctrees/references/api/python/utils/atomic-density.doctree differ diff --git a/latest/.doctrees/references/api/python/utils/clebsch-gordan.doctree b/latest/.doctrees/references/api/python/utils/clebsch-gordan.doctree new file mode 100644 index 000000000..6c75b5b59 Binary files /dev/null and b/latest/.doctrees/references/api/python/utils/clebsch-gordan.doctree differ diff --git a/latest/.doctrees/references/api/python/utils/index.doctree b/latest/.doctrees/references/api/python/utils/index.doctree new file mode 100644 index 000000000..1effb49f4 Binary files /dev/null and b/latest/.doctrees/references/api/python/utils/index.doctree differ diff --git a/latest/.doctrees/references/api/python/utils/power-spectrum.doctree b/latest/.doctrees/references/api/python/utils/power-spectrum.doctree new file mode 100644 index 000000000..87aaa2be6 Binary files /dev/null and b/latest/.doctrees/references/api/python/utils/power-spectrum.doctree differ diff --git a/latest/.doctrees/references/api/python/utils/radial-basis.doctree b/latest/.doctrees/references/api/python/utils/radial-basis.doctree new file mode 100644 index 000000000..d32cd32c7 Binary files /dev/null and b/latest/.doctrees/references/api/python/utils/radial-basis.doctree differ diff --git a/latest/.doctrees/references/api/python/utils/splines.doctree b/latest/.doctrees/references/api/python/utils/splines.doctree new file mode 100644 index 000000000..e2d140c0e Binary files /dev/null and b/latest/.doctrees/references/api/python/utils/splines.doctree differ diff --git a/latest/.doctrees/references/api/rust.doctree b/latest/.doctrees/references/api/rust.doctree new file mode 100644 index 000000000..46e3097a8 Binary files /dev/null and b/latest/.doctrees/references/api/rust.doctree differ diff --git a/latest/.doctrees/references/api/torch/calculators.doctree b/latest/.doctrees/references/api/torch/calculators.doctree new file mode 100644 index 000000000..5461460d5 Binary files /dev/null and b/latest/.doctrees/references/api/torch/calculators.doctree differ diff --git a/latest/.doctrees/references/api/torch/cxx/calculators.doctree b/latest/.doctrees/references/api/torch/cxx/calculators.doctree new file mode 100644 index 000000000..066f6aa8d Binary files /dev/null and b/latest/.doctrees/references/api/torch/cxx/calculators.doctree differ diff --git a/latest/.doctrees/references/api/torch/cxx/index.doctree b/latest/.doctrees/references/api/torch/cxx/index.doctree new file mode 100644 index 000000000..5025dfc1e Binary files /dev/null and b/latest/.doctrees/references/api/torch/cxx/index.doctree differ diff --git a/latest/.doctrees/references/api/torch/index.doctree b/latest/.doctrees/references/api/torch/index.doctree new file mode 100644 index 000000000..38d651026 Binary files /dev/null and b/latest/.doctrees/references/api/torch/index.doctree differ diff --git a/latest/.doctrees/references/api/torch/systems.doctree b/latest/.doctrees/references/api/torch/systems.doctree new file mode 100644 index 000000000..a7ffc00d8 Binary files /dev/null and b/latest/.doctrees/references/api/torch/systems.doctree differ diff --git a/latest/.doctrees/references/api/torch/utils/clebsch-gordan.doctree b/latest/.doctrees/references/api/torch/utils/clebsch-gordan.doctree new file mode 100644 index 000000000..e85b3c6d0 Binary files /dev/null and b/latest/.doctrees/references/api/torch/utils/clebsch-gordan.doctree differ diff --git a/latest/.doctrees/references/api/torch/utils/index.doctree b/latest/.doctrees/references/api/torch/utils/index.doctree new file mode 100644 index 000000000..050cdb907 Binary files /dev/null and b/latest/.doctrees/references/api/torch/utils/index.doctree differ diff --git a/latest/.doctrees/references/api/torch/utils/power-spectrum.doctree b/latest/.doctrees/references/api/torch/utils/power-spectrum.doctree new file mode 100644 index 000000000..eac000a0d Binary files /dev/null and b/latest/.doctrees/references/api/torch/utils/power-spectrum.doctree differ diff --git a/latest/.doctrees/references/calculators/atomic-composition.doctree b/latest/.doctrees/references/calculators/atomic-composition.doctree new file mode 100644 index 000000000..717f0860d Binary files /dev/null and b/latest/.doctrees/references/calculators/atomic-composition.doctree differ diff --git a/latest/.doctrees/references/calculators/index.doctree b/latest/.doctrees/references/calculators/index.doctree new file mode 100644 index 000000000..b722c1f7d Binary files /dev/null and b/latest/.doctrees/references/calculators/index.doctree differ diff --git a/latest/.doctrees/references/calculators/lode-spherical-expansion.doctree b/latest/.doctrees/references/calculators/lode-spherical-expansion.doctree new file mode 100644 index 000000000..c79259b22 Binary files /dev/null and b/latest/.doctrees/references/calculators/lode-spherical-expansion.doctree differ diff --git a/latest/.doctrees/references/calculators/neighbor-list.doctree b/latest/.doctrees/references/calculators/neighbor-list.doctree new file mode 100644 index 000000000..af3ac43e9 Binary files /dev/null and b/latest/.doctrees/references/calculators/neighbor-list.doctree differ diff --git a/latest/.doctrees/references/calculators/soap-power-spectrum.doctree b/latest/.doctrees/references/calculators/soap-power-spectrum.doctree new file mode 100644 index 000000000..2b19a783d Binary files /dev/null and b/latest/.doctrees/references/calculators/soap-power-spectrum.doctree differ diff --git a/latest/.doctrees/references/calculators/soap-radial-spectrum.doctree b/latest/.doctrees/references/calculators/soap-radial-spectrum.doctree new file mode 100644 index 000000000..fb4699f60 Binary files /dev/null and b/latest/.doctrees/references/calculators/soap-radial-spectrum.doctree differ diff --git a/latest/.doctrees/references/calculators/sorted-distances.doctree b/latest/.doctrees/references/calculators/sorted-distances.doctree new file mode 100644 index 000000000..0d897969e Binary files /dev/null and b/latest/.doctrees/references/calculators/sorted-distances.doctree differ diff --git a/latest/.doctrees/references/calculators/spherical-expansion-by-pair.doctree b/latest/.doctrees/references/calculators/spherical-expansion-by-pair.doctree new file mode 100644 index 000000000..ffbaab4bf Binary files /dev/null and b/latest/.doctrees/references/calculators/spherical-expansion-by-pair.doctree differ diff --git a/latest/.doctrees/references/calculators/spherical-expansion.doctree b/latest/.doctrees/references/calculators/spherical-expansion.doctree new file mode 100644 index 000000000..f5e7a2302 Binary files /dev/null and b/latest/.doctrees/references/calculators/spherical-expansion.doctree differ diff --git a/latest/.doctrees/references/index.doctree b/latest/.doctrees/references/index.doctree new file mode 100644 index 000000000..fa1351892 Binary files /dev/null and b/latest/.doctrees/references/index.doctree differ diff --git a/latest/_downloads/081634a43959105f7f41a7682e76d405/property-selection.ipynb b/latest/_downloads/081634a43959105f7f41a7682e76d405/property-selection.ipynb new file mode 100644 index 000000000..9503c4a54 --- /dev/null +++ b/latest/_downloads/081634a43959105f7f41a7682e76d405/property-selection.ipynb @@ -0,0 +1,248 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n# Property Selection\n\n.. start-body\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import chemfiles\nimport numpy as np\nfrom metatensor import Labels, MetatensorError, TensorBlock, TensorMap\nfrom skmatter.feature_selection import FPS\n\nfrom rascaline import SoapPowerSpectrum" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "First we load the dataset with chemfiles\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "with chemfiles.Trajectory(\"dataset.xyz\") as trajectory:\n frames = [f for f in trajectory]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "and define the hyper parameters of the representation\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "HYPER_PARAMETERS = {\n \"cutoff\": 5.0,\n \"max_radial\": 6,\n \"max_angular\": 4,\n \"atomic_gaussian_width\": 0.3,\n \"center_atom_weight\": 1.0,\n \"radial_basis\": {\n \"Gto\": {},\n },\n \"cutoff_function\": {\n \"ShiftedCosine\": {\"width\": 0.5},\n },\n}\n\ncalculator = SoapPowerSpectrum(**HYPER_PARAMETERS)\n\ndescriptor = calculator.compute(frames)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The selections for feature can be a set of ``Labels``, in which case the names\nof the labels must be a subset of the names of the properties produced by the\ncalculator. You can see the default set of names with:\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "print(\"property names:\", descriptor.property_names)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can use a subset of these names to define a selection. In this case, only\nproperties matching the labels in this selection will be used by rascaline\n(here, only properties with ``l = 0`` will be used)\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "selection = Labels(\n names=[\"l\"],\n values=np.array([[0]]),\n)\nselected_descriptor = calculator.compute(frames, selected_properties=selection)\n\nselected_descriptor = selected_descriptor.keys_to_samples(\"center_type\")\nselected_descriptor = selected_descriptor.keys_to_properties(\n [\"neighbor_1_type\", \"neighbor_2_type\"]\n)\n\nproperties = selected_descriptor.block().properties" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We expect to get `[0]` as the list of `l` properties\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "print(f\"we have the following angular components: {np.unique(properties['l'])}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The previous selection method uses the same selection for all blocks. If you\ncan to use different selection for different blocks, you should use a\n``TensorMap`` to create your selection\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "selected_descriptor = calculator.compute(frames, selected_properties=selection)\ndescriptor_for_comparison = calculator.compute(\n frames, selected_properties=selected_descriptor\n)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The descriptor had 180 properties stored in the first block, the\nselected_descriptor had 36. So ``descriptor_for_comparison`` will also have 36\nproperties.\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "print(\"shape of first block initially:\", descriptor.block(0).values.shape)\nprint(\"shape of first block of reference:\", selected_descriptor.block(0).values.shape)\nprint(\n \"shape of first block after selection:\",\n descriptor_for_comparison.block(0).values.shape,\n)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The ``TensorMap`` format allows us to select different features within each\nblock, and then construct a general matrix of features. We can select the most\nsignificant features using FPS, which selects features based on the distance\nbetween them. The following code snippet selects the 10 most important\nfeatures in each block, then constructs a TensorMap containing this selection,\nand calculates the final matrix of features for it.\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "def fps_feature_selection(descriptor, n_to_select):\n \"\"\"\n Select ``n_to_select`` features block by block in the ``descriptor``, using\n Farthest Point Sampling to do the selection; and return a ``TensorMap`` with\n the right structure to be used as properties selection with rascaline calculators\n \"\"\"\n blocks = []\n for block in descriptor:\n # create a separate FPS selector for each block\n fps = FPS(n_to_select=n_to_select)\n mask = fps.fit(block.values).get_support()\n selected_properties = Labels(\n names=block.properties.names,\n values=block.properties.values[mask],\n )\n # The only important data here is the properties, so we create empty\n # sets of samples and components.\n blocks.append(\n TensorBlock(\n values=np.empty((1, len(selected_properties))),\n samples=Labels.single(),\n components=[],\n properties=selected_properties,\n )\n )\n\n return TensorMap(descriptor.keys, blocks)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can then apply this function to subselect according to the data contained\nin a descriptor\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "selection = fps_feature_selection(descriptor, n_to_select=10)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "and use the selection with rascaline, potentially running the calculation on a\ndifferent set of systems\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "selected_descriptor = calculator.compute(frames, selected_properties=selection)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Note that in this case it is no longer possible to have a single feature\nmatrix, because each block will have its own properties.\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "try:\n selected_descriptor.keys_to_samples(\"center_type\")\nexcept MetatensorError as err:\n print(err)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + ".. end-body\n\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.7" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file diff --git a/latest/_downloads/08b985c96711d158571cd9dd7ef9d241/understanding-hypers.ipynb b/latest/_downloads/08b985c96711d158571cd9dd7ef9d241/understanding-hypers.ipynb new file mode 100644 index 000000000..9b9c5ce2a --- /dev/null +++ b/latest/_downloads/08b985c96711d158571cd9dd7ef9d241/understanding-hypers.ipynb @@ -0,0 +1,273 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n\n# Changing SOAP hyper parameters\n\nIn the first `tutorialYou might want to save the spline points using :py:func:`json.dump` to a file and\n load them with :py:func:`json.load` later without recalculating them. Saving them is\n especially useful if the spline calculations are expensive, i.e., if you increase\n the ``spline_accuracy``.
Small residual values may stems from the contribution of the periodic images. You\n can verify and reduce those contributions by either increasing the cell and/or\n increase the ``potential_exponent``.