librascal icon indicating copy to clipboard operation
librascal copied to clipboard

Sign errors in some SphericalCovariants components

Open max-veit opened this issue 3 years ago • 2 comments

I'm using SOAPFAST/TENSOAP as a reference, since it's the code underlying all SA-GPR publications so far. When I compare the spherical covariants (a.k.a. power spectra) computed in librascal with those computed by SOAPFAST, I find that some of the components have the wrong sign compared to SOAPFAST, as illustrated in the attached plots. imageimage

This is on a BaTiO3 single frame, only the first (Ba) atom environment, but the pattern is consistent across different configurations and species pairs: imageimage

That, together with the fact that apparently the +1 and -2 components always get flipped, seem to indicate that there's a sign error in the maths implemented in calculator_spherical_covariants.hh -- possibly having to do with the Wigner 3j symbols. The sign flips are easy enough to fix in post-processing, but I'd rather find the source of the problem.

As for the slight mismatch in the slope of the correct-sign components, I haven't investigated that yet. It may just be small differences in implementation details by that point.

max-veit avatar Apr 13 '21 13:04 max-veit

Yup, so as I expected, removing the (-1)^µ phase from librascal's real spherical harmonics (see #346, new convention implemented in feat/sph_cs_phase) flips both positive and negative µ contributions (for odd µ). The result is that now it's the negative-µ components that have a sign flip with respect to SOAPFAST: imageimage

max-veit avatar May 05 '21 12:05 max-veit

Also found this little treasure trove, commented out: https://github.com/cosmo-epfl/librascal/blob/43a410c6d7cea3d17852e9c8c6fe332ec46f13df/src/rascal/representations/calculator_spherical_covariants.hh#L133-L141

As far as I can tell, the only thing this does differently from what's implemented now is that it switches the wig3j1 and wig3j2 symbols, which differ only in the sign of the m3 term. So effectively this only flips the sign of m3s (but leaves it as it is later on...?).

max-veit avatar May 05 '21 15:05 max-veit