Spherical Harmonics in Rust#293
Conversation
mthran
left a comment
There was a problem hiding this comment.
Very nice! Other than a couple clarifying questions, this API is consistent with how I would hope to use spherical harmonics.
|
The last major question (and the failing lint) is a readme -- Josh, I see this crate as useful outside |
joaander
left a comment
There was a problem hiding this comment.
Thanks! This is clean and simple. We discussed offline regarding what crate makes the most sense to hold this code.
You could make use of katex math in the documentation to make it more clear and explicit what this code calculates.
Description
Simple and efficient evaluation of spherical harmonics in rust. While a crate for this does exist, it appears to be abandonware and panics for
l > 10.Motivation and context
Evaluation of the Steinhardt order parameters requires spherical harmonics, and the Glotzerlab's current codebase (fsph)for spherical harmonics is not structured to efficiently calculate things like this. With some compile-time generics and some of the new findings from the
sphericartpaper in JCP, I have an approach better-suited to our standard workflow. It provides all positive m values for a compile-time value of L, and can efficiently evaluate both individual and multiple points. A doc example shows a simple Steinhardt calculation, although the real implementation of that should go in hoomd-order or similar.Example implementation of q6
How has this been tested?
Tests against SPHRS for l<=10 compare the actual values, and I have an integration-ish test that tests the completeness relation to measure accumulated numerical error. Offline/mixed-language tests have shown my results are similar accuracy to fsph and sphericcart, but better performance when only a few l values are required.
Checklist:
doc/src/credits.md) in the pull request source branch.release-notes.mdfollowing the established format.