Luthaf / rascaline

Computing representations for atomistic machine learning
https://luthaf.fr/rascaline/
BSD 3-Clause "New" or "Revised" License
44 stars 13 forks source link

Add radial integral for custom densities #298

Closed PicoCentauri closed 4 months ago

PicoCentauri commented 5 months ago

This PR adds the ability to compute the radial integral for custom densities that have a spherical symmetry. Spherical symmetry should apply to all densities and this PR will be especially useful to compute a real space version of a spherical expansion with a LODE density and any basis.

The function computes the double integral numerically using scipy's dblquad function and I expect that this will very slow. Maybe we should add a warning?

TODO


📚 Documentation preview 📚: https://rascaline--298.org.readthedocs.build/en/298/

github-actions[bot] commented 5 months ago

Here is a pre-built version of the code in this pull request: wheels.zip, you can install it locally by unzipping wheels.zip and using pip to install the file matching your system

PicoCentauri commented 5 months ago

The code seems to work and is not horribly slow. We should think about a test system to test that the real space LODE for example is working.

PicoCentauri commented 4 months ago

the notebook looks good to me. imo it would be nicer if we also show a case where an atom exists outside of the cutoff, but the current version does a good job at showing that what needs to happen indeed takes place.

Very good idea. I implemented this in an updated version.

SanggyuChong commented 4 months ago

Thanks again for this wonderful PR. Everything is heading towards the right direction, but I'm afraid the accuracy is still not where it should be. Can you shed some light on where the accuracy bottleneck is? I've played around with spline_accuracy and k_cutoff but have seen no improvement in terms of the "residue" between real space and fourier space for the monomer case.

SanggyuChong commented 4 months ago

So -- never mind what I said up there, further experimentation and a quick chat with @Luthaf have revealed that the residual values could mostly be coming from the periodic images of the monomer. Still looking into this, but can confirm already that this is the primary source of the residue.

I suggest that @PicoCentauri can make a mention of this in the How-to guide, and then with the approving reviews, this gets merged in :+1:

PicoCentauri commented 4 months ago

I suggest that @PicoCentauri can make a mention of this in the How-to guide

Yes, I can add a note that any residual contributions might originate from the periodic images. To verify this you can either scale the box or increase the potential exponent.

Can you shed some light on where the accuracy bottleneck is?

Besides the periodicity: Another thing for the accuracy, we haven't explored at all, are the accuracy options in quad (epsabs and epsrel) itself. The default values are already quite small (1e-8) but we can keep this in mind if accuracy problems appear for splining again.