lab-cosmo / librascal

A scalable and versatile library to generate representations for atomic-scale learning
https://lab-cosmo.github.io/librascal/
GNU Lesser General Public License v2.1
80 stars 20 forks source link

ModuleNotFoundError: No module named 'tutorial_utils' #344

Open hezhengda opened 3 years ago

hezhengda commented 3 years ago

Dear librascal developers,

In the examples, if I open SOAP_example.ipynb and run the first cell. Then it said "ModuleNotFoundError: No module named 'tutorial_utils'", I check the folder there are no file called tutorial_utils. Also there seems no python package with same name. Could you help me understand what I need to do? (install other packages?)

Thanks, Best, Zhengda

Luthaf commented 3 years ago

Hi @hezhengda 👋 ! Thanks for taking the time to open an issue.

The tutorial_utils.py file was removed by @rosecers in #230, and it looks like we forgot to update this notebook after this change.

@max-veit is currently working on improving the examples in #342, and it looks like he already flagged this notebook as outdated.

We will try to update this notebook as soon as possible. In the mean time, you could give a look at more recent notebooks and examples, such as MLIP_example.ipynb. The code does more than just computing SOAP, but starts by doing just that. What are you trying to achieve here? Maybe we can help you directly.

hezhengda commented 3 years ago

Hi Luthaf,

Thanks for the reply. I will look into the MLIP_example, thanks for uploading these excellent tutorials. I'm trying to learn how to use SOAP as a descriptor in my own research.

Luthaf commented 3 years ago

Ok, then getting a matrix of SOAP descriptors should be as simple as

from rascal.representations import SphericalInvariants
import ase
from ase import io

ase.io.read("<your-structure-file.xyz>", ":")

soap = SphericalInvariants(
    soap_type="PowerSpectrum",
    interaction_cutoff=3.5,
    max_radial=6,
    max_angular=6,
    gaussian_sigma_constant=0.3,
    gaussian_sigma_type="Constant",
    cutoff_smooth_width=0.5,
    radial_basis="GTO",
)

managers = soap.transform(frames)
features = managers.get_features(soap)

print(features.shape)  # n_atoms x n_features matrix

Then you can do what you want with the feature matrix!

hezhengda commented 3 years ago

Thanks so much! This will help me a lot.