-
Notifications
You must be signed in to change notification settings - Fork 2
Spherical cell list #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mthran
wants to merge
18
commits into
trunk
Choose a base branch
from
spherical_cell_list
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Spherical cell list #313
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
04fc6c7
add spherical_vec_cell
mthran a1f11be
implement checkerboard for spherical
mthran 2aad1bc
construct_space_indices_by_color for HypercuboidCheckerboard<4>
mthran 5d97907
switch norm check to norm squared check in from_cartesian_coordinates…
mthran 915a96f
test code for SphericalVecCell
mthran 3f2e0d3
docs for SphericalVecCell
mthran f1f27a7
add new `ClosedSpherical` boundary`
mthran af1f41e
remove duplicate functions from VecCell
mthran eafd4ea
docs
mthran bd1bbc4
Merge branch 'trunk' into spherical_cell_list
mthran 03b5b95
add serde derive for ClosedSpherical
mthran 111613c
Merge branch 'trunk' into spherical_cell_list
joaander 07e1cc4
cargo fmt
joaander 8d9a10b
Avoid code duplication for HypercuboidCheckerboard
joaander 3d42bff
cargo fmt
joaander c5efd6c
avoid duplicate code in spherical_vec_cell.rs
mthran a5de993
renamed ClosedSpherical to OpenSpherical
mthran fb93ab4
clippy
mthran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright (c) 2024-2026 The Regents of the University of Michigan. | ||
| // Part of hoomd-rs, released under the BSD 3-Clause License. | ||
|
|
||
| //! Implement `ClosedSpherical` | ||
|
|
||
| use arrayvec::ArrayVec; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use super::{Error, GenerateGhosts, MAX_GHOSTS, Wrap}; | ||
| use crate::property::Position; | ||
| use hoomd_manifold::Spherical; | ||
|
|
||
| /// [`ClosedSpherical<N>`] implements a hypercubic box enclosing a unit-radius | ||
| /// $`(N-1)`$-sphere. Use `ClosedSpherical` alongside [`SphericalVecCell`] to | ||
| /// implement [`ParallelSweep`] for [`Spherical`] bodies. `ClosedSpherical` is | ||
| /// otherwise functionally identical to using [`Open`] for [`Spherical`] | ||
| /// simulations. | ||
| /// | ||
| /// # Example | ||
| /// ``` | ||
| /// use hoomd_microstate::boundary::ClosedSpherical; | ||
| /// | ||
| /// # fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
| /// let closed_spherical: ClosedSpherical<3> = ClosedSpherical {}; | ||
| /// # Ok(()) | ||
| /// # } | ||
| /// ``` | ||
| /// | ||
| /// Similar to [`Closed`], `ClosedSpherical` does not wrap bodies and sites, | ||
| /// nor does it generate ghost sites. However, unlike [`Closed`], | ||
| /// `ClosedSpherical` does not implement `IsPointInside`, `MapPoint`, | ||
| /// `Scale`, or `Volume`, as these methods are unrelated to the boundary | ||
| /// conditions for `Spherical` simulations. | ||
| /// | ||
| /// [`SphericalVecCell`]: hoomd_spatial::SphericalVecCell; | ||
| /// [`ParallelSweep`]: hoomd_mc::ParallelSweep; | ||
| /// [`Spherical`]: hoomd_manifold::Spherical; | ||
| #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
| pub struct ClosedSpherical<const N: usize> {} | ||
|
|
||
| impl<BS, const N: usize> Wrap<BS> for ClosedSpherical<N> | ||
| where | ||
| BS: Position<Position = Spherical<N>>, | ||
| { | ||
| #[inline] | ||
| fn wrap(&self, properties: BS) -> Result<BS, Error> { | ||
| Ok(properties) | ||
| } | ||
| } | ||
|
|
||
| impl<S, const N: usize> GenerateGhosts<S> for ClosedSpherical<N> | ||
| where | ||
| S: Default, | ||
| { | ||
| #[inline] | ||
| fn maximum_interaction_range(&self) -> f64 { | ||
| std::f64::consts::PI | ||
| } | ||
| #[inline] | ||
| fn generate_ghosts(&self, _site_properties: &S) -> ArrayVec<S, MAX_GHOSTS> { | ||
| ArrayVec::new() | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I removed the code duplication by calling the existing method with the Cartesian coordinates of the spherical point.