Calculation of Wigner symbols and related constants

Related tags

Command-line wigners
Overview

Calculation of Wigner symbols and related constants

This crate computes Wigner 3j coefficients and Clebsch-Gordan coefficients in pure Rust. The calculation is based on the prime factorization of the different factorials involved in the coefficients, keeping the values in a rational root form (sign * \sqrt{s / n}) for as long as possible. This idea for the algorithm is described in:

H. T. Johansson and C. Forssén, SIAM Journal on Scientific Compututing 38 (2016) 376-384

This implementation takes a lot of inspiration from the WignerSymbols Julia implementation (and even started as a direct translation of it), many thanks to them! This crate is available under the same license as the Julia package.

Usage

Add this crate to your Cargo.toml dependencies section:

wigners = "0.1.0"

And then call one of the exported function:

let w3j = wigners::wigner_3j(j1, j2, j3, m1, m2, m3);

let cg = wigners::clebsch_gordan(j1, m1, j2, m1, j3, m3);

Limitations

Only Wigner 3j symbols for full integers (no half-integers) are implemented, since that's the only part I need for my own work.

6j and 9j symbols can also be computed with this approach; and support for half-integers should be feasible as well. I'm open to pull-request implementing these!

Benchmarks

This benchmark measure the time to compute all possible Wigner 3j symbols up to a fixed maximal angular momentum.

angular momentum wigners (this crate) wigner-symbols v0.5 WignerSymbols.jl v2.0 wigxjpf v1.11
4 0.925 ms 17.5 ms 2.31 ms 0.348 ms
8 5.18 ms 151 ms 12.0 ms 2.40 ms
12 14.0 ms 595 ms 23.0 ms 8.21 ms
20 55.0 ms 3772 ms 88.3 ms 43.0 ms

Comparison to wigner-symbols

There is another Rust implementation of wigner symbols: the wigner-symbols crate. wigner-symbols also implements 6j and 9j symbols, but it was not usable for my case since it relies on rug for arbitrary precision integers and through it on the GMP library. The GMP library might be problematic for you for one of these reason:

  • it is relatively slow (see the benchmarks above)
  • it is distributed under LGPL (this crate is distributed under Apache/MIT);
  • it is written in C and C++; and as such is hard to cross-compile or compile to WASM;
  • it does not support the MSVC compiler on windows, only the GNU compilers

However, while this crate should be able to compute winger 3j coefficients up to relatively high angular momentum, it does not use arbitrary precision integers and might fail for very high value. This crate was validated up to l=100, which is more than enough for my use case.

License

This crate is distributed under both the MIT license and the Apache 2.0 license.

You might also like...
A library providing helpers for various StarkNet fees related tasks.
A library providing helpers for various StarkNet fees related tasks.

🐺 How Much ? 🦀 Table of Contents About Getting Started Prerequisites Installation Usage Estimate fees on network Authors & contributors Security Lic

Low overhead Rust implementation of time-related concepts

It's Rust time! Low overhead implementation of time-related concepts. Who is time for? For applications where simplicity and low-overhead are more imp

Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at running, debugging, and deploying code and infrastructure.
Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at running, debugging, and deploying code and infrastructure.

Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at running, debugging, and deploying code and infrastructure.

This is a simple lnd poller and web front-end to see and read boosts and boostagrams.

Helipad This package will poll a Lightning LND node for invoices related to Podcasting 2.0 and display them in a web interface. It's intended for use

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust

Sets of libraries and tools to write applications and libraries mixing OCaml and Rust. These libraries will help keeping your types and data structures synchronized, and enable seamless exchange between OCaml and Rust

Tooling and library for generation, validation and verification of supply chain metadata documents and frameworks

Spector Spector is both tooling and a library for the generation, validation and verification of supply chain metadata documents and frameworks. Many

A comprehensive collection of resources and learning materials for Rust programming, empowering developers to explore and master the modern, safe, and blazingly fast language.

🦀 Awesome Rust Lang ⛰️ Project Description : Welcome to the Awesome Rust Lang repository! This is a comprehensive collection of resources for Rust, a

ratlab is a programming platform designed loosely for hobbyist and masochist to analyse and design stuff and things that transform our world?
ratlab is a programming platform designed loosely for hobbyist and masochist to analyse and design stuff and things that transform our world?

ratlab A programming language developed by Quinn Horton and Jay Hunter. ratlab is a programming platform designed loosely for hobbyists and masochists

Owner
Guillaume Fraux
Guillaume Fraux
Choose Rust types at compile-time via boolean constants

condtype Choose Rust types at compile-time via boolean constants, brought to you by Nikolai Vazquez. If you find this library useful, consider starrin

Nikolai Vazquez 36 May 8, 2023
osu! difficulty and pp calculation for all modes

rosu-pp-js Difficulty and performance calculation for all osu! modes. This is a js binding to the Rust library rosu-pp which was bootstrapped through

Max 8 Nov 23, 2022
osu! difficulty and pp calculation for all modes

rosu-pp-py Difficulty and performance calculation for all osu! modes. This is a python binding to the Rust library rosu-pp which was bootstrapped thro

Max 16 Dec 28, 2022
PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining.

?? ⛓️ ?? Pyskani PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining. ??️ Overview

Martin Larralde 13 Mar 21, 2023
Downloads and provides debug symbols and source code for nix derivations to gdb and other debuginfod-capable debuggers as needed.

nixseparatedebuginfod Downloads and provides debug symbols and source code for nix derivations to gdb and other debuginfod-capable debuggers as needed

Guillaume Girol 16 Mar 6, 2023
🦀️atos for linux by rust - A partial replacement for Apple's atos tool for converting addresses within a binary file to symbols.

atosl-rs ??️ atos for linux by rust - A partial replacement for Apple's atos tool for converting addresses within a binary file to symbols. tested on

everettjf 60 Dec 29, 2022
Scan the symbols of all ELF binaries in all Arch Linux packages for usage of malloc_usable_size

Scan the symbols of all ELF binaries in all Arch Linux packages for usage of malloc_usable_size (-D_FORTIFY_SOURCE=3 compatibility)

null 3 Sep 9, 2023
Curated list of awesome projects and resources related to Rust and computer security

Awesome Rust Security Curated list of awesome projects and resources related to Rust and computer security Table of Contents Tools Web and Cloud Secur

Alan 131 Jan 1, 2023
A server software designed for fetching Minecraft and Minecraft-related metadata

Minecraft Metadata Server A server software designed for fetching Minecraft and Minecraft-related metadata (such as Forge, Fabric, Quilt and Liteloade

Prism Launcher 11 Jan 19, 2023
A backend server and client for Norg related applications.

Norgopolis Norgopolis is a lightweight communication, launcher and utility services client for the Neorg rust-native modules ecosystem on Desktop. It

Neorg 10 May 27, 2023