cersonsky-lab / AniSOAP

Library for computing anisotropy extension to SOAP descriptors
Apache License 2.0
8 stars 1 forks source link

Solid harm prefact #38

Closed arthur-lin1027 closed 6 months ago

arthur-lin1027 commented 7 months ago

The inner product obtaining our expansion coefficients erroneously contained the solid harmonic prefactor. I added code to divide through by the prefactor. This causes the expansion coefficients to actually converge to the underlying atomic gaussian, which is necessary.

I currently cleaning up an example notebook that shows that the expansion of an isotropic gaussian does indeed converge.

However, an anisotropic gaussian does not yet converge... I have some suspicions.

curiosity54 commented 6 months ago

hey, i had a rather quick look, but was the purpose here to modify the density expansion coefficients? I am afraid that adding the additional 1/sqrt{2l+1} affects how higher order features are constructed down the line could you perhaps give me an overview of how the density expansion is now normalized?

arthur-lin1027 commented 6 months ago

hey, i had a rather quick look, but was the purpose here to modify the density expansion coefficients? I am afraid that adding the additional 1/sqrt{2l+1} affects how higher order features are constructed down the line could you perhaps give me an overview of how the density expansion is now normalized?

Hi @curiosity54 ,

I made these changes under the assumption that a linear combination of expansion coefficients and basis functions should recreate the underlying gaussian. I identified that this 1/sqrt(2l+1) factor was erroneously included and needed to be divided out in order to recreate the underlying gaussian.

arthur-lin1027 commented 6 months ago

To reiterate one more time, I'm trying to unify equations 15 and 16 within the AniSOAP paper, but right below equation 16, we make an incorrect statement saying that

with $R_l^m(r) = r^l * Y_l^m(\hat{r})$

This is incorrect, because actually $R_l^m(r) = \sqrt{\frac{4\pi}{2l+1}}r^l Y_l^m(\hat{r})$. Hence I need to divide out this factor, because in the code, we are calculating $R_l^m$, but we actually want $r^l Y_l^m(\hat{r})$ (eqn 15 in the paper)

curiosity54 commented 6 months ago

okay, thank you! i was a little unsure of the prefactor being there in the definition of real-valued spherical harmonics but all good if this makes the anisoap and isotropic gaussian expansion consistent. (ps. incidentally, this made me realize there's a typo in Eq 17, l' must be equal to l)

rosecers commented 6 months ago

That’s fine, only a suggestion

On Apr 30, 2024, at 6:10 PM, arthur-lin1027 @.***> wrote:

@arthur-lin1027 commented on this pull request.

In anisoap/representations/ellipsoidal_density_projection.py https://github.com/cersonsky-lab/AniSOAP/pull/38#discussion_r1585643426:

  • solid_harm_prefact = np.sqrt((4 np.pi) / (np.arange(lmax + 1) 2 + 1))
  • scaled_sph_to_cart = []
  • for l in range(lmax + 1):
  • scaled_sph_to_cart.append(sph_to_cart[l] / solid_harm_prefact[l]) cannot actually make this change, because sph_to_cart is a list of 5-dimensional arrays that change depending on l. np.divide cannot understand how to unify the dimensions so I just use a for loop, plus it's more explicit here.

— Reply to this email directly, view it on GitHub https://github.com/cersonsky-lab/AniSOAP/pull/38#discussion_r1585643426, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALKVP3WED2WUGY6YX6IK7LLZAAQGBAVCNFSM6AAAAABGOL3ILSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAMZSG43DSNJRHE. You are receiving this because your review was requested.