Skip to main content

py3nj

travis

A small python library to calcluate wigner's 3j-, 6j- and 9j- symbols. py3nj is designed to be compatible with numpy's np.ndarray and its calculation is vectorized automatically.

Basic Usage

The basic interfaces are py3nj.wigner3j, py3nj.wigner6j, py3nj.wigner9j, and py3nj.clebsch_gordan.

>>> # Calculate (0/2, 1/2, 1/2,
... #           (0/2, 1/2,-1/2)
... # Note that all the arguments should be doubled
... py3nj.wigner3j(0, 1, 1,
...                0, 1,-1)
0.7071067811865476

>>> # vectorization is supported
... py3nj.wigner3j([0, 2], [1, 0], [ 1, 0],
...                [0, 0], [1, 0], [-1, 0])
array([0.70710678, 0.        ])

>>> # 6J symbol
>>> py3nj.wigner6j([2, 1], [1, 2], [1, 1],
...                [1, 2], [2, 1], [0, 0])
array([0.40824829, 0.40824829])

>>> # 9J symbol
>>> py3nj.wigner9j([2, 2], [4, 4], [2, 2],
...                [2, 4], [2, 6], [2, 2],
...                [2, 2], [2, 4], [2, 2])
array([0.05555556, 0.03651484])

>>> Clebsch Gordanh coefficient
>>> py3nj.clebsch_gordan(2, 2, 4,
...                      2, 0, 2)
0.7071067811865475

>>> # Vectorized calcluation of C.G. coef
... py3nj.clebsch_gordan([2, 1], [2, 1], [4, 0],
...                      [2,-1], [0, 1], [2, 0])
array([ 0.70710678, -0.70710678])

Install

py3nj can be installed through either pip or github repository.

Install by pip

pip install py3nj

Install through github

git clone https://github.com/fujiisoup/py3nj
cd py3nj
pip install .

Acknowledgement

py3nj wraps slatec fortran implementation. See http://www.netlib.org/slatec/ for the details.

License

Copyright 2018, py3nj Developers

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for py3nj 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py3nj 0.2.0
File Size Uploaded Provenance Actions
py3nj-0.2.0.tar.gz 50.1 kB Without provenance Details for py3nj-0.2.0.tar.gz

Release files / py3nj-0.2.0.tar.gz

Download URL py3nj-0.2.0.tar.gz
Size 50.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8a25820d5375ea677344d9752b190115bf0b46129979279e8d82e744d870a374
BLAKE2b-256 checksum
How to use checksums
21f9799cfe5dcc73e0fcd15ccb7776272f13071bc339d3e33c4e39f87f4648b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for py3nj 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page