tau2 1.0.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.
- tau2-1.0.0/PKG-INFO +124 -0
- tau2-1.0.0/README.md +83 -0
- tau2-1.0.0/pyproject.toml +40 -0
- tau2-1.0.0/setup.cfg +4 -0
- tau2-1.0.0/setup.py +54 -0
- tau2-1.0.0/tau2/__init__.py +0 -0
- tau2-1.0.0/tau2/__main__.py +5 -0
- tau2-1.0.0/tau2/__version__.py +3 -0
- tau2-1.0.0/tau2/calculation_setup.py +73 -0
- tau2-1.0.0/tau2/cli.py +799 -0
- tau2-1.0.0/tau2/constants.py +17 -0
- tau2-1.0.0/tau2/electronic_structure.py +181 -0
- tau2-1.0.0/tau2/files.py +424 -0
- tau2-1.0.0/tau2/hysteresis.py +625 -0
- tau2-1.0.0/tau2/lineshapes.py +141 -0
- tau2-1.0.0/tau2/main.py +494 -0
- tau2-1.0.0/tau2/orbach_calculator.py +421 -0
- tau2-1.0.0/tau2/parameters.py +48 -0
- tau2-1.0.0/tau2/plotting.py +1121 -0
- tau2-1.0.0/tau2/raman_calculator.py +1148 -0
- tau2-1.0.0/tau2/rates_calculator.py +238 -0
- tau2-1.0.0/tau2/utils.py +99 -0
- tau2-1.0.0/tau2.egg-info/PKG-INFO +124 -0
- tau2-1.0.0/tau2.egg-info/SOURCES.txt +43 -0
- tau2-1.0.0/tau2.egg-info/dependency_links.txt +1 -0
- tau2-1.0.0/tau2.egg-info/entry_points.txt +2 -0
- tau2-1.0.0/tau2.egg-info/requires.txt +9 -0
- tau2-1.0.0/tau2.egg-info/top_level.txt +1 -0
tau2-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tau2
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A package for calculating magnetic relaxation rates
|
|
5
|
+
Home-page: https://gitlab.com/chilton-group/tau2
|
|
6
|
+
Author: Ben Atkinson
|
|
7
|
+
Author-email: benjamin.atkinson@anu.edu.au
|
|
8
|
+
Project-URL: Bug Tracker, https://gitlab.com/chilton-group/tau2/issues
|
|
9
|
+
Project-URL: Documentation, https://chilton-group.gitlab.io/tau2
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: numpy
|
|
23
|
+
Requires-Dist: scipy
|
|
24
|
+
Requires-Dist: h5py
|
|
25
|
+
Requires-Dist: dask[distributed]
|
|
26
|
+
Requires-Dist: matplotlib
|
|
27
|
+
Requires-Dist: numba
|
|
28
|
+
Requires-Dist: python-flint
|
|
29
|
+
Requires-Dist: mpmath
|
|
30
|
+
Requires-Dist: argcomplete
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: project-url
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: requires-python
|
|
40
|
+
Dynamic: summary
|
|
41
|
+
|
|
42
|
+
# tau2
|
|
43
|
+
|
|
44
|
+
`tau2` is a python package for simulating magnetic relaxation.
|
|
45
|
+
|
|
46
|
+
# Installation via `pip`
|
|
47
|
+
|
|
48
|
+
Install `tau2` using `pip` (if using a shared machine, add the `--user` argument after `install`)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
pip install tau2
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
# Updating
|
|
55
|
+
|
|
56
|
+
Update the code using `pip` (if using a shared machine, add the `--user` argument after `install`)
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
pip install tau2 --upgrade
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
# Installation with `pip` editable install
|
|
63
|
+
|
|
64
|
+
**Only do this if you are developing (i.e. changing) the code.**
|
|
65
|
+
|
|
66
|
+
Clone a copy of this repository, preferably while within a directory called git
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
mkdir -p git; cd git
|
|
70
|
+
git clone https://gitlab.com/chilton-group/tau2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Navigate to the package directory
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
cd tau2/packages
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
and install the package in editable mode (if using a shared machine, add the `--user` argument after `install`)
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
pip install -e .
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
When you're done developing (i.e. your changes have been merged to the master),
|
|
86
|
+
or if you just want to use the current release version of the package, uninstall using `pip`
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
pip uninstall tau2
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
and follow the Installation via `pip` instructions above.
|
|
93
|
+
|
|
94
|
+
# Usage
|
|
95
|
+
|
|
96
|
+
The `tau2` command line interface can be invoked with
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
tau2 -h
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
which prints a list of available subprograms.
|
|
103
|
+
|
|
104
|
+
Additional options for the `raman` and `orbach` programs can be viewed with `--advanced_help`.
|
|
105
|
+
|
|
106
|
+
# Documentation
|
|
107
|
+
|
|
108
|
+
The [documentation](https://chilton-group.gitlab.io/tau2/) for this package is hosted by gitlab, and is automatically generated whenever new code is committed to the `main` branch. The automatic generation of this documentation relies on a common layout for comments and docstrings within the code, see [contributing](https://gitlab.com/chilton-group/group-wiki/-/wikis/Contributing:-General) for more information.
|
|
109
|
+
|
|
110
|
+
# Development
|
|
111
|
+
|
|
112
|
+
Before making changes to this repository, please follow the steps outlined in the [Chilton group wiki](https://gitlab.com/chilton-group/group-wiki/-/wikis/Contributing:-General).
|
|
113
|
+
|
|
114
|
+
# Bugs
|
|
115
|
+
|
|
116
|
+
If you believe you have a bug, *please check that you are using the most up to date version of the code*.
|
|
117
|
+
|
|
118
|
+
If that does not fix the problem, please create an issue on GitLab detailing the following:
|
|
119
|
+
- The commands you entered
|
|
120
|
+
- The error message
|
|
121
|
+
|
|
122
|
+
Remember to simplify the problem as much as possible in order to provide a minimum working example, e.g. an example for a small molecule rather than one with 100000 atoms.
|
|
123
|
+
|
|
124
|
+
Then, look at the code, try and figure out what you think is wrong if possible, and include this in your issue.
|
tau2-1.0.0/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# tau2
|
|
2
|
+
|
|
3
|
+
`tau2` is a python package for simulating magnetic relaxation.
|
|
4
|
+
|
|
5
|
+
# Installation via `pip`
|
|
6
|
+
|
|
7
|
+
Install `tau2` using `pip` (if using a shared machine, add the `--user` argument after `install`)
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
pip install tau2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
# Updating
|
|
14
|
+
|
|
15
|
+
Update the code using `pip` (if using a shared machine, add the `--user` argument after `install`)
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
pip install tau2 --upgrade
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
# Installation with `pip` editable install
|
|
22
|
+
|
|
23
|
+
**Only do this if you are developing (i.e. changing) the code.**
|
|
24
|
+
|
|
25
|
+
Clone a copy of this repository, preferably while within a directory called git
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
mkdir -p git; cd git
|
|
29
|
+
git clone https://gitlab.com/chilton-group/tau2
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Navigate to the package directory
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
cd tau2/packages
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
and install the package in editable mode (if using a shared machine, add the `--user` argument after `install`)
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pip install -e .
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
When you're done developing (i.e. your changes have been merged to the master),
|
|
45
|
+
or if you just want to use the current release version of the package, uninstall using `pip`
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
pip uninstall tau2
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
and follow the Installation via `pip` instructions above.
|
|
52
|
+
|
|
53
|
+
# Usage
|
|
54
|
+
|
|
55
|
+
The `tau2` command line interface can be invoked with
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
tau2 -h
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
which prints a list of available subprograms.
|
|
62
|
+
|
|
63
|
+
Additional options for the `raman` and `orbach` programs can be viewed with `--advanced_help`.
|
|
64
|
+
|
|
65
|
+
# Documentation
|
|
66
|
+
|
|
67
|
+
The [documentation](https://chilton-group.gitlab.io/tau2/) for this package is hosted by gitlab, and is automatically generated whenever new code is committed to the `main` branch. The automatic generation of this documentation relies on a common layout for comments and docstrings within the code, see [contributing](https://gitlab.com/chilton-group/group-wiki/-/wikis/Contributing:-General) for more information.
|
|
68
|
+
|
|
69
|
+
# Development
|
|
70
|
+
|
|
71
|
+
Before making changes to this repository, please follow the steps outlined in the [Chilton group wiki](https://gitlab.com/chilton-group/group-wiki/-/wikis/Contributing:-General).
|
|
72
|
+
|
|
73
|
+
# Bugs
|
|
74
|
+
|
|
75
|
+
If you believe you have a bug, *please check that you are using the most up to date version of the code*.
|
|
76
|
+
|
|
77
|
+
If that does not fix the problem, please create an issue on GitLab detailing the following:
|
|
78
|
+
- The commands you entered
|
|
79
|
+
- The error message
|
|
80
|
+
|
|
81
|
+
Remember to simplify the problem as much as possible in order to provide a minimum working example, e.g. an example for a small molecule rather than one with 100000 atoms.
|
|
82
|
+
|
|
83
|
+
Then, look at the code, try and figure out what you think is wrong if possible, and include this in your issue.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[tool.semantic_release]
|
|
2
|
+
version_variables = [
|
|
3
|
+
'setup.py:__version__',
|
|
4
|
+
'tau2/__version__.py:__version__'
|
|
5
|
+
]
|
|
6
|
+
upload_to_pypi=true
|
|
7
|
+
branch = "main"
|
|
8
|
+
hvcs="gitlab"
|
|
9
|
+
|
|
10
|
+
[tool.semantic_release.branches.main]
|
|
11
|
+
match = "(master|main)"
|
|
12
|
+
|
|
13
|
+
[tool.semantic_release.changelog]
|
|
14
|
+
template_dir = "templates"
|
|
15
|
+
exclude_commit_patterns = []
|
|
16
|
+
|
|
17
|
+
[tool.semantic_release.default_templates]
|
|
18
|
+
changelog_file = "CHANGELOG.md"
|
|
19
|
+
|
|
20
|
+
[tool.semantic_release.commit_author]
|
|
21
|
+
env = "GIT_COMMIT_AUTHOR"
|
|
22
|
+
default = "semantic-release <semantic-release>"
|
|
23
|
+
|
|
24
|
+
[tool.semantic_release.commit_parser_options]
|
|
25
|
+
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
|
|
26
|
+
minor_tags = ["feat"]
|
|
27
|
+
patch_tags = ["fix", "perf"]
|
|
28
|
+
|
|
29
|
+
[tool.semantic_release.remote]
|
|
30
|
+
name = "origin"
|
|
31
|
+
type = "gitlab"
|
|
32
|
+
ignore_token_for_push = false
|
|
33
|
+
hvcs = "gitlab"
|
|
34
|
+
|
|
35
|
+
[tool.semantic_release.remote.token]
|
|
36
|
+
env = "GL_TOKEN"
|
|
37
|
+
|
|
38
|
+
[tool.semantic_release.publish]
|
|
39
|
+
dist_glob_patterns = ["dist/*"]
|
|
40
|
+
upload_to_vcs_release = true
|
tau2-1.0.0/setup.cfg
ADDED
tau2-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import setuptools
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
# DO NOT EDIT THIS NUMBER!
|
|
7
|
+
# IT IS AUTOMATICALLY CHANGED BY python-semantic-release
|
|
8
|
+
__version__ = "1.0.0"
|
|
9
|
+
|
|
10
|
+
setuptools.setup(
|
|
11
|
+
name="tau2",
|
|
12
|
+
version=__version__,
|
|
13
|
+
author="Ben Atkinson",
|
|
14
|
+
author_email="benjamin.atkinson@anu.edu.au",
|
|
15
|
+
description="A package for calculating magnetic relaxation rates", # noqa
|
|
16
|
+
long_description=long_description,
|
|
17
|
+
long_description_content_type="text/markdown",
|
|
18
|
+
url="https://gitlab.com/chilton-group/tau2",
|
|
19
|
+
project_urls={
|
|
20
|
+
"Bug Tracker": "https://gitlab.com/chilton-group/tau2/issues",
|
|
21
|
+
"Documentation": "https://chilton-group.gitlab.io/tau2"
|
|
22
|
+
},
|
|
23
|
+
classifiers=[
|
|
24
|
+
'Programming Language :: Python :: 3',
|
|
25
|
+
'Programming Language :: Python :: 3.8',
|
|
26
|
+
'Programming Language :: Python :: 3.9',
|
|
27
|
+
'Programming Language :: Python :: 3.10',
|
|
28
|
+
'Programming Language :: Python :: 3.11',
|
|
29
|
+
'License :: OSI Approved :: MIT License',
|
|
30
|
+
'Operating System :: OS Independent',
|
|
31
|
+
'Intended Audience :: Science/Research',
|
|
32
|
+
'Topic :: Scientific/Engineering :: Chemistry',
|
|
33
|
+
'Topic :: Scientific/Engineering :: Physics',
|
|
34
|
+
],
|
|
35
|
+
package_dir={"":"."},
|
|
36
|
+
packages=setuptools.find_packages(),
|
|
37
|
+
entry_points={
|
|
38
|
+
'console_scripts': [
|
|
39
|
+
'tau2=tau2.__main__:main',
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
python_requires=">=3.8",
|
|
43
|
+
install_requires=[
|
|
44
|
+
'numpy',
|
|
45
|
+
'scipy',
|
|
46
|
+
'h5py',
|
|
47
|
+
'dask[distributed]',
|
|
48
|
+
'matplotlib',
|
|
49
|
+
'numba',
|
|
50
|
+
'python-flint',
|
|
51
|
+
'mpmath',
|
|
52
|
+
'argcomplete'
|
|
53
|
+
],
|
|
54
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.spatial.transform import Rotation
|
|
3
|
+
|
|
4
|
+
from .constants import MU_B_CM_T, G_E
|
|
5
|
+
|
|
6
|
+
def setup_field_orientation(args, angmom, spin, orientations=1):
|
|
7
|
+
"""Determines the field direction and magnitudes for the calculation.
|
|
8
|
+
|
|
9
|
+
This function handles the g-tensor reorientation to align the calculation's
|
|
10
|
+
z-axis with the principal magnetic axis of the ground state doublet. It also
|
|
11
|
+
interprets user-provided field vectors and magnitudes from the command line.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
args (argparse.Namespace): The parsed command-line arguments.
|
|
15
|
+
angmom (np.ndarray): The angular momentum matrices (L_x, L_y, L_z).
|
|
16
|
+
spin (np.ndarray): The spin matrices (S_x, S_y, S_z).
|
|
17
|
+
orientations (int): The number of orientations being calculated.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
tuple: A tuple containing:
|
|
21
|
+
- B_unit (np.ndarray): The normalised field direction vector for a single calculation.
|
|
22
|
+
- magnitudes_to_run (list): A list of field magnitudes (in Tesla).
|
|
23
|
+
- rotation_matrix (np.ndarray): The matrix to rotate from the input to the principal axis frame.
|
|
24
|
+
"""
|
|
25
|
+
rotation_matrix = np.identity(3)
|
|
26
|
+
principal_frame_z_axis = np.array([0.0, 0.0, 1.0])
|
|
27
|
+
|
|
28
|
+
if args.reorient:
|
|
29
|
+
print("\nReorienting: z-axis will be aligned with the principal g-tensor axis.")
|
|
30
|
+
mu_op = MU_B_CM_T * (angmom + G_E * spin)
|
|
31
|
+
mu_op_doublet = mu_op[:, 0:2, 0:2]
|
|
32
|
+
g_tensor = 2 * np.real(np.einsum('kab,lba->kl', mu_op_doublet, mu_op_doublet))
|
|
33
|
+
g_squared = g_tensor.T @ g_tensor
|
|
34
|
+
eigvals, eigvecs = np.linalg.eigh(g_squared)
|
|
35
|
+
|
|
36
|
+
principal_axis = eigvecs[:, np.argmax(eigvals)]
|
|
37
|
+
print(f"Principal g-axis in input frame: [{principal_axis[0]:.4f}, {principal_axis[1]:.4f}, {principal_axis[2]:.4f}]")
|
|
38
|
+
|
|
39
|
+
r, _ = Rotation.align_vectors([principal_axis], [principal_frame_z_axis])
|
|
40
|
+
rotation_matrix = r.as_matrix()
|
|
41
|
+
|
|
42
|
+
if args.field_direction:
|
|
43
|
+
if orientations == 1:
|
|
44
|
+
print("Using user-provided --field_direction relative to the principal axis frame.")
|
|
45
|
+
field_direction_principal_frame = np.array(args.field_direction)
|
|
46
|
+
else:
|
|
47
|
+
field_direction_principal_frame = principal_frame_z_axis
|
|
48
|
+
|
|
49
|
+
field_direction_input_frame = rotation_matrix @ field_direction_principal_frame
|
|
50
|
+
norm = np.linalg.norm(field_direction_principal_frame)
|
|
51
|
+
|
|
52
|
+
if norm < 1e-9:
|
|
53
|
+
if orientations == 1:
|
|
54
|
+
print("Warning: Field direction vector has zero magnitude. Using principal frame z-axis.")
|
|
55
|
+
B_unit = rotation_matrix.T @ principal_frame_z_axis
|
|
56
|
+
B_unit_principal = principal_frame_z_axis
|
|
57
|
+
else:
|
|
58
|
+
B_unit = field_direction_input_frame / np.linalg.norm(field_direction_input_frame)
|
|
59
|
+
B_unit_principal = field_direction_principal_frame / norm
|
|
60
|
+
|
|
61
|
+
if orientations == 1:
|
|
62
|
+
print("\nNormalised field direction:")
|
|
63
|
+
print(f" principal axis frame:\t[{B_unit_principal[0]:.4f}, {B_unit_principal[1]:.4f}, {B_unit_principal[2]:.4f}]")
|
|
64
|
+
print(f" input frame:\t\t[{B_unit[0]:.4f}, {B_unit[1]:.4f}, {B_unit[2]:.4f}]")
|
|
65
|
+
|
|
66
|
+
if args.field_magnitudes:
|
|
67
|
+
magnitudes_to_run = args.field_magnitudes
|
|
68
|
+
elif args.field_direction:
|
|
69
|
+
magnitudes_to_run = [norm]
|
|
70
|
+
else:
|
|
71
|
+
magnitudes_to_run = [0.0002]
|
|
72
|
+
|
|
73
|
+
return B_unit, magnitudes_to_run, rotation_matrix
|