Spherical cell list#313
Conversation
… for Spherical<N>
joaander
left a comment
There was a problem hiding this comment.
I haven't completed a full review yet. Here is what I have so far.
I question whether ClosedSpherical is the right name. Technically, the boundary is open as it allows bodies to move over the entire space. With that established, the problematic implementation is the blanket implementation of GenerateGhosts<S> for Open. Open does not depend on the vector space, so there is no way to express the maximum interaction range correctly. Also, the Cover doesn't make sense on open boundaries that are unbounded.
I don't have a concrete suggestion to fix this right now. Microstate uses Open as a default, so we can't just make Open generic. I guess we could use a suitable synonym of Open so that we could replace ClosedSpherical<N> with OpenSynonym<Spherical<N>>. Somehow, that synonym should indicate that the boundary is both open in once sense and bounded in another... That type could then naturally be used to express e.g. cylindrical coordinate spaces as well as spherical ones.
I reduced code duplication in HypercuboidCheckerboard. I haven't had a chance to review spherical_vec_cell.rs in full, but there must be some way that we can avoid all the code duplication there. Either via the same method I used in HypercuboidCheckerboard or by implementing inheritance via composition (where SphericalVecCell holds a VecCell as a field and directs most method calls to it internally).
| impl<const N: usize> Checkerboard<Spherical<N>> for HypercuboidCheckerboard<N> { | ||
| #[inline] | ||
| fn point_to_space_index(&self, point: &Spherical<N>) -> Option<usize> { | ||
| <Self as Checkerboard<Cartesian<N>>>::point_to_space_index(self, &Cartesian::from(*point.coordinates())) |
There was a problem hiding this comment.
Here I removed the code duplication by calling the existing method with the Cartesian coordinates of the spherical point.
|
On second thought, my previous suggestions regarding I now think we should only rename |
Description
This PR introduces methods and traits necessary to implement cell lists and
ParallelSweepforSphericalsimulations:SphericalVecCellis implemented whose structure is almost identical to the already existingVecCell. Most of the methods and functionality are identical becauseSpherical<N>is embedded in N-dimensional Euclidean space. The search radii forSphericalVecCellmay be specified either using theSphericalgeodesic metric or through the Euclidean metric in the embedding space.vec_cell.rswhich were previously private have been promoted topub(crate)so as to avoid duplicate code inspherical_vec_cell.rs.ClosedSpherical<N>which implementsCover<Spherical<N>>is introduced. This is distinct from the pre-existingClosed<T>boundary because the latter implements methods such asScaleandVolumewhich are irrelevant and potentially misleading inSpherical<N>simulations.Motivation and context
This PR significantly improves the speed of
Spherical<N>simulations, which previously were too slow to run production simulations.How has this been tested?
spherical_vec_cell.rscontains unit tests for the methods which are unique to itself. I have also run simulations forSpherical<3>andSpherical<4>using the new methods and verified that they are consistent with older simulations usingAllPairs.Checklist:
doc/src/credits.md) in the pull request source branch.release-notes.mdfollowing the established format.