quadlib 0.1.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.
- quadlib-0.1.0/CITATION.cff +26 -0
- quadlib-0.1.0/HEADER +4 -0
- quadlib-0.1.0/LICENSE +19 -0
- quadlib-0.1.0/MANIFEST.in +4 -0
- quadlib-0.1.0/PKG-INFO +135 -0
- quadlib-0.1.0/README.md +97 -0
- quadlib-0.1.0/pyproject.toml +97 -0
- quadlib-0.1.0/setup.cfg +4 -0
- quadlib-0.1.0/src/quadlib/__init__.py +39 -0
- quadlib-0.1.0/src/quadlib/basis/__init__.py +60 -0
- quadlib-0.1.0/src/quadlib/basis/boson.py +61 -0
- quadlib-0.1.0/src/quadlib/basis/discrete.py +71 -0
- quadlib-0.1.0/src/quadlib/basis/expdvr.py +80 -0
- quadlib-0.1.0/src/quadlib/basis/hodvr.py +51 -0
- quadlib-0.1.0/src/quadlib/basis/jbasis.py +87 -0
- quadlib-0.1.0/src/quadlib/basis/sindvr.py +97 -0
- quadlib-0.1.0/src/quadlib/basis/spin.py +64 -0
- quadlib-0.1.0/src/quadlib/cli/__init__.py +0 -0
- quadlib-0.1.0/src/quadlib/cli/qlb_offset_oper_dof.py +34 -0
- quadlib-0.1.0/src/quadlib/experimental/__init__.py +17 -0
- quadlib-0.1.0/src/quadlib/experimental/cpd_eom.py +95 -0
- quadlib-0.1.0/src/quadlib/experimental/mctdh.py +32 -0
- quadlib-0.1.0/src/quadlib/experimental/node.py +259 -0
- quadlib-0.1.0/src/quadlib/experimental/pdof.py +9 -0
- quadlib-0.1.0/src/quadlib/experimental/tree.py +138 -0
- quadlib-0.1.0/src/quadlib/hdmctdh/__init__.py +0 -0
- quadlib-0.1.0/src/quadlib/hdmctdh/rundirectory.py +74 -0
- quadlib-0.1.0/src/quadlib/legacy/__init__.py +14 -0
- quadlib-0.1.0/src/quadlib/legacy/math.py +1337 -0
- quadlib-0.1.0/src/quadlib/operator/sop.py +250 -0
- quadlib-0.1.0/src/quadlib/propagation/__init__.py +17 -0
- quadlib-0.1.0/src/quadlib/propagation/cpd.py +35 -0
- quadlib-0.1.0/src/quadlib/propagation/exact.py +139 -0
- quadlib-0.1.0/src/quadlib/propagation/integrators.py +108 -0
- quadlib-0.1.0/src/quadlib/tools/__init__.py +0 -0
- quadlib-0.1.0/src/quadlib/tools/bath.py +84 -0
- quadlib-0.1.0/src/quadlib/tools/constants.py +289 -0
- quadlib-0.1.0/src/quadlib/tools/iterators.py +276 -0
- quadlib-0.1.0/src/quadlib/tools/linalg.py +215 -0
- quadlib-0.1.0/src/quadlib/tools/pulses.py +187 -0
- quadlib-0.1.0/src/quadlib/tools/spectra.py +179 -0
- quadlib-0.1.0/src/quadlib/tools/tensor.py +227 -0
- quadlib-0.1.0/src/quadlib/wavefunction/__init__.py +0 -0
- quadlib-0.1.0/src/quadlib/wavefunction/wfn_cpd.py +266 -0
- quadlib-0.1.0/src/quadlib/wavefunction/wfn_exact.py +147 -0
- quadlib-0.1.0/src/quadlib.egg-info/PKG-INFO +135 -0
- quadlib-0.1.0/src/quadlib.egg-info/SOURCES.txt +62 -0
- quadlib-0.1.0/src/quadlib.egg-info/dependency_links.txt +1 -0
- quadlib-0.1.0/src/quadlib.egg-info/entry_points.txt +2 -0
- quadlib-0.1.0/src/quadlib.egg-info/requires.txt +15 -0
- quadlib-0.1.0/src/quadlib.egg-info/top_level.txt +1 -0
- quadlib-0.1.0/tests/test_cli.py +15 -0
- quadlib-0.1.0/tests/test_cpd.py +257 -0
- quadlib-0.1.0/tests/test_exact.py +128 -0
- quadlib-0.1.0/tests/test_integrate.py +46 -0
- quadlib-0.1.0/tests/test_linalg.py +51 -0
- quadlib-0.1.0/tests/test_simdiag.py +60 -0
- quadlib-0.1.0/tests/test_sindvr.py +48 -0
- quadlib-0.1.0/tests/test_sop.py +140 -0
- quadlib-0.1.0/tests/test_spectra.py +43 -0
- quadlib-0.1.0/tests/test_spin_boson.py +56 -0
- quadlib-0.1.0/tests/test_tensor.py +158 -0
- quadlib-0.1.0/tests/test_tree.py +90 -0
- quadlib-0.1.0/tests/test_wfn_exact.py +61 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: quadlib
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the
|
|
5
|
+
metadata from this file.
|
|
6
|
+
type: software
|
|
7
|
+
authors:
|
|
8
|
+
- given-names: Oriol
|
|
9
|
+
family-names: Vendrell
|
|
10
|
+
email: oriol.vendrell@uni-heidelberg.de
|
|
11
|
+
affiliation: Heidelberg University
|
|
12
|
+
orcid: 'https://orcid.org/0000-0003-4629-414X'
|
|
13
|
+
- given-names: Sudip
|
|
14
|
+
family-names: Sasmal
|
|
15
|
+
email: sudipsasmal.chem@gmail.com
|
|
16
|
+
repository-code: 'https://gitlab.com/tc-heidelberg/quadlib'
|
|
17
|
+
abstract: >-
|
|
18
|
+
QuaDLib: Quantum Dynamics Library for Research,
|
|
19
|
+
Development and Education: a pure-Python library providing
|
|
20
|
+
utilities for quantum dynamics. It is intended for
|
|
21
|
+
research, development, and educational use and builds on
|
|
22
|
+
established numerical libraries.
|
|
23
|
+
license: MIT
|
|
24
|
+
# version and date-released are stamped at release time by tools/publish.sh
|
|
25
|
+
version: 0.1.0
|
|
26
|
+
date-released: '2026-10-06'
|
quadlib-0.1.0/HEADER
ADDED
quadlib-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (C) 2018-2026 The Theoretical Chemistry Group, Heidelberg University
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
quadlib-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quadlib
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: QuaDLib: Quantum Dynamics Library for Research, Development and Education
|
|
5
|
+
Author-email: Oriol Vendrell <oriol.vendrell@uni-heidelberg.de>, Sudip Sasmal <sudipsasmal.chem@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/tc-heidelberg/quadlib
|
|
8
|
+
Project-URL: Repository, https://gitlab.com/tc-heidelberg/quadlib
|
|
9
|
+
Project-URL: Issues, https://gitlab.com/tc-heidelberg/quadlib/-/issues
|
|
10
|
+
Keywords: quantum dynamics,MCTDH,tensor decomposition,DVR,wavepacket propagation
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy
|
|
26
|
+
Requires-Dist: scipy
|
|
27
|
+
Provides-Extra: plot
|
|
28
|
+
Requires-Dist: matplotlib; extra == "plot"
|
|
29
|
+
Provides-Extra: jupyter
|
|
30
|
+
Requires-Dist: matplotlib; extra == "jupyter"
|
|
31
|
+
Requires-Dist: jupyterlab; extra == "jupyter"
|
|
32
|
+
Requires-Dist: ipykernel; extra == "jupyter"
|
|
33
|
+
Requires-Dist: jupytext; extra == "jupyter"
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest; extra == "dev"
|
|
36
|
+
Requires-Dist: ruff; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# QuaDLib
|
|
40
|
+
|
|
41
|
+
Quantum Dynamics Library for Research, Development and Education.
|
|
42
|
+
|
|
43
|
+
QuaDLib is a pure-Python library for quantum dynamics, built on NumPy
|
|
44
|
+
and SciPy. It serves as a test bed for methods development and as a
|
|
45
|
+
teaching tool; the tree-tensor-network (ML-MCTDH) methods it is meant
|
|
46
|
+
to host are not implemented yet.
|
|
47
|
+
|
|
48
|
+
## What works
|
|
49
|
+
|
|
50
|
+
- Primitive bases: sine, exponential and harmonic-oscillator DVRs
|
|
51
|
+
(`Sindvr`, `Expdvr`, `HOdvr`), boson, spin-1/2, angular momentum and
|
|
52
|
+
discrete bases (`Boson`, `Spin`, `Jbasis`, `Discrete`).
|
|
53
|
+
- Sum-of-products operators (`SOP`), with their full dense or sparse
|
|
54
|
+
matrix representation.
|
|
55
|
+
- Numerically exact propagation of a full wavefunction tensor
|
|
56
|
+
(`WfnExact`, `quadlib.propagation.propagate_exact`), either by
|
|
57
|
+
integrating the TDSE with the SOP right-hand side (`solver='zvode'`)
|
|
58
|
+
or with `scipy.sparse.linalg.expm_multiply` on the sparse Hamiltonian
|
|
59
|
+
matrix (`solver='expm'`). The second is faster and exact to machine
|
|
60
|
+
precision as long as the sparse matrix fits in memory; operators with
|
|
61
|
+
dense matrices on several degrees of freedom in one term favour the
|
|
62
|
+
first.
|
|
63
|
+
- CPD wavefunctions (`WfnCPD`): norm, overlaps, reduced densities,
|
|
64
|
+
expectation values, and propagation of the coefficient vector with
|
|
65
|
+
frozen single-particle functions (`propagate_cpd_A`).
|
|
66
|
+
- Bath discretization of spectral densities (`quadlib.tools.bath`),
|
|
67
|
+
correlation-function spectra and Fourier transforms
|
|
68
|
+
(`quadlib.tools.spectra`).
|
|
69
|
+
- Reading the autocorrelation function of an existing Heidelberg MCTDH
|
|
70
|
+
run directory (`Rundirectory`).
|
|
71
|
+
|
|
72
|
+
## Experimental
|
|
73
|
+
|
|
74
|
+
`quadlib.experimental` holds unfinished or known-incorrect code and is
|
|
75
|
+
not imported by `quadlib`: the tree data structures (`Node`, `Tree`,
|
|
76
|
+
`Pdof`), placeholders for the MCTDH equations of motion, and the coupled
|
|
77
|
+
CPD equations of motion.
|
|
78
|
+
`quadlib.legacy` keeps older utilities that the library does not use.
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
Python 3.10 or later. NumPy and SciPy are the only required dependencies.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install quadlib
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Extras:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install "quadlib[plot]" # matplotlib, for the plotting helpers
|
|
92
|
+
pip install "quadlib[jupyter]" # JupyterLab and jupytext, for the notebooks
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
From source:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git clone https://gitlab.com/tc-heidelberg/quadlib.git
|
|
99
|
+
cd quadlib
|
|
100
|
+
pip install -e ".[plot,dev]" # dev adds pytest and ruff
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
or a specific release without cloning:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install git+https://gitlab.com/tc-heidelberg/quadlib.git@v0.1.0
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Tests and examples
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pytest # fast tests
|
|
113
|
+
pytest -m slow # long reference tests (about one minute)
|
|
114
|
+
ruff check # linter
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Worked examples are in `docs/notebooks` (jupytext format):
|
|
118
|
+
`spin_boson_example.py` (exact propagation of a spin-boson model),
|
|
119
|
+
`td-cpd_example.md` (CPD wavefunction), and `bath_tests.md` (bath
|
|
120
|
+
discretization).
|
|
121
|
+
|
|
122
|
+
## Development
|
|
123
|
+
|
|
124
|
+
Day-to-day development happens in a private repository within the group. This
|
|
125
|
+
repository carries tagged releases, so its history is one commit per release
|
|
126
|
+
rather than a record of development. Bug reports and questions are welcome
|
|
127
|
+
through the issue tracker.
|
|
128
|
+
|
|
129
|
+
## Authors
|
|
130
|
+
|
|
131
|
+
- Oriol Vendrell, oriol.vendrell@uni-heidelberg.de,
|
|
132
|
+
[ORCID 0000-0003-4629-414X](https://orcid.org/0000-0003-4629-414X)
|
|
133
|
+
- Sudip Sasmal, sudipsasmal.chem@gmail.com
|
|
134
|
+
|
|
135
|
+
MIT License. See `CITATION.cff` for how to cite.
|
quadlib-0.1.0/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# QuaDLib
|
|
2
|
+
|
|
3
|
+
Quantum Dynamics Library for Research, Development and Education.
|
|
4
|
+
|
|
5
|
+
QuaDLib is a pure-Python library for quantum dynamics, built on NumPy
|
|
6
|
+
and SciPy. It serves as a test bed for methods development and as a
|
|
7
|
+
teaching tool; the tree-tensor-network (ML-MCTDH) methods it is meant
|
|
8
|
+
to host are not implemented yet.
|
|
9
|
+
|
|
10
|
+
## What works
|
|
11
|
+
|
|
12
|
+
- Primitive bases: sine, exponential and harmonic-oscillator DVRs
|
|
13
|
+
(`Sindvr`, `Expdvr`, `HOdvr`), boson, spin-1/2, angular momentum and
|
|
14
|
+
discrete bases (`Boson`, `Spin`, `Jbasis`, `Discrete`).
|
|
15
|
+
- Sum-of-products operators (`SOP`), with their full dense or sparse
|
|
16
|
+
matrix representation.
|
|
17
|
+
- Numerically exact propagation of a full wavefunction tensor
|
|
18
|
+
(`WfnExact`, `quadlib.propagation.propagate_exact`), either by
|
|
19
|
+
integrating the TDSE with the SOP right-hand side (`solver='zvode'`)
|
|
20
|
+
or with `scipy.sparse.linalg.expm_multiply` on the sparse Hamiltonian
|
|
21
|
+
matrix (`solver='expm'`). The second is faster and exact to machine
|
|
22
|
+
precision as long as the sparse matrix fits in memory; operators with
|
|
23
|
+
dense matrices on several degrees of freedom in one term favour the
|
|
24
|
+
first.
|
|
25
|
+
- CPD wavefunctions (`WfnCPD`): norm, overlaps, reduced densities,
|
|
26
|
+
expectation values, and propagation of the coefficient vector with
|
|
27
|
+
frozen single-particle functions (`propagate_cpd_A`).
|
|
28
|
+
- Bath discretization of spectral densities (`quadlib.tools.bath`),
|
|
29
|
+
correlation-function spectra and Fourier transforms
|
|
30
|
+
(`quadlib.tools.spectra`).
|
|
31
|
+
- Reading the autocorrelation function of an existing Heidelberg MCTDH
|
|
32
|
+
run directory (`Rundirectory`).
|
|
33
|
+
|
|
34
|
+
## Experimental
|
|
35
|
+
|
|
36
|
+
`quadlib.experimental` holds unfinished or known-incorrect code and is
|
|
37
|
+
not imported by `quadlib`: the tree data structures (`Node`, `Tree`,
|
|
38
|
+
`Pdof`), placeholders for the MCTDH equations of motion, and the coupled
|
|
39
|
+
CPD equations of motion.
|
|
40
|
+
`quadlib.legacy` keeps older utilities that the library does not use.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Python 3.10 or later. NumPy and SciPy are the only required dependencies.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install quadlib
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Extras:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install "quadlib[plot]" # matplotlib, for the plotting helpers
|
|
54
|
+
pip install "quadlib[jupyter]" # JupyterLab and jupytext, for the notebooks
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
From source:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://gitlab.com/tc-heidelberg/quadlib.git
|
|
61
|
+
cd quadlib
|
|
62
|
+
pip install -e ".[plot,dev]" # dev adds pytest and ruff
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
or a specific release without cloning:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install git+https://gitlab.com/tc-heidelberg/quadlib.git@v0.1.0
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Tests and examples
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pytest # fast tests
|
|
75
|
+
pytest -m slow # long reference tests (about one minute)
|
|
76
|
+
ruff check # linter
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Worked examples are in `docs/notebooks` (jupytext format):
|
|
80
|
+
`spin_boson_example.py` (exact propagation of a spin-boson model),
|
|
81
|
+
`td-cpd_example.md` (CPD wavefunction), and `bath_tests.md` (bath
|
|
82
|
+
discretization).
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
Day-to-day development happens in a private repository within the group. This
|
|
87
|
+
repository carries tagged releases, so its history is one commit per release
|
|
88
|
+
rather than a record of development. Bug reports and questions are welcome
|
|
89
|
+
through the issue tracker.
|
|
90
|
+
|
|
91
|
+
## Authors
|
|
92
|
+
|
|
93
|
+
- Oriol Vendrell, oriol.vendrell@uni-heidelberg.de,
|
|
94
|
+
[ORCID 0000-0003-4629-414X](https://orcid.org/0000-0003-4629-414X)
|
|
95
|
+
- Sudip Sasmal, sudipsasmal.chem@gmail.com
|
|
96
|
+
|
|
97
|
+
MIT License. See `CITATION.cff` for how to cite.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "quadlib"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "QuaDLib: Quantum Dynamics Library for Research, Development and Education"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Oriol Vendrell", email = "oriol.vendrell@uni-heidelberg.de"},
|
|
14
|
+
{ name = "Sudip Sasmal", email = "sudipsasmal.chem@gmail.com"}
|
|
15
|
+
]
|
|
16
|
+
requires-python = ">=3.10"
|
|
17
|
+
keywords = [
|
|
18
|
+
"quantum dynamics",
|
|
19
|
+
"MCTDH",
|
|
20
|
+
"tensor decomposition",
|
|
21
|
+
"DVR",
|
|
22
|
+
"wavepacket propagation",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"Intended Audience :: Education",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Topic :: Scientific/Engineering :: Chemistry",
|
|
35
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
dependencies = [
|
|
39
|
+
"numpy",
|
|
40
|
+
"scipy",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
# the plotting helpers import matplotlib lazily, so it is not a core dependency
|
|
45
|
+
plot = ["matplotlib"]
|
|
46
|
+
jupyter = [
|
|
47
|
+
"matplotlib",
|
|
48
|
+
"jupyterlab",
|
|
49
|
+
"ipykernel",
|
|
50
|
+
"jupytext",
|
|
51
|
+
]
|
|
52
|
+
dev = ["pytest", "ruff"]
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
qlb-offset-oper-dof = "quadlib.cli.qlb_offset_oper_dof:main"
|
|
56
|
+
|
|
57
|
+
[project.urls]
|
|
58
|
+
Homepage = "https://gitlab.com/tc-heidelberg/quadlib"
|
|
59
|
+
Repository = "https://gitlab.com/tc-heidelberg/quadlib"
|
|
60
|
+
Issues = "https://gitlab.com/tc-heidelberg/quadlib/-/issues"
|
|
61
|
+
|
|
62
|
+
[tool.setuptools]
|
|
63
|
+
package-dir = {"" = "src"}
|
|
64
|
+
|
|
65
|
+
[tool.setuptools.packages.find]
|
|
66
|
+
where = ["src"]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
[tool.pytest.ini_options]
|
|
71
|
+
testpaths = ["tests"]
|
|
72
|
+
markers = ["slow: long-running reference tests (run with -m slow)"]
|
|
73
|
+
addopts = "-m 'not slow'"
|
|
74
|
+
|
|
75
|
+
# Linter only: `ruff check` (not enforced in CI). The formatter is not
|
|
76
|
+
# adopted; hand-aligned tables are protected in case it is run anyway.
|
|
77
|
+
[tool.ruff]
|
|
78
|
+
target-version = "py310"
|
|
79
|
+
extend-exclude = ["src/quadlib/legacy", "docs/notebooks/legacy"]
|
|
80
|
+
|
|
81
|
+
[tool.ruff.lint]
|
|
82
|
+
# pinned explicitly so results do not depend on the installed ruff version
|
|
83
|
+
select = ["F", "E4", "E7", "E9", "I", "B", "UP"]
|
|
84
|
+
# style choices kept on purpose: one-line `if x: continue`, short names
|
|
85
|
+
# such as `l`, lambda assignments; zip(strict=) not required
|
|
86
|
+
ignore = ["E701", "E702", "E741", "E731", "B905"]
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint.per-file-ignores]
|
|
89
|
+
# notebooks: cells that display a value, imports laid out by hand
|
|
90
|
+
"docs/notebooks/*" = ["B018", "E402", "I001", "F401"]
|
|
91
|
+
# public API grouped by hand in sections; keep that order
|
|
92
|
+
"src/quadlib/__init__.py" = ["I001", "F401"]
|
|
93
|
+
# subpackage __init__ files re-export their public names
|
|
94
|
+
"src/quadlib/*/__init__.py" = ["F401"]
|
|
95
|
+
|
|
96
|
+
[tool.ruff.format]
|
|
97
|
+
exclude = ["src/quadlib/tools/constants.py"]
|
quadlib-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# QuaDLib: QUAntum Dynamics LIBrary for research and methods development
|
|
2
|
+
# Copyright (C) 2018-2026, The Theoretical Chemistry Group, Heidelberg University
|
|
3
|
+
#
|
|
4
|
+
# This software is licensed under the MIT License (https://spdx.org/licenses/MIT.html)
|
|
5
|
+
|
|
6
|
+
import os.path
|
|
7
|
+
|
|
8
|
+
# -------------------------------------------------------------
|
|
9
|
+
# Make classes available in quadlib's namespace
|
|
10
|
+
from quadlib.wavefunction.wfn_exact import WfnExact
|
|
11
|
+
from quadlib.wavefunction.wfn_cpd import WfnCPD
|
|
12
|
+
|
|
13
|
+
from quadlib.basis.boson import Boson
|
|
14
|
+
from quadlib.basis.discrete import Discrete
|
|
15
|
+
from quadlib.basis.expdvr import Expdvr
|
|
16
|
+
from quadlib.basis.hodvr import HOdvr
|
|
17
|
+
from quadlib.basis.sindvr import Sindvr
|
|
18
|
+
from quadlib.basis.spin import Spin
|
|
19
|
+
from quadlib.basis.jbasis import Jbasis
|
|
20
|
+
|
|
21
|
+
from quadlib.operator.sop import SumOfProducts
|
|
22
|
+
from quadlib.operator.sop import SumOfProducts as SOP
|
|
23
|
+
from quadlib.operator.sop import OpType
|
|
24
|
+
|
|
25
|
+
from quadlib.hdmctdh.rundirectory import Rundirectory
|
|
26
|
+
#from quadlib.hdmctdh.mctdh_runner import MctdhRunner
|
|
27
|
+
|
|
28
|
+
# -------------------------------------------------------------
|
|
29
|
+
# Make submodules available
|
|
30
|
+
import quadlib.tools.constants as cons
|
|
31
|
+
import quadlib.tools.linalg as linalg
|
|
32
|
+
import quadlib.tools.spectra as spectra
|
|
33
|
+
import quadlib.tools.bath as bath
|
|
34
|
+
import quadlib.tools.tensor as tensor
|
|
35
|
+
import quadlib.wavefunction.wfn_exact as exactwfn
|
|
36
|
+
|
|
37
|
+
import quadlib.propagation as propagation
|
|
38
|
+
|
|
39
|
+
QDLPATH = os.path.dirname(__file__)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# QuaDLib: QUAntum Dynamics LIBrary for research and methods development
|
|
2
|
+
# Copyright (C) 2018-2026, The Theoretical Chemistry Group, Heidelberg University
|
|
3
|
+
#
|
|
4
|
+
# This software is licensed under the MIT License (https://spdx.org/licenses/MIT.html)
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
Primitive basis classes.
|
|
8
|
+
|
|
9
|
+
Every basis class in this subpackage exposes at minimum the attribute `n`
|
|
10
|
+
(the dimension of the single-DOF Hilbert space it represents).
|
|
11
|
+
|
|
12
|
+
DVR (position-space) bases additionally expose `x`, `w`, `xmat`, `dq1`,
|
|
13
|
+
`dq2`, `u`; see the :class:`DVRBasis` Protocol below.
|
|
14
|
+
|
|
15
|
+
Algebraic bases (Boson, Spin, Jbasis, Discrete) expose the operators
|
|
16
|
+
relevant to their physics with conventional capitalised names
|
|
17
|
+
(``PauliX``, ``Jz``, ``Nop``, ``C``, ``A``, …). The dimension is always
|
|
18
|
+
the lowercase `n`.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from typing import Protocol, runtime_checkable
|
|
22
|
+
|
|
23
|
+
import numpy as np
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@runtime_checkable
|
|
27
|
+
class Basis(Protocol):
|
|
28
|
+
"""Minimum interface every basis class provides."""
|
|
29
|
+
|
|
30
|
+
n: int # dimension of the single-DOF Hilbert space
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@runtime_checkable
|
|
34
|
+
class DVRBasis(Basis, Protocol):
|
|
35
|
+
"""Position-space (DVR) basis.
|
|
36
|
+
|
|
37
|
+
All array attributes are real unless otherwise noted.
|
|
38
|
+
|
|
39
|
+
Attributes
|
|
40
|
+
----------
|
|
41
|
+
x : ndarray of shape (n,)
|
|
42
|
+
DVR grid points.
|
|
43
|
+
w : ndarray of shape (n,)
|
|
44
|
+
DVR quadrature weights.
|
|
45
|
+
xmat : ndarray of shape (n, n)
|
|
46
|
+
Position operator in the DVR basis, equal to ``np.diag(x)``.
|
|
47
|
+
dq1 : ndarray of shape (n, n)
|
|
48
|
+
First-derivative matrix in the DVR basis.
|
|
49
|
+
dq2 : ndarray of shape (n, n)
|
|
50
|
+
Second-derivative matrix in the DVR basis.
|
|
51
|
+
u : ndarray of shape (n, n)
|
|
52
|
+
FBR → DVR transformation matrix.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
x: np.ndarray
|
|
56
|
+
w: np.ndarray
|
|
57
|
+
xmat: np.ndarray
|
|
58
|
+
dq1: np.ndarray
|
|
59
|
+
dq2: np.ndarray
|
|
60
|
+
u: np.ndarray
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Boson:
|
|
5
|
+
"""
|
|
6
|
+
Boson (harmonic oscillator in SQ) basis.
|
|
7
|
+
|
|
8
|
+
N -- integer: number of states, counting |0>.
|
|
9
|
+
|
|
10
|
+
Notes: the maximum number of particles for a given N is N-1
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, N):
|
|
15
|
+
"""
|
|
16
|
+
Initialize a boson (harmonic oscillator SQ) basis object
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
if not isinstance(N, (int, np.integer)):
|
|
20
|
+
raise ValueError('N needs to be an integer\n')
|
|
21
|
+
self.n = N
|
|
22
|
+
self.ONE = _ONE(N) # unit operator as a matrix
|
|
23
|
+
self.ONE_d = _ONE(N, diag=True) # unit operator as a diagonal oper.
|
|
24
|
+
self.Nop = _Bnum(N) # number operator
|
|
25
|
+
self.Nop_d = _Bnum(N, diag=True) # number operator as a diagonal oper.
|
|
26
|
+
self.C = _Bc(N) # creation operator
|
|
27
|
+
self.A = _Ba(N) # annihilation operator
|
|
28
|
+
self.H = np.diag(np.ones(N)*0.5) + self.Nop # Hamiltonian in au.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _ONE(n, diag=False):
|
|
32
|
+
if diag:
|
|
33
|
+
return np.ones(n, float)
|
|
34
|
+
else:
|
|
35
|
+
return np.diag(np.ones(n, float))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _Bnum(n, diag=False):
|
|
39
|
+
ln = np.asarray(list(range(0, n)), float)
|
|
40
|
+
if diag:
|
|
41
|
+
return ln
|
|
42
|
+
else:
|
|
43
|
+
return np.diag(ln)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _Bc(n):
|
|
47
|
+
bc = np.zeros((n, n), float)
|
|
48
|
+
for i in list(range(1, n)):
|
|
49
|
+
bc[i, i-1] = np.sqrt(i)
|
|
50
|
+
return bc
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _Ba(n):
|
|
54
|
+
ba = np.zeros((n, n), float)
|
|
55
|
+
for i in list(range(1, n)):
|
|
56
|
+
ba[i-1, i] = np.sqrt(i)
|
|
57
|
+
return ba
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Discrete:
|
|
5
|
+
"""
|
|
6
|
+
Discrete basis (e.g. to represent electronic-state degrees of freedom).
|
|
7
|
+
|
|
8
|
+
N -- integer: number of states, counting |0>.
|
|
9
|
+
|
|
10
|
+
Notes: the maximum number of particles for a given N is N-1
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
def __init__(self, N):
|
|
14
|
+
"""
|
|
15
|
+
Initialize a discrete basis object
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
if not isinstance(N, (int, np.integer)):
|
|
19
|
+
raise ValueError('N needs to be an integer\n')
|
|
20
|
+
self.n = N
|
|
21
|
+
self.ONE = _ONE(N) # unit operator as a matrix
|
|
22
|
+
self.ONE_d = _ONE(N, diag=True) # unit operator as a diagonal oper.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def P(self, n, diag=False):
|
|
26
|
+
"""
|
|
27
|
+
Projector |n><n|
|
|
28
|
+
|
|
29
|
+
n -- state number, n <= self.n
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
p = np.zeros((self.n), float)
|
|
33
|
+
p[n] = 1.0
|
|
34
|
+
if diag:
|
|
35
|
+
return p
|
|
36
|
+
else:
|
|
37
|
+
return np.diag(p)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def S(self, n, m):
|
|
41
|
+
"""
|
|
42
|
+
Symmetric operator |n><m| + |m><n|
|
|
43
|
+
|
|
44
|
+
n, m -- state number, n, m <= self.n
|
|
45
|
+
|
|
46
|
+
"""
|
|
47
|
+
p = np.zeros((self.n, self.n), float)
|
|
48
|
+
p[n, m] = 1.0
|
|
49
|
+
p[m, n] = 1.0
|
|
50
|
+
return p
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def Z(self, n, m):
|
|
54
|
+
"""
|
|
55
|
+
Off-diagonal operator |n><m|
|
|
56
|
+
|
|
57
|
+
n, m -- state number, n, m <= self.n
|
|
58
|
+
|
|
59
|
+
"""
|
|
60
|
+
p = np.zeros((self.n, self.n), float)
|
|
61
|
+
p[n, m] = 1.0
|
|
62
|
+
return p
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _ONE(n, diag=False):
|
|
66
|
+
if diag:
|
|
67
|
+
return np.ones(n, float)
|
|
68
|
+
else:
|
|
69
|
+
return np.diag(np.ones(n, float))
|
|
70
|
+
|
|
71
|
+
|