Conversation
joaander
reviewed
May 8, 2026
Member
joaander
left a comment
There was a problem hiding this comment.
Thanks! Please address the few suggestions I made and then we can merge this branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces several small changes for
Spherical<3>andSpherical<4>, namely:MetricforSpherical<3>' andSpherical<4>' is modified to clip the argument to the range of [-1.0,1.0].from_versorforSpherical<4>LocalTrialforSpherical<4>based on the exponential mapping of the manifold.Motivation and context
These changes are largely motivated by my own use of hoomd-rs to simulate points on 2- and 3-spheres.
Spherical<N>needed to be clipped because floating point errors sometimes made antipodal points return a distance ofNaninstead of pi.from_versorfunction lends itself to a natural and efficient representation of 3-sphere points. In practice this is helpful for initializing points randomly on the 3-sphere.How has this been tested?
This PR includes unit test functions for all the new functions. I have also been using this branch to run production simulations and have verified that the functions work as expected. For example, thermodynamic quantities calculated from the
Spherical<4>methods reproduce values given by older published simulation resultsChecklist:
doc/src/credits.md) in the pull request source branch.release-notes.mdfollowing the established format.