AMELI 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ameli-1.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Reinhard Caspary <r.caspary@posteo.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ameli-1.2.0/PKG-INFO ADDED
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: AMELI
3
+ Version: 1.2.0
4
+ Summary: Python 3 package to calculate angular matrix elements of lanthanide ions.
5
+ Author-email: Reinhard Caspary <reinhard.caspary@phoenixd.uni-hannover.de>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/reincas/AMELI
8
+ Project-URL: Issues, https://github.com/reincas/AMELI/issues
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering :: Physics
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: h5py==3.15.1
18
+ Requires-Dist: numpy==2.4.2
19
+ Requires-Dist: scidatacontainer==1.2.0
20
+ Requires-Dist: sympy==1.14.0
21
+ Dynamic: license-file
22
+
23
+ # AMELI 1.2.0 (Angular Matrix Elements of Lanthanide Ions)
24
+
25
+ This is a Python 3 package to calculate the angular matrix elements of spherical tensor operators of lanthanide ions
26
+ in exact arithmetic using SymPy.
27
+ Each matrix element is stored as signed square root of a rational number.
28
+ The basic functions support any many-electron configuration, but the implementation of most high-level operators is
29
+ specific for single-shell systems like the lanthanide ions.
30
+
31
+ The main purpose of this software is the preparation of the comprehensive matrix datasets in the
32
+ [AMELI repository](https://zenodo.org/communities/ameli) on Zenodo.
33
+ Each lanthanide dataset for the configurations $f^1$ to $f^{13}$ contains unit tensor operators, angular momentum
34
+ operators and perturbation Hamiltonians.
35
+ All relevant perturbation operators are provided in first order (Coulomb, spin-orbit, spin-spin, spin-other-orbit) and
36
+ in second order (Coulomb, electrostatic spin-orbit).
37
+
38
+ The AMELI matrix datasets are intended as replacements for the printed and incomplete tables published mainly by
39
+ B. R. Judd, W. T. Carnall, C. W. Nielson, and G. F. Koster on the 1960s and 1970s.
40
+ In particular they are intended to replace all tables of reduced unit tensor matrix elements in intermediate coupling
41
+ still used for Judd-Ofelt calculations.
42
+ Such calculations should instead be based on a set of radial integrals serving as linear expansion coefficients for the
43
+ operator matrices.
44
+
45
+ ## Documentation
46
+
47
+ A paper on the mathematical background of AMELI, its workflow, and a detailed comparison of the resulting tensor
48
+ matrices to the literature is ready and will be submitted to arXiv and a scientific journal very soon.
49
+
50
+ ## General Remarks
51
+
52
+ All angular matrices of a given electron configuration are constants and need to be calculated only once.
53
+ This software package therefore is intended mainly as reference.
54
+ Instead of integrating AMELI code into your own project, you should use the matrices from the AMELI repository on
55
+ Zenodo.
56
+ A reference implementation will be provided by the [Lanthanide](https://github.com/reincas/Lanthanide) package,
57
+ which will soon be switching from self-generated matrices to AMELI.
58
+
59
+ AMELI calculates operator matrices in the product state space together with a transformation matrix to $LS$-coupling
60
+ in exact arithmetic.
61
+ All characteristic eigenvalues and irreducible representations for each state are provided.
62
+ Global signs are synchronized for states inside each $J$-multiplet.
63
+ This allows to use reduced matrices for intermediate coupling in amorphous materials.
64
+
65
+ All matrices and other intermediate calculation results are stored as
66
+ [SciDataContainer](https://scidatacontainer.readthedocs.io) files enriched with plenty of meta data and descriptions.
67
+ Following the [FAIR data principles](https://en.wikipedia.org/wiki/FAIR_data) of research data management the container
68
+ content is easily accessible to humans and machines.
69
+ A Python implementation is available, but not necessary, because a SciDataContainer file is just a ZIP folder.
70
+ AMELI containers consist only of JSON files for the meta data and HDF5 files for the numerical data.
71
+
72
+ ## Application 1: Energy Levels of Lanthanides
73
+
74
+ The matrices can be used for the fit of lanthanide energy levels to measured absorption spectra resulting in radial
75
+ integrals and the coefficients of all states in intermediate coupling.
76
+ For crystalline materials these calculations can take full advantage of all spectral lines using the even-rank unit
77
+ tensor operators for modelling the crystal-field splitting.
78
+ This includes the mixing of states with different $J$ quantum number.
79
+ For amorphous materials the calculations can take advantage of the effective rotational site symmetry which allows to
80
+ perform them in a reduced $SLJ$ space with much smaller matrices.
81
+
82
+ ## Application 2: Transition Intensities of Lanthanides
83
+
84
+ Based on radial integrals from the literature or own energy-level fits, the coefficients of all states in intermediate
85
+ coupling can be determined as linear combination of $LS$-states.
86
+ This makes the generation of all reduced matrix elements for Judd-Ofelt calculations a simple task.
87
+ While the Judd-Ofelt theory is standard to predict the radiative intensities of every emission and absorption
88
+ transition from measured absorption spectra in amorphous hosts, it is not intended for crystalline hosts.
89
+ The AMELI repository contains all matrices for the Crystal Field Intensity (CFI) method instead, which uses the same
90
+ mathematical procedure as Judd-Ofelt, but with a larger set of parameters reflecting the richer structure of
91
+ crystalline spectra.
92
+ Based on odd-rank unit tensor operators the electric dipole operators for any site-symmetry can be modelled in
93
+ addition to the magnetic dipole operator, which is the same for amorphous and crystalline materials.
94
+
95
+ ## Package Structure
96
+
97
+ The main code of the AMELI package is contained in the folder `ameli`.
98
+ The script `generate.py` in the folder `generate` is used to calculate the full set of matrices for all lanthanide
99
+ configurations.
100
+ Due to the exact arithmetic this is a time-consuming process.
101
+ Even though the script builds a dependency graph and schedules the computation tasks to all available CPU cores, it
102
+ takes several days to finish.
103
+ The folder `test`contains a set of test scripts orchestrated by the main script `test.py` which perform a large number
104
+ of mathematical tests and comparisons to values published in printed literature.
105
+ Its subfolder `results` contains the results from a test run and the subfolder `tables` contains the script used to
106
+ extract the comparison tables in the AMELI paper from the test results.
107
+ The folder `upload` is for documentation only.
108
+ It contains the scripts used to upload and update the matrix datasets on the Zenodo repository.
ameli-1.2.0/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # AMELI 1.2.0 (Angular Matrix Elements of Lanthanide Ions)
2
+
3
+ This is a Python 3 package to calculate the angular matrix elements of spherical tensor operators of lanthanide ions
4
+ in exact arithmetic using SymPy.
5
+ Each matrix element is stored as signed square root of a rational number.
6
+ The basic functions support any many-electron configuration, but the implementation of most high-level operators is
7
+ specific for single-shell systems like the lanthanide ions.
8
+
9
+ The main purpose of this software is the preparation of the comprehensive matrix datasets in the
10
+ [AMELI repository](https://zenodo.org/communities/ameli) on Zenodo.
11
+ Each lanthanide dataset for the configurations $f^1$ to $f^{13}$ contains unit tensor operators, angular momentum
12
+ operators and perturbation Hamiltonians.
13
+ All relevant perturbation operators are provided in first order (Coulomb, spin-orbit, spin-spin, spin-other-orbit) and
14
+ in second order (Coulomb, electrostatic spin-orbit).
15
+
16
+ The AMELI matrix datasets are intended as replacements for the printed and incomplete tables published mainly by
17
+ B. R. Judd, W. T. Carnall, C. W. Nielson, and G. F. Koster on the 1960s and 1970s.
18
+ In particular they are intended to replace all tables of reduced unit tensor matrix elements in intermediate coupling
19
+ still used for Judd-Ofelt calculations.
20
+ Such calculations should instead be based on a set of radial integrals serving as linear expansion coefficients for the
21
+ operator matrices.
22
+
23
+ ## Documentation
24
+
25
+ A paper on the mathematical background of AMELI, its workflow, and a detailed comparison of the resulting tensor
26
+ matrices to the literature is ready and will be submitted to arXiv and a scientific journal very soon.
27
+
28
+ ## General Remarks
29
+
30
+ All angular matrices of a given electron configuration are constants and need to be calculated only once.
31
+ This software package therefore is intended mainly as reference.
32
+ Instead of integrating AMELI code into your own project, you should use the matrices from the AMELI repository on
33
+ Zenodo.
34
+ A reference implementation will be provided by the [Lanthanide](https://github.com/reincas/Lanthanide) package,
35
+ which will soon be switching from self-generated matrices to AMELI.
36
+
37
+ AMELI calculates operator matrices in the product state space together with a transformation matrix to $LS$-coupling
38
+ in exact arithmetic.
39
+ All characteristic eigenvalues and irreducible representations for each state are provided.
40
+ Global signs are synchronized for states inside each $J$-multiplet.
41
+ This allows to use reduced matrices for intermediate coupling in amorphous materials.
42
+
43
+ All matrices and other intermediate calculation results are stored as
44
+ [SciDataContainer](https://scidatacontainer.readthedocs.io) files enriched with plenty of meta data and descriptions.
45
+ Following the [FAIR data principles](https://en.wikipedia.org/wiki/FAIR_data) of research data management the container
46
+ content is easily accessible to humans and machines.
47
+ A Python implementation is available, but not necessary, because a SciDataContainer file is just a ZIP folder.
48
+ AMELI containers consist only of JSON files for the meta data and HDF5 files for the numerical data.
49
+
50
+ ## Application 1: Energy Levels of Lanthanides
51
+
52
+ The matrices can be used for the fit of lanthanide energy levels to measured absorption spectra resulting in radial
53
+ integrals and the coefficients of all states in intermediate coupling.
54
+ For crystalline materials these calculations can take full advantage of all spectral lines using the even-rank unit
55
+ tensor operators for modelling the crystal-field splitting.
56
+ This includes the mixing of states with different $J$ quantum number.
57
+ For amorphous materials the calculations can take advantage of the effective rotational site symmetry which allows to
58
+ perform them in a reduced $SLJ$ space with much smaller matrices.
59
+
60
+ ## Application 2: Transition Intensities of Lanthanides
61
+
62
+ Based on radial integrals from the literature or own energy-level fits, the coefficients of all states in intermediate
63
+ coupling can be determined as linear combination of $LS$-states.
64
+ This makes the generation of all reduced matrix elements for Judd-Ofelt calculations a simple task.
65
+ While the Judd-Ofelt theory is standard to predict the radiative intensities of every emission and absorption
66
+ transition from measured absorption spectra in amorphous hosts, it is not intended for crystalline hosts.
67
+ The AMELI repository contains all matrices for the Crystal Field Intensity (CFI) method instead, which uses the same
68
+ mathematical procedure as Judd-Ofelt, but with a larger set of parameters reflecting the richer structure of
69
+ crystalline spectra.
70
+ Based on odd-rank unit tensor operators the electric dipole operators for any site-symmetry can be modelled in
71
+ addition to the magnetic dipole operator, which is the same for amorphous and crystalline materials.
72
+
73
+ ## Package Structure
74
+
75
+ The main code of the AMELI package is contained in the folder `ameli`.
76
+ The script `generate.py` in the folder `generate` is used to calculate the full set of matrices for all lanthanide
77
+ configurations.
78
+ Due to the exact arithmetic this is a time-consuming process.
79
+ Even though the script builds a dependency graph and schedules the computation tasks to all available CPU cores, it
80
+ takes several days to finish.
81
+ The folder `test`contains a set of test scripts orchestrated by the main script `test.py` which perform a large number
82
+ of mathematical tests and comparisons to values published in printed literature.
83
+ Its subfolder `results` contains the results from a test run and the subfolder `tables` contains the script used to
84
+ extract the comparison tables in the AMELI paper from the test results.
85
+ The folder `upload` is for documentation only.
86
+ It contains the scripts used to upload and update the matrix datasets on the Zenodo repository.
@@ -0,0 +1,41 @@
1
+ # pyproject.toml
2
+ [build-system]
3
+ requires = [
4
+ "setuptools",
5
+ "wheel",
6
+ ]
7
+ build-backend = "setuptools.build_meta"
8
+
9
+ [project]
10
+ name = "AMELI"
11
+ version = "1.2.0"
12
+ authors = [
13
+ { name = "Reinhard Caspary", email = "reinhard.caspary@phoenixd.uni-hannover.de"},
14
+ ]
15
+ description = "Python 3 package to calculate angular matrix elements of lanthanide ions."
16
+ license = "MIT"
17
+ readme = "README.md"
18
+ requires-python = ">=3.11"
19
+ dependencies = [
20
+ "h5py == 3.15.1",
21
+ "numpy == 2.4.2",
22
+ "scidatacontainer == 1.2.0",
23
+ "sympy == 1.14.0",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 5 - Production/Stable",
27
+ "Intended Audience :: Science/Research",
28
+ "Topic :: Scientific/Engineering :: Physics",
29
+ "Programming Language :: Python :: 3",
30
+ "Operating System :: OS Independent"
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/reincas/AMELI"
35
+ Issues = "https://github.com/reincas/AMELI/issues"
36
+
37
+ [tool.setuptools]
38
+ package-dir = {"" = "src"}
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
ameli-1.2.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
ameli-1.2.0/setup.py ADDED
@@ -0,0 +1,3 @@
1
+ import setuptools
2
+
3
+ setuptools.setup()
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: AMELI
3
+ Version: 1.2.0
4
+ Summary: Python 3 package to calculate angular matrix elements of lanthanide ions.
5
+ Author-email: Reinhard Caspary <reinhard.caspary@phoenixd.uni-hannover.de>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/reincas/AMELI
8
+ Project-URL: Issues, https://github.com/reincas/AMELI/issues
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering :: Physics
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: h5py==3.15.1
18
+ Requires-Dist: numpy==2.4.2
19
+ Requires-Dist: scidatacontainer==1.2.0
20
+ Requires-Dist: sympy==1.14.0
21
+ Dynamic: license-file
22
+
23
+ # AMELI 1.2.0 (Angular Matrix Elements of Lanthanide Ions)
24
+
25
+ This is a Python 3 package to calculate the angular matrix elements of spherical tensor operators of lanthanide ions
26
+ in exact arithmetic using SymPy.
27
+ Each matrix element is stored as signed square root of a rational number.
28
+ The basic functions support any many-electron configuration, but the implementation of most high-level operators is
29
+ specific for single-shell systems like the lanthanide ions.
30
+
31
+ The main purpose of this software is the preparation of the comprehensive matrix datasets in the
32
+ [AMELI repository](https://zenodo.org/communities/ameli) on Zenodo.
33
+ Each lanthanide dataset for the configurations $f^1$ to $f^{13}$ contains unit tensor operators, angular momentum
34
+ operators and perturbation Hamiltonians.
35
+ All relevant perturbation operators are provided in first order (Coulomb, spin-orbit, spin-spin, spin-other-orbit) and
36
+ in second order (Coulomb, electrostatic spin-orbit).
37
+
38
+ The AMELI matrix datasets are intended as replacements for the printed and incomplete tables published mainly by
39
+ B. R. Judd, W. T. Carnall, C. W. Nielson, and G. F. Koster on the 1960s and 1970s.
40
+ In particular they are intended to replace all tables of reduced unit tensor matrix elements in intermediate coupling
41
+ still used for Judd-Ofelt calculations.
42
+ Such calculations should instead be based on a set of radial integrals serving as linear expansion coefficients for the
43
+ operator matrices.
44
+
45
+ ## Documentation
46
+
47
+ A paper on the mathematical background of AMELI, its workflow, and a detailed comparison of the resulting tensor
48
+ matrices to the literature is ready and will be submitted to arXiv and a scientific journal very soon.
49
+
50
+ ## General Remarks
51
+
52
+ All angular matrices of a given electron configuration are constants and need to be calculated only once.
53
+ This software package therefore is intended mainly as reference.
54
+ Instead of integrating AMELI code into your own project, you should use the matrices from the AMELI repository on
55
+ Zenodo.
56
+ A reference implementation will be provided by the [Lanthanide](https://github.com/reincas/Lanthanide) package,
57
+ which will soon be switching from self-generated matrices to AMELI.
58
+
59
+ AMELI calculates operator matrices in the product state space together with a transformation matrix to $LS$-coupling
60
+ in exact arithmetic.
61
+ All characteristic eigenvalues and irreducible representations for each state are provided.
62
+ Global signs are synchronized for states inside each $J$-multiplet.
63
+ This allows to use reduced matrices for intermediate coupling in amorphous materials.
64
+
65
+ All matrices and other intermediate calculation results are stored as
66
+ [SciDataContainer](https://scidatacontainer.readthedocs.io) files enriched with plenty of meta data and descriptions.
67
+ Following the [FAIR data principles](https://en.wikipedia.org/wiki/FAIR_data) of research data management the container
68
+ content is easily accessible to humans and machines.
69
+ A Python implementation is available, but not necessary, because a SciDataContainer file is just a ZIP folder.
70
+ AMELI containers consist only of JSON files for the meta data and HDF5 files for the numerical data.
71
+
72
+ ## Application 1: Energy Levels of Lanthanides
73
+
74
+ The matrices can be used for the fit of lanthanide energy levels to measured absorption spectra resulting in radial
75
+ integrals and the coefficients of all states in intermediate coupling.
76
+ For crystalline materials these calculations can take full advantage of all spectral lines using the even-rank unit
77
+ tensor operators for modelling the crystal-field splitting.
78
+ This includes the mixing of states with different $J$ quantum number.
79
+ For amorphous materials the calculations can take advantage of the effective rotational site symmetry which allows to
80
+ perform them in a reduced $SLJ$ space with much smaller matrices.
81
+
82
+ ## Application 2: Transition Intensities of Lanthanides
83
+
84
+ Based on radial integrals from the literature or own energy-level fits, the coefficients of all states in intermediate
85
+ coupling can be determined as linear combination of $LS$-states.
86
+ This makes the generation of all reduced matrix elements for Judd-Ofelt calculations a simple task.
87
+ While the Judd-Ofelt theory is standard to predict the radiative intensities of every emission and absorption
88
+ transition from measured absorption spectra in amorphous hosts, it is not intended for crystalline hosts.
89
+ The AMELI repository contains all matrices for the Crystal Field Intensity (CFI) method instead, which uses the same
90
+ mathematical procedure as Judd-Ofelt, but with a larger set of parameters reflecting the richer structure of
91
+ crystalline spectra.
92
+ Based on odd-rank unit tensor operators the electric dipole operators for any site-symmetry can be modelled in
93
+ addition to the magnetic dipole operator, which is the same for amorphous and crystalline materials.
94
+
95
+ ## Package Structure
96
+
97
+ The main code of the AMELI package is contained in the folder `ameli`.
98
+ The script `generate.py` in the folder `generate` is used to calculate the full set of matrices for all lanthanide
99
+ configurations.
100
+ Due to the exact arithmetic this is a time-consuming process.
101
+ Even though the script builds a dependency graph and schedules the computation tasks to all available CPU cores, it
102
+ takes several days to finish.
103
+ The folder `test`contains a set of test scripts orchestrated by the main script `test.py` which perform a large number
104
+ of mathematical tests and comparisons to values published in printed literature.
105
+ Its subfolder `results` contains the results from a test run and the subfolder `tables` contains the script used to
106
+ extract the comparison tables in the AMELI paper from the test results.
107
+ The folder `upload` is for documentation only.
108
+ It contains the scripts used to upload and update the matrix datasets on the Zenodo repository.
@@ -0,0 +1,28 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ src/AMELI.egg-info/PKG-INFO
6
+ src/AMELI.egg-info/SOURCES.txt
7
+ src/AMELI.egg-info/dependency_links.txt
8
+ src/AMELI.egg-info/requires.txt
9
+ src/AMELI.egg-info/top_level.txt
10
+ src/ameli/__init__.py
11
+ src/ameli/casimir.py
12
+ src/ameli/config.py
13
+ src/ameli/matrix.py
14
+ src/ameli/product.py
15
+ src/ameli/sparse.py
16
+ src/ameli/states.py
17
+ src/ameli/transform.py
18
+ src/ameli/uintarray.py
19
+ src/ameli/unit.py
20
+ src/ameli/vault.py
21
+ test/test.py
22
+ test/test_01_orthonormal.py
23
+ test/test_02_transform.py
24
+ test/test_03_states.py
25
+ test/test_04_screen.py
26
+ test/test_05_triple.py
27
+ test/test_06_magnetic.py
28
+ test/test_07_energy.py
@@ -0,0 +1,4 @@
1
+ h5py==3.15.1
2
+ numpy==2.4.2
3
+ scidatacontainer==1.2.0
4
+ sympy==1.14.0
@@ -0,0 +1 @@
1
+ ameli
@@ -0,0 +1,35 @@
1
+ ##########################################################################
2
+ # Copyright (c) 2025-2026 Reinhard Caspary #
3
+ # <reinhard.caspary@phoenixd.uni-hannover.de> #
4
+ # This program is free software under the terms of the MIT license. #
5
+ ##########################################################################
6
+
7
+ import re
8
+ from functools import lru_cache
9
+ from sympy.physics.wigner import wigner_3j
10
+
11
+
12
+ def desc_format(description, kwargs):
13
+ """ Basic transformation for metadata description strings. """
14
+
15
+ desc = str(description)
16
+ desc = re.sub(r"\s*\n\s*", " ", desc)
17
+ desc = re.sub(r"\s*<br>\s*", "\n", desc)
18
+ desc = desc.strip()
19
+ desc = desc.format(**kwargs)
20
+ return desc
21
+
22
+
23
+ @lru_cache(maxsize=100000)
24
+ def sym3j(j1, j2, j3, m1, m2, m3):
25
+ """ Return the exact symbolic value of the Wigner 3j-symbol. The given arguments of the 3j-symbol must be integers
26
+ or SymPy half-integer expressions. The results of this method are cached. """
27
+
28
+ return wigner_3j(j1, j2, j3, m1, m2, m3)
29
+
30
+
31
+ from .config import SPECTRAL, Electron, Config
32
+ from .product import Product
33
+ from .unit import Unit
34
+ from .matrix import Matrix
35
+ from .transform import Transform
@@ -0,0 +1,119 @@
1
+ ##########################################################################
2
+ # Copyright (c) 2025-2026 Reinhard Caspary #
3
+ # <reinhard.caspary@phoenixd.uni-hannover.de> #
4
+ # This program is free software under the terms of the MIT license. #
5
+ ##########################################################################
6
+ #
7
+ # This internal module provides the static dictionary CASIMIR, with three
8
+ # Casimir objects storing eigenvalues and irreducible representations
9
+ # of the Casimir operators for the special orthogonal (rotational)
10
+ # groups SO(5) and SO(7) and the special group G_2. Each Casimir object
11
+ # translates between SymPy eigenvalues and irreducible representation
12
+ # strings of the respective operators.
13
+ #
14
+ ##########################################################################
15
+
16
+ import sympy as sp
17
+
18
+
19
+ class Casimir:
20
+ """ Translation class for a Casimir operator. """
21
+
22
+ # Dictionary with irreducible representations as keys and eigenvalues as values
23
+ values = {}
24
+
25
+ # Dictionary with eigenvalues as keys and irreducible representations as values
26
+ keys = {}
27
+
28
+ def key(self, value: sp.Expr) -> str:
29
+ """ Return the irreducible representation string of the given SymPy eigenvalue. """
30
+
31
+ if value not in self.keys:
32
+ raise ValueError(f"Unknown value {value}!")
33
+ return self.keys[value]
34
+
35
+ def value(self, key: str) -> sp.Expr:
36
+ """ Return the SymPy eigenvalue of the given irreducible representation string. """
37
+ if key not in self.values:
38
+ raise ValueError(f"Unknown key {key}!")
39
+ return self.values[key]
40
+
41
+
42
+ class CasimirRot(Casimir):
43
+ """ Translation class for the Casimir operator of the special orthogonal (rotational) group SO(2l+1)
44
+ in 2l+1 dimensions, with l = 1, 2, or 3. """
45
+
46
+ def __init__(self, l):
47
+ """ Calculate the SymPy eigenvalues of all irreducible representation strings of the Casimir operator. """
48
+
49
+ self.l = l
50
+ assert 1 <= l <= 3
51
+
52
+ self.values = {}
53
+ self.keys = {}
54
+ for key in self.elements():
55
+ value = self.evaluate(key)
56
+ self.values[key] = value
57
+ self.keys[value] = key
58
+
59
+ def evaluate(self, w: str) -> sp.Expr:
60
+ """ Return the SymPy eigenvalue of the given irreducible representation string. """
61
+
62
+ assert w.startswith("(") and w.endswith(")")
63
+ w = tuple(map(int, w[1:-1]))
64
+ assert self.l == len(w)
65
+ value = 0
66
+ for i, wi in enumerate(w):
67
+ value += wi * (wi + 2 * self.l - 1 - 2 * i)
68
+ return sp.S(value) / (2 * (2 * self.l - 1))
69
+
70
+ def elements(self, values=None):
71
+ """ Recursive generator of all irreducible representation strings of the Casimir operator. """
72
+
73
+ if values is None:
74
+ values = []
75
+ max_num = self.l
76
+ else:
77
+ max_num = values[-1] + 1
78
+ for num in range(max_num):
79
+ result = values + [num]
80
+ if len(values) < self.l - 1:
81
+ yield from self.elements(result)
82
+ else:
83
+ yield "(" + "".join(map(str, result)) + ")"
84
+
85
+
86
+ class CasimirSpecial(Casimir):
87
+ """ Translation class for the Casimir operator of the special orthogonal (rotational) group G_2. """
88
+
89
+ def __init__(self):
90
+ """ Calculate the SymPy eigenvalues of all irreducible representation strings of the Casimir operator. """
91
+
92
+ self.values = {}
93
+ self.keys = {}
94
+ for key in self.elements():
95
+ value = self.evaluate(key)
96
+ self.values[key] = value
97
+ self.keys[value] = key
98
+
99
+ def evaluate(self, u: str) -> sp.Expr:
100
+ """ Return the SymPy eigenvalue of the given irreducible representation string. """
101
+
102
+ assert u.startswith("(") and u.endswith(")")
103
+ u = tuple(map(int, u[1:-1]))
104
+ assert len(u) == 2
105
+ value = u[0] * u[0] + u[1] * u[1] + u[0] * u[1] + 5 * u[0] + 4 * u[1]
106
+ return sp.S(value) / 12
107
+
108
+ def elements(self):
109
+ """ Recursive generator of all irreducible representation strings of the Casimir operator. """
110
+
111
+ for i in range(5):
112
+ for j in range(i + 1):
113
+ u = (i, j)
114
+ yield "(" + "".join(map(str, u)) + ")"
115
+
116
+
117
+ # Export three Casimir translator objects for the Casimir operators for the special orthogonal rotational groups
118
+ # SO(5) and SO(7) and the special group G_2
119
+ CASIMIR = {"SO7": CasimirRot(l=3), "SO5": CasimirRot(l=2), "G2": CasimirSpecial()}