librascal
librascal copied to clipboard
Sign errors in some SphericalCovariants components
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.
This is on a BaTiO3 single frame, only the first (Ba) atom environment, but the pattern is consistent across different configurations and species pairs:
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.
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:
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...?).