Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
33b4dda
cargo init rsph
janbridley May 19, 2026
3468a57
basic impl of sphericart
janbridley May 19, 2026
804330e
bench
janbridley May 19, 2026
32b5e06
remove vec, test fixes to follow
janbridley May 19, 2026
2fd9bb7
update tests
janbridley May 19, 2026
354ff26
update benches
janbridley May 19, 2026
46a9e85
lint
janbridley May 19, 2026
d886636
test against sphrs
janbridley May 19, 2026
54ef0e0
l^2 prefactors to O(l)
janbridley May 19, 2026
30e98bd
eliminate sm array for scalar
janbridley May 19, 2026
8aae30c
remove cm array as well
janbridley May 19, 2026
c3c3d1c
add rstest for rsph
janbridley May 19, 2026
99afc98
normalized seeds
janbridley May 19, 2026
b0bed63
remove incorrect doc
janbridley May 19, 2026
61bb6e6
[WIP] accuracy
janbridley May 19, 2026
379e552
must use
janbridley May 19, 2026
1a6a893
fix accuracy test
janbridley May 19, 2026
04fe1f2
output wrapper type
janbridley May 19, 2026
e0d44bd
use rstest for test parametrization
janbridley May 19, 2026
4206029
clean up l=1 case
janbridley May 19, 2026
e97b141
Reduce number of sqrts by 1
janbridley May 19, 2026
1745442
Harcoded l=6 for speed of light
janbridley May 19, 2026
0f0c84d
better naming
janbridley May 19, 2026
c363faa
naming
janbridley May 19, 2026
65ac8bf
ls -> l6
janbridley May 19, 2026
fead10c
complex harmonics
janbridley May 19, 2026
7faacf6
Move constant into the prefactor
janbridley May 19, 2026
9631106
use num_traits complex64
janbridley May 19, 2026
8af8d6e
clippy --fix
janbridley May 19, 2026
1a56757
cargo +nightly fmt
janbridley May 19, 2026
9716e17
package.dscription
janbridley May 19, 2026
eb7b2b4
clippy lint default naming
janbridley May 19, 2026
4e0c040
clean up docs
janbridley May 19, 2026
e449fa4
more docs
janbridley May 19, 2026
3b94886
naming
janbridley May 19, 2026
e93d6d7
Simplify how we store intermediates
janbridley May 19, 2026
4fa1356
Move functionality into struct to reuse values
janbridley May 19, 2026
94f8453
add missing inline
janbridley May 19, 2026
94b68ef
naming
janbridley May 19, 2026
1406d54
Doc
janbridley May 19, 2026
f911485
fix ..L -> ..=L in docs
janbridley May 19, 2026
363f6d3
move output type to end of file
janbridley May 19, 2026
5c42975
add missing inline
janbridley May 19, 2026
79c40b5
clean up tests with approxim
janbridley May 19, 2026
d993400
more approxim
janbridley May 19, 2026
0e244eb
Remove println!
janbridley May 19, 2026
0bcd7ba
tighten tol
janbridley May 19, 2026
10709a8
clean up sphrs test
janbridley May 19, 2026
b792515
fix test
janbridley May 19, 2026
ff94eca
struct fields and derives
janbridley May 19, 2026
e49c52b
WIP on crate docs
janbridley May 19, 2026
5fdd11e
WIP on doc example
janbridley May 19, 2026
b72f38d
Swap to Into<[f64; 3]> for implicit Cartesian support
janbridley May 19, 2026
87dd5d0
add len and is_empty per clippy lint
janbridley May 19, 2026
b5194f1
Implement an `Iter` wrapper.
janbridley May 19, 2026
26ea0e3
Test iterator method
janbridley May 19, 2026
eb6dabb
Implement Display
janbridley May 19, 2026
a271269
Fix 12 decimal places in Display for simplicity
janbridley May 19, 2026
944b447
remove space around +/- for simplicity
janbridley May 19, 2026
3bba7d6
remove must_use per lint
janbridley May 19, 2026
7c7010a
derive debug
janbridley May 19, 2026
4ebd74e
test for zonal harmonic
janbridley May 19, 2026
5725818
less trivial example
janbridley May 19, 2026
08df519
closed form for y60
janbridley May 19, 2026
442b157
Add doc examples for the output container
janbridley May 19, 2026
3a04b12
Work in progress on q6 example
janbridley May 19, 2026
1ad19fe
Mostly-done q6, needs tests
janbridley May 19, 2026
41763a9
style
janbridley May 19, 2026
a9c9e7f
cargo clippy --fix
janbridley May 19, 2026
94964b1
fix use of cartesian
janbridley May 19, 2026
1bdfc6f
Add FCC example
janbridley May 19, 2026
51f786b
doc example and cleanup for SH struct
janbridley May 19, 2026
a9f8795
Remove fancy destructuring code, just use array input
janbridley May 19, 2026
bcae0bd
Implement IntoIterator
janbridley May 19, 2026
d280a68
test intoiterator
janbridley May 19, 2026
929a554
prek
janbridley May 19, 2026
c669c5c
clippy --fix
janbridley May 19, 2026
732bb16
address lint?
janbridley May 19, 2026
78753f6
didn't fix the lint, hmm
janbridley May 19, 2026
c8b6d19
Address comments from rust meeting re: iterators and neg_m
janbridley May 27, 2026
6dd7138
Clean up tests
janbridley May 27, 2026
38dc333
clippy lints
janbridley May 27, 2026
4c66744
clippy lints
janbridley May 27, 2026
87d16f9
clippy display lint
janbridley May 27, 2026
2da3f9a
Lints
janbridley May 27, 2026
17ff781
Add API for spherical coordinates
janbridley May 27, 2026
38f3001
Use `unit` to validate points are on the sphere.
janbridley May 27, 2026
bfc7c9b
Naming
janbridley May 27, 2026
9a8b759
rsph -> hoomd-order
janbridley May 27, 2026
83aa07c
Clean up benchmark
janbridley May 27, 2026
ceaa7fc
fmt
janbridley May 27, 2026
dc0cab1
Add missing README
janbridley May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 84 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ members = ["benchmarks",
"hoomd-vector",
"tools/build-wasm-doc-examples",
"hoomd-rand"
]
, "hoomd-order"]

# Include only core hoomd simulation crates by default so that `cargo build`,
# `cargo test` and similar commands operate only on the core code by default.
Expand Down Expand Up @@ -74,6 +74,7 @@ assert2 = "=0.4.0"
divan = "=0.1.21"
paste = "=1.0.15"
rand_sfc = "=0.2.0"
sphrs = "=0.2.2"
rstest = "=0.26.1"
tempfile = "=3.27.0"
strum = "=0.28.0"
Expand All @@ -97,9 +98,10 @@ parquet_derive = { version = "58.0.0", default-features=false }

# Dependencies exposed via Public APIs.
anyhow = "1.0.100"
approxim = "0.6.6"
approxim = {version = "0.6.6", features = ["num-complex"]}
arrayvec = { version = "0.7.6", features = ["serde"] }
num = { version = "0.4.3", features = ["serde"] }
num-complex = "0.4"
rand = { version = "0.10.0", default-features=false, features = ["std", "std_rng"] }
serde = { version = "1.0.228", features = ["derive"]}
thiserror = "2.0.12"
Expand Down
30 changes: 30 additions & 0 deletions hoomd-order/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "hoomd-order"
description = "Evaluate Spherical Harmonics at a given Cartesian point."
version.workspace = true
edition.workspace = true
rust-version.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true

[dependencies]
hoomd-vector = "1.1.0"
num-complex.workspace = true

[dev-dependencies]
approxim.workspace = true
divan.workspace = true
rand.workspace = true
rstest.workspace = true
sphrs.workspace = true

[lints]
workspace = true

[[bench]]
name = "harmonics"
harness = false
5 changes: 5 additions & 0 deletions hoomd-order/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# hoomd-order

Order parameter analysis library for [hoomd-rs].

[hoomd-rs]: https://github.com/glotzerlab/hoomd-rs
34 changes: 34 additions & 0 deletions hoomd-order/benches/harmonics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) 2024-2026 The Regents of the University of Michigan.
// Part of hoomd-rs, released under the BSD 3-Clause License.

//! ...
use hoomd_order::SphericalHarmonic;
use hoomd_vector::{Cartesian, InnerProduct};
use rand::{Rng, RngExt, SeedableRng, rngs::StdRng};

/// Generate a random point on the unit sphere.
#[inline]
fn random_unit_point<R: Rng>(rng: &mut R) -> Cartesian<3> {
let (x, y, z) = (rng.random(), rng.random(), rng.random());
Cartesian::from([x, y, z])
}
fn main() {
divan::main();
}

/// Measure per-point performance at each l.
#[divan::bench(
consts = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
sample_count = 1_000,
sample_size = 10_000,
)]
fn recurrence<const L: usize>(bencher: divan::Bencher<'_, '_>) {
let sh = SphericalHarmonic::<L>::new();
let mut rng = StdRng::seed_from_u64(1);
bencher
.with_inputs(|| {
let point = random_unit_point::<StdRng>(&mut rng);
(point.to_unit().expect("non-zero point")).0
})
.bench_local_values(|xyz| sh.eval(xyz));
}
Loading
Loading