dyson-orca-tools 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Andres Ortega-Guerrero
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.
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: dyson_orca_tools
3
+ Version: 0.1.0
4
+ Summary: Dyson orca tools package
5
+ Author-email: Andres Ortega Guerrero <andres.ortega-guerrero@empa.ch>, Gonçalo Catarina <goncalo.catarina@empa.ch>
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Operating System :: MacOS :: MacOS X
12
+ Classifier: Programming Language :: Python :: 3
13
+ License-File: LICENSE
14
+ Requires-Dist: typer
15
+ Requires-Dist: numpy
16
+ Requires-Dist: pyscf ; extra == "cube"
17
+ Requires-Dist: bumpver==2023.1129 ; extra == "dev"
18
+ Requires-Dist: pre-commit==3.6.0 ; extra == "dev"
19
+ Requires-Dist: pytest ; extra == "dev"
20
+ Requires-Dist: matplotlib ; extra == "plot"
21
+ Project-URL: Homepage, https://github.com/AndresOrtegaGuerrero/dyson-orca-tools
22
+ Project-URL: Issues, https://github.com/AndresOrtegaGuerrero/dyson-orca-tools/issues
23
+ Provides-Extra: cube
24
+ Provides-Extra: dev
25
+ Provides-Extra: plot
26
+
27
+ # dyson-orca-tools
28
+ Python-based tool for computing Dyson orbitals from CASCI and CASSCF wavefunctions generated by the ORCA quantum chemistry package. It parses ORCA’s JSON-formatted wavefunction outputs to extract and process the relevant one-electron transition amplitudes.
29
+
30
+
31
+ ## Installation
32
+
33
+ ```shell
34
+ pip install dyson-orca-tools # core: Dyson orbitals, spectral functions, e-h maps
35
+ pip install "dyson-orca-tools[plot]" # + matplotlib figures
36
+ pip install "dyson-orca-tools[cube]" # + PySCF cube files
37
+ ```
38
+
39
+ For development, clone the repository and install it editable with the test tools:
40
+
41
+ ```shell
42
+ git clone https://github.com/AndresOrtegaGuerrero/dyson-orca-tools.git
43
+ cd dyson-orca-tools
44
+ pip install -e ".[dev,plot]"
45
+ pre-commit install
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ Three commands, in the order of a typical workflow:
51
+
52
+ ```shell
53
+ # 1. build the parameters file from the ORCA outputs (CI vectors, root energies, active space)
54
+ dyson_orca_tools prepare -i neutral/out.out \
55
+ -f cation/out.out:cation/mol.json \
56
+ -f anion/out.out:anion/mol.json \
57
+ -o results/params.json
58
+
59
+ # 2. Dyson orbitals + multireference spectral function
60
+ dyson_orca_tools spectrum -i neutral/mol.json -p results/params.json -o results \
61
+ --eta 0.05 [--shift E_F] [--cube] [--plot [--vertical]]
62
+
63
+ # 3. re-plot later without recomputing
64
+ dyson_orca_tools plot -o results --title "pentacene CASCI(12,12)" [--vertical]
65
+ ```
66
+
67
+ `spectrum` implements the spectral function of Kumar et al., *JACS* 2025, 147, 24993 (eq. 10):
68
+
69
+ ρ(ω) = η Σ_j |⟨Ψ±,j| a / a† |Ψ0⟩|² / ((ω − E_j)² + η²)
70
+
71
+ one peak per charged root j, with its Dyson orbital ϱ±,j and strength ⟨ϱ|ϱ⟩.
72
+
73
+ A single pair (one initial, one final state) is still available as
74
+ `dyson_orca_tools dyson -i initial.json -f final.json -p params.json`.
75
+
76
+ ### `prepare`
77
+
78
+ Reads the ORCA output of the initial state (`-i`) and of each N±1 calculation (`-f`, repeatable)
79
+ and writes the parameters file. Each `-f` names the ORCA output; its `orca_2json` file is taken as
80
+ `<name>.json` next to it, or given explicitly after a colon: `-f run/out.out:run/mol.json`.
81
+ Every `MULT=` block of an output becomes one run, so one output with `mult 2,4` yields two runs.
82
+ JSON paths are stored relative to the written parameters file.
83
+
84
+ The ORCA inputs need `PrintWF det` and a small `TPrintWF` (e.g. `1e-6`) in `%casscf`;
85
+ `prepare` prints Σc² per root so you can see how much the printout truncated.
86
+
87
+ ### `spectrum` outputs
88
+
89
+ | file | content |
90
+ |---|---|
91
+ | `dyson_peaks.csv` | label, side (−/+), multiplicity, ω (eV), strength, branch (CASCI/CASSCF) |
92
+ | `dyson_composition.csv` | per peak: strength, Σc² of the root, leading determinant, and d_p² for every active MO (HOMO−k / LUMO+k of the initial state); the d_p² sum to the strength |
93
+ | `spectral_function.dat` | ω, ρ(ω) on a grid (`--omega-min/max`, `--npts`) |
94
+ | `dyson_orbitals_ao.txt` | one column of AO coefficients per peak (ORCA AO order) |
95
+ | `dyson_<side><j>_m<mult>.cube` | with `--cube`, needs `pip install "dyson-orca-tools[cube]"` (PySCF) |
96
+ | `spectral_function.png/.pdf` | with `--plot`, needs `pip install "dyson-orca-tools[plot]"` (matplotlib) |
97
+
98
+ Peaks are labelled ϱ−,j / ϱ+,j by increasing energy of the N±1 state within each side (j = 0 is the ground state of the ion); energies are relative to the
99
+ initial ground state (removal negative, addition positive); `--shift` adds a rigid offset.
100
+
101
+ ### Orbitals: CASCI vs CASSCF
102
+
103
+ The tool detects from the MO overlap whether initial and final states share their orbitals.
104
+ With one orbital set (CASCI, `!MORead NoIter` with `ActOrbs/IntOrbs/ExtOrbs unchanged`) the
105
+ Dyson orbital is a pure active-space object. With separately optimized CASSCF orbitals the
106
+ non-orthogonal branch is used, including the relaxation of the inactive orbitals via the
107
+ core-block determinant (Schur complement); `spectrum` prints that determinant per run.
108
+
109
+ ### Parameters file
110
+
111
+ `initial` is the reference state (any charge/multiplicity); `final` is a list of runs, one per
112
+ ORCA JSON (one orbital set and multiplicity), each with its roots. Energies in Hartree. Runs may
113
+ differ from the initial state by ±1 electron and must change the multiplicity parity;
114
+ spin-forbidden roots (|ΔS| ≠ ½) are accepted and give zero strength.
115
+
116
+ ```json
117
+ {
118
+ "parameters": {
119
+ "initial": {
120
+ "nelc": 4, "norb": 4, "mult": 1, "energy": -230.5123,
121
+ "spin_ci": {"[2200]": 0.957520133, "[2020]": -0.224387606, "[0202]": -0.063982267}
122
+ },
123
+ "final": [
124
+ {"file": "../anion/mol.json", "nelc": 5, "norb": 4, "mult": 2,
125
+ "roots": [
126
+ {"energy": -230.4901, "spin_ci": {"[22u0]": 0.993890846, "[20u2]": -0.052026571}},
127
+ {"energy": -230.4012, "spin_ci": {"[2u20]": 0.98}}
128
+ ]},
129
+ {"file": "../cation/mol.json", "nelc": 3, "norb": 4, "mult": 2,
130
+ "roots": [{"energy": -230.2410, "spin_ci": {"[2u00]": 0.97}}]}
131
+ ]
132
+ }
133
+ }
134
+ ```
135
+
136
+ The `dyson` command still accepts the old single-state format (`final` as one dict with `spin_ci`).
137
+
138
+ ## 🧪 ORCA Instructions
139
+ To extract the required data from your CASSCF or CASCI calculations in ORCA, you must use the utility program `orca_2json`.
140
+
141
+ This tool converts ORCA wavefunction files into structured `.json` format for downstream processing.
142
+
143
+ ### 🔧 Configuration File
144
+ You can create a basename-dependent configuration file, named:
145
+
146
+ ```shell
147
+ BaseName.json.conf
148
+ ```
149
+ #### 📌 Notes
150
+ Replace BaseName with the actual name of your ORCA Basename described in your input (e.g., mol.gbw → mol.json.conf)
151
+
152
+ This file tells `orca_2json` which parts of the wavefunction to extract. You must include the molecular orbital coefficients and the overlap matrix.
153
+
154
+ Here is a recommended configuration:
155
+
156
+ ```json
157
+ {
158
+ "MOCoefficients": true,
159
+ "Basisset": true,
160
+ "MullikenCharge": false,
161
+ "LoewdinCharge": false,
162
+ "1elIntegrals": ["S"],
163
+ "JSONFormats": ["json"]
164
+ }
165
+ ```
166
+
167
+ After that you can obtain json file from the calculations
168
+
169
+ ```bash
170
+ orca_2json mol.gbw
171
+ ```
172
+
173
+
174
+ ## Releasing
175
+
176
+ Releases are published to PyPI by GitHub Actions when a `v*` tag is pushed. From an up-to-date `main`:
177
+
178
+ ```shell
179
+ bumpver update --patch # or --minor / --major: bumps pyproject.toml + version.py, commits, tags and pushes
180
+ ```
181
+
182
+ The `release` workflow then checks that the tag matches `dyson_orca_tools.__version__`, builds the sdist and wheel, uploads them to PyPI via trusted publishing, and creates a GitHub release with auto-generated notes.
183
+
184
+ ## Contact
185
+
186
+ If you have any questions or suggestions, feel free to reach out:
187
+
188
+ - **Authors**: Andres Ortega-Guerrero, Gonçalo Catarina
189
+ - **Email**: [andres.ortega-guerrero@empa.ch](andres.ortega-guerrero@empa.ch) , [goncalo.catarina@empa.ch](goncalo.catarina@empa.ch)
190
+
@@ -0,0 +1,163 @@
1
+ # dyson-orca-tools
2
+ Python-based tool for computing Dyson orbitals from CASCI and CASSCF wavefunctions generated by the ORCA quantum chemistry package. It parses ORCA’s JSON-formatted wavefunction outputs to extract and process the relevant one-electron transition amplitudes.
3
+
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ pip install dyson-orca-tools # core: Dyson orbitals, spectral functions, e-h maps
9
+ pip install "dyson-orca-tools[plot]" # + matplotlib figures
10
+ pip install "dyson-orca-tools[cube]" # + PySCF cube files
11
+ ```
12
+
13
+ For development, clone the repository and install it editable with the test tools:
14
+
15
+ ```shell
16
+ git clone https://github.com/AndresOrtegaGuerrero/dyson-orca-tools.git
17
+ cd dyson-orca-tools
18
+ pip install -e ".[dev,plot]"
19
+ pre-commit install
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Three commands, in the order of a typical workflow:
25
+
26
+ ```shell
27
+ # 1. build the parameters file from the ORCA outputs (CI vectors, root energies, active space)
28
+ dyson_orca_tools prepare -i neutral/out.out \
29
+ -f cation/out.out:cation/mol.json \
30
+ -f anion/out.out:anion/mol.json \
31
+ -o results/params.json
32
+
33
+ # 2. Dyson orbitals + multireference spectral function
34
+ dyson_orca_tools spectrum -i neutral/mol.json -p results/params.json -o results \
35
+ --eta 0.05 [--shift E_F] [--cube] [--plot [--vertical]]
36
+
37
+ # 3. re-plot later without recomputing
38
+ dyson_orca_tools plot -o results --title "pentacene CASCI(12,12)" [--vertical]
39
+ ```
40
+
41
+ `spectrum` implements the spectral function of Kumar et al., *JACS* 2025, 147, 24993 (eq. 10):
42
+
43
+ ρ(ω) = η Σ_j |⟨Ψ±,j| a / a† |Ψ0⟩|² / ((ω − E_j)² + η²)
44
+
45
+ one peak per charged root j, with its Dyson orbital ϱ±,j and strength ⟨ϱ|ϱ⟩.
46
+
47
+ A single pair (one initial, one final state) is still available as
48
+ `dyson_orca_tools dyson -i initial.json -f final.json -p params.json`.
49
+
50
+ ### `prepare`
51
+
52
+ Reads the ORCA output of the initial state (`-i`) and of each N±1 calculation (`-f`, repeatable)
53
+ and writes the parameters file. Each `-f` names the ORCA output; its `orca_2json` file is taken as
54
+ `<name>.json` next to it, or given explicitly after a colon: `-f run/out.out:run/mol.json`.
55
+ Every `MULT=` block of an output becomes one run, so one output with `mult 2,4` yields two runs.
56
+ JSON paths are stored relative to the written parameters file.
57
+
58
+ The ORCA inputs need `PrintWF det` and a small `TPrintWF` (e.g. `1e-6`) in `%casscf`;
59
+ `prepare` prints Σc² per root so you can see how much the printout truncated.
60
+
61
+ ### `spectrum` outputs
62
+
63
+ | file | content |
64
+ |---|---|
65
+ | `dyson_peaks.csv` | label, side (−/+), multiplicity, ω (eV), strength, branch (CASCI/CASSCF) |
66
+ | `dyson_composition.csv` | per peak: strength, Σc² of the root, leading determinant, and d_p² for every active MO (HOMO−k / LUMO+k of the initial state); the d_p² sum to the strength |
67
+ | `spectral_function.dat` | ω, ρ(ω) on a grid (`--omega-min/max`, `--npts`) |
68
+ | `dyson_orbitals_ao.txt` | one column of AO coefficients per peak (ORCA AO order) |
69
+ | `dyson_<side><j>_m<mult>.cube` | with `--cube`, needs `pip install "dyson-orca-tools[cube]"` (PySCF) |
70
+ | `spectral_function.png/.pdf` | with `--plot`, needs `pip install "dyson-orca-tools[plot]"` (matplotlib) |
71
+
72
+ Peaks are labelled ϱ−,j / ϱ+,j by increasing energy of the N±1 state within each side (j = 0 is the ground state of the ion); energies are relative to the
73
+ initial ground state (removal negative, addition positive); `--shift` adds a rigid offset.
74
+
75
+ ### Orbitals: CASCI vs CASSCF
76
+
77
+ The tool detects from the MO overlap whether initial and final states share their orbitals.
78
+ With one orbital set (CASCI, `!MORead NoIter` with `ActOrbs/IntOrbs/ExtOrbs unchanged`) the
79
+ Dyson orbital is a pure active-space object. With separately optimized CASSCF orbitals the
80
+ non-orthogonal branch is used, including the relaxation of the inactive orbitals via the
81
+ core-block determinant (Schur complement); `spectrum` prints that determinant per run.
82
+
83
+ ### Parameters file
84
+
85
+ `initial` is the reference state (any charge/multiplicity); `final` is a list of runs, one per
86
+ ORCA JSON (one orbital set and multiplicity), each with its roots. Energies in Hartree. Runs may
87
+ differ from the initial state by ±1 electron and must change the multiplicity parity;
88
+ spin-forbidden roots (|ΔS| ≠ ½) are accepted and give zero strength.
89
+
90
+ ```json
91
+ {
92
+ "parameters": {
93
+ "initial": {
94
+ "nelc": 4, "norb": 4, "mult": 1, "energy": -230.5123,
95
+ "spin_ci": {"[2200]": 0.957520133, "[2020]": -0.224387606, "[0202]": -0.063982267}
96
+ },
97
+ "final": [
98
+ {"file": "../anion/mol.json", "nelc": 5, "norb": 4, "mult": 2,
99
+ "roots": [
100
+ {"energy": -230.4901, "spin_ci": {"[22u0]": 0.993890846, "[20u2]": -0.052026571}},
101
+ {"energy": -230.4012, "spin_ci": {"[2u20]": 0.98}}
102
+ ]},
103
+ {"file": "../cation/mol.json", "nelc": 3, "norb": 4, "mult": 2,
104
+ "roots": [{"energy": -230.2410, "spin_ci": {"[2u00]": 0.97}}]}
105
+ ]
106
+ }
107
+ }
108
+ ```
109
+
110
+ The `dyson` command still accepts the old single-state format (`final` as one dict with `spin_ci`).
111
+
112
+ ## 🧪 ORCA Instructions
113
+ To extract the required data from your CASSCF or CASCI calculations in ORCA, you must use the utility program `orca_2json`.
114
+
115
+ This tool converts ORCA wavefunction files into structured `.json` format for downstream processing.
116
+
117
+ ### 🔧 Configuration File
118
+ You can create a basename-dependent configuration file, named:
119
+
120
+ ```shell
121
+ BaseName.json.conf
122
+ ```
123
+ #### 📌 Notes
124
+ Replace BaseName with the actual name of your ORCA Basename described in your input (e.g., mol.gbw → mol.json.conf)
125
+
126
+ This file tells `orca_2json` which parts of the wavefunction to extract. You must include the molecular orbital coefficients and the overlap matrix.
127
+
128
+ Here is a recommended configuration:
129
+
130
+ ```json
131
+ {
132
+ "MOCoefficients": true,
133
+ "Basisset": true,
134
+ "MullikenCharge": false,
135
+ "LoewdinCharge": false,
136
+ "1elIntegrals": ["S"],
137
+ "JSONFormats": ["json"]
138
+ }
139
+ ```
140
+
141
+ After that you can obtain json file from the calculations
142
+
143
+ ```bash
144
+ orca_2json mol.gbw
145
+ ```
146
+
147
+
148
+ ## Releasing
149
+
150
+ Releases are published to PyPI by GitHub Actions when a `v*` tag is pushed. From an up-to-date `main`:
151
+
152
+ ```shell
153
+ bumpver update --patch # or --minor / --major: bumps pyproject.toml + version.py, commits, tags and pushes
154
+ ```
155
+
156
+ The `release` workflow then checks that the tag matches `dyson_orca_tools.__version__`, builds the sdist and wheel, uploads them to PyPI via trusted publishing, and creates a GitHub release with auto-generated notes.
157
+
158
+ ## Contact
159
+
160
+ If you have any questions or suggestions, feel free to reach out:
161
+
162
+ - **Authors**: Andres Ortega-Guerrero, Gonçalo Catarina
163
+ - **Email**: [andres.ortega-guerrero@empa.ch](andres.ortega-guerrero@empa.ch) , [goncalo.catarina@empa.ch](goncalo.catarina@empa.ch)
@@ -0,0 +1,72 @@
1
+ [build-system]
2
+ requires = ["flit_core >=3.2,<4"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [tool.flit.module]
6
+ name = "dyson_orca_tools"
7
+
8
+ [project]
9
+ name = "dyson_orca_tools"
10
+ dynamic = ["version", "description"]
11
+ authors = [
12
+ {name = "Andres Ortega Guerrero", email = "andres.ortega-guerrero@empa.ch"},
13
+ {name = "Gonçalo Catarina", email = "goncalo.catarina@empa.ch"}
14
+
15
+ ]
16
+ readme = "README.md"
17
+ license = {file = 'LICENSE'}
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Operating System :: MacOS :: MacOS X",
23
+ "Programming Language :: Python :: 3",
24
+ ]
25
+ requires-python = ">=3.10"
26
+ dependencies = [
27
+ "typer",
28
+ "numpy",
29
+ ]
30
+
31
+
32
+
33
+ [project.optional-dependencies]
34
+ cube = [
35
+ "pyscf",
36
+ ]
37
+ plot = [
38
+ "matplotlib",
39
+ ]
40
+ dev = [
41
+ "bumpver==2023.1129",
42
+ "pre-commit==3.6.0",
43
+ "pytest",
44
+
45
+ ]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/AndresOrtegaGuerrero/dyson-orca-tools"
49
+ Issues = "https://github.com/AndresOrtegaGuerrero/dyson-orca-tools/issues"
50
+
51
+ [project.scripts]
52
+ dyson_orca_tools = 'dyson_orca_tools.cli.main:app'
53
+
54
+ [tool.bumpver]
55
+ current_version = "v0.1.0"
56
+ version_pattern = "vMAJOR.MINOR.PATCH[PYTAGNUM]"
57
+ commit_message = "Bump version {old_version} -> {new_version}."
58
+ tag_message = "Release {new_version}."
59
+ tag_scope = "default"
60
+ pre_commit_hook = ""
61
+ post_commit_hook = ""
62
+ commit = true
63
+ tag = true
64
+ push = true
65
+
66
+ [tool.bumpver.file_patterns]
67
+ "pyproject.toml" = [
68
+ 'current_version = "{version}"',
69
+ ]
70
+ "src/dyson_orca_tools/version.py" = [
71
+ '__version__ = "{pep440_version}"',
72
+ ]
@@ -0,0 +1,6 @@
1
+ "Dyson orca tools package"
2
+
3
+ from .version import __version__
4
+
5
+
6
+ __all__ = ["__version__"]
@@ -0,0 +1 @@
1
+ """CLI for dyson_orca_tools."""