qrotor 4.1.2__tar.gz → 4.2.1__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.
Potentially problematic release.
This version of qrotor might be problematic. Click here for more details.
- {qrotor-4.1.2 → qrotor-4.2.1}/PKG-INFO +54 -20
- {qrotor-4.1.2 → qrotor-4.2.1}/README.md +53 -19
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/_version.py +1 -1
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/constants.py +59 -21
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/plot.py +1 -1
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor.egg-info/PKG-INFO +54 -20
- {qrotor-4.1.2 → qrotor-4.2.1}/LICENSE +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/__init__.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/potential.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/rotate.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/solve.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/system.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor/systems.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor.egg-info/SOURCES.txt +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor.egg-info/dependency_links.txt +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor.egg-info/requires.txt +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/qrotor.egg-info/top_level.txt +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/setup.cfg +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/setup.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/tests/__init__.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/tests/test_constants.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/tests/test_potential.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/tests/test_rotate.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/tests/test_solve.py +0 -0
- {qrotor-4.1.2 → qrotor-4.2.1}/tests/test_system.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qrotor
|
|
3
|
-
Version: 4.1
|
|
3
|
+
Version: 4.2.1
|
|
4
4
|
Summary: QRotor
|
|
5
5
|
Author: Pablo Gila-Herranz
|
|
6
6
|
Author-email: pgila001@ikasle.ehu.eus
|
|
@@ -36,14 +36,28 @@ Dynamic: summary
|
|
|
36
36
|
|
|
37
37
|
<p align="center"><img width="60.0%" src="pics/qrotor.png"></p>
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
QRotor is a Python package used to study molecular rotations
|
|
41
|
+
based on the one-dimensional hindered-rotor model,
|
|
40
42
|
such as those of methyl and amine groups.
|
|
41
43
|
It can calculate their quantum energy levels and wavefunctions,
|
|
42
44
|
along with excitations and tunnel splittings.
|
|
43
|
-
These quantum systems are represented by the `qrotor.System()` object.
|
|
44
45
|
|
|
45
|
-
QRotor
|
|
46
|
-
|
|
46
|
+
QRotor systematically produces Quantum ESPRESSO SCF calculations to obtain
|
|
47
|
+
the rotational Potential Energy Surface (PES) of custom molecular structures.
|
|
48
|
+
This potential is used to solve the quantum hamiltonian of the hindered rotor model:
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
H = -B \frac{d^2}{d\varphi^2} + V(\varphi)
|
|
52
|
+
$$
|
|
53
|
+
|
|
54
|
+
where $B$ is the *kinetic rotational energy* constant,
|
|
55
|
+
|
|
56
|
+
$$
|
|
57
|
+
B = \frac{\hbar^2}{2I}=\frac{\hbar^2}{2\sum_{i}m_{i}r_{i}^{2}}
|
|
58
|
+
$$
|
|
59
|
+
|
|
60
|
+
Head to the [Usage](#usage) section for a quick hands-on introduction.
|
|
47
61
|
|
|
48
62
|
|
|
49
63
|
---
|
|
@@ -51,6 +65,7 @@ which are used to solve the quantum system.
|
|
|
51
65
|
|
|
52
66
|
# Installation
|
|
53
67
|
|
|
68
|
+
|
|
54
69
|
As always, it is recommended to install your packages in a virtual environment:
|
|
55
70
|
```bash
|
|
56
71
|
python3 -m venv .venv
|
|
@@ -60,6 +75,7 @@ source .venv/bin/activate
|
|
|
60
75
|
|
|
61
76
|
## With pip
|
|
62
77
|
|
|
78
|
+
|
|
63
79
|
Install or upgrade ATON with
|
|
64
80
|
```bash
|
|
65
81
|
pip install qrotor -U
|
|
@@ -68,6 +84,7 @@ pip install qrotor -U
|
|
|
68
84
|
|
|
69
85
|
## From source
|
|
70
86
|
|
|
87
|
+
|
|
71
88
|
Optionally, you can install ATON from the [GitHub repo](https://github.com/pablogila/qrotor/).
|
|
72
89
|
Clone the repository or download the [latest stable release](https://github.com/pablogila/qrotor/tags)
|
|
73
90
|
as a ZIP, unzip it, and run inside it:
|
|
@@ -81,6 +98,7 @@ pip install .
|
|
|
81
98
|
|
|
82
99
|
# Documentation
|
|
83
100
|
|
|
101
|
+
|
|
84
102
|
QRotor contains the following modules:
|
|
85
103
|
|
|
86
104
|
| | |
|
|
@@ -101,17 +119,18 @@ Check the [full documentation online](https://pablogila.github.io/qrotor/).
|
|
|
101
119
|
|
|
102
120
|
# Usage
|
|
103
121
|
|
|
104
|
-
|
|
122
|
+
|
|
123
|
+
## Solving quantum eigenvalues for one-dimensional rotor systems
|
|
124
|
+
|
|
105
125
|
|
|
106
126
|
Let's start with a basic calculation of the eigenvalues for a zero potential, corresponding to a free rotor.
|
|
107
|
-
A predefined synthetic potential can be used, see all available options in the [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) documentation.
|
|
108
127
|
Note that the default energy unit is meV unless stated otherwise.
|
|
109
128
|
|
|
110
129
|
```python
|
|
111
130
|
import qrotor as qr
|
|
112
131
|
system = qr.System()
|
|
113
132
|
system.gridsize = 200000 # Size of the potential grid
|
|
114
|
-
system.B = 1
|
|
133
|
+
system.B = 1 # Rotational inertia
|
|
115
134
|
system.potential_name = 'zero'
|
|
116
135
|
system.solve()
|
|
117
136
|
print(system.eigenvalues)
|
|
@@ -121,8 +140,10 @@ print(system.eigenvalues)
|
|
|
121
140
|
The accuracy of the calculation increases with bigger gridsizes,
|
|
122
141
|
but note that the runtime increases exponentially.
|
|
123
142
|
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
Predefined synthetic potentials can be used,
|
|
144
|
+
see all available options in the [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) documentation.
|
|
145
|
+
For example, we can solve the system for a hindered methyl group,
|
|
146
|
+
in a [cosine potential](https://pablogila.github.io/qrotor/qrotor/potential.html#cosine) of amplitude 30 meV:
|
|
126
147
|
|
|
127
148
|
```python
|
|
128
149
|
import qrotor as qr
|
|
@@ -139,10 +160,14 @@ qr.plot.wavefunction(system, levels=[0,1,2], square=True)
|
|
|
139
160
|
```
|
|
140
161
|
|
|
141
162
|
|
|
142
|
-
##
|
|
163
|
+
## Rotational PES from custom structures
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
QRotor can be used to calculate the rotational Potential Energy Surface (PES) from DFT calculations.
|
|
167
|
+
Currently only Quantum ESPRESSO is supported,
|
|
168
|
+
although other DFT codes can be easily implemented through [ATON](https://pablogila.github.io/aton).
|
|
143
169
|
|
|
144
|
-
|
|
145
|
-
To run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
170
|
+
First, run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
146
171
|
|
|
147
172
|
```python
|
|
148
173
|
import qrotor as qr
|
|
@@ -159,10 +184,13 @@ scf_files = qr.rotate.structure_qe('molecule.in', positions=atoms, angle=10, rep
|
|
|
159
184
|
api.slurm.sbatch(files=scf_files)
|
|
160
185
|
```
|
|
161
186
|
|
|
162
|
-
|
|
187
|
+
You can compile a `potential.csv` file with the calculated potential as a function of the angle,
|
|
188
|
+
and load it into a new [system](https://pablogila.github.io/qrotor/qrotor/system.html):
|
|
189
|
+
|
|
163
190
|
```python
|
|
164
|
-
# Compile a 'potential.csv' file with the calculated potential as a function of the angle, and load it into a new system
|
|
165
191
|
system = qr.potential.from_qe()
|
|
192
|
+
# Check the potential
|
|
193
|
+
qr.plot.potential(system)
|
|
166
194
|
# Solve the system, interpolating to a bigger gridsize
|
|
167
195
|
system.B = qr.B_CH3
|
|
168
196
|
system.solve(200000)
|
|
@@ -170,13 +198,15 @@ qr.plot.energies(system)
|
|
|
170
198
|
```
|
|
171
199
|
|
|
172
200
|
|
|
173
|
-
##
|
|
201
|
+
## Other quantum observables
|
|
202
|
+
|
|
174
203
|
|
|
175
|
-
|
|
176
|
-
below the potential maximum are also calculated upon solving the system:
|
|
204
|
+
The Zero-Point Energies (ZPEs), quantum tunnel splittings, excitations and energy level degeneracy
|
|
205
|
+
below the potential maximum are also calculated upon solving the [system](https://pablogila.github.io/qrotor/qrotor/system.html):
|
|
177
206
|
|
|
178
207
|
```python
|
|
179
208
|
system.solve()
|
|
209
|
+
print(system.eigenvalues[0])
|
|
180
210
|
print(system.splittings)
|
|
181
211
|
print(system.excitations)
|
|
182
212
|
print(system.deg)
|
|
@@ -185,7 +215,7 @@ print(system.deg)
|
|
|
185
215
|
An integer `System.deg` degeneracy (e.g. 3 for methyls)
|
|
186
216
|
indicates that the energy levels have been properly estimated.
|
|
187
217
|
However, if the degeneracy is a float instead,
|
|
188
|
-
|
|
218
|
+
you might want to check the splittings and excitations manually from the system eigenvalues.
|
|
189
219
|
|
|
190
220
|
To export the energies and the tunnel splittings of several calculations to a CSV file:
|
|
191
221
|
|
|
@@ -209,12 +239,14 @@ for further reference.
|
|
|
209
239
|
|
|
210
240
|
# Contributing
|
|
211
241
|
|
|
242
|
+
|
|
212
243
|
If you are interested in opening an issue or a pull request, please feel free to do so on [GitHub](https://github.com/pablogila/qrotor/).
|
|
213
244
|
For major changes, please get in touch first to discuss the details.
|
|
214
245
|
|
|
215
246
|
|
|
216
247
|
## Code style
|
|
217
248
|
|
|
249
|
+
|
|
218
250
|
Please try to follow some general guidelines:
|
|
219
251
|
- Use a code style consistent with the rest of the project.
|
|
220
252
|
- Include docstrings to document new additions.
|
|
@@ -224,6 +256,7 @@ Please try to follow some general guidelines:
|
|
|
224
256
|
|
|
225
257
|
## Automated testing
|
|
226
258
|
|
|
259
|
+
|
|
227
260
|
If you are modifying the source code, you should run the automated tests of the [`tests/`](https://github.com/pablogila/qrotor/tree/main/tests) folder to check that everything works as intended.
|
|
228
261
|
To do so, first install PyTest in your environment,
|
|
229
262
|
```bash
|
|
@@ -253,7 +286,7 @@ This runs Pdoc, updating links and pictures, and using the custom theme CSS temp
|
|
|
253
286
|
|
|
254
287
|
QRotor is currently under development.
|
|
255
288
|
Please cite it if you use it in your research,
|
|
256
|
-
>
|
|
289
|
+
> Gila-Herranz, P. (2024). QRotor: Solving one-dimensional hindered-rotor quantum systems. https://pablogila.github.io/qrotor
|
|
257
290
|
|
|
258
291
|
|
|
259
292
|
---
|
|
@@ -261,6 +294,7 @@ Please cite it if you use it in your research,
|
|
|
261
294
|
|
|
262
295
|
# License
|
|
263
296
|
|
|
297
|
+
|
|
264
298
|
Copyright (C) 2025 Pablo Gila-Herranz
|
|
265
299
|
This program is free software: you can redistribute it and/or modify
|
|
266
300
|
it under the terms of the **GNU Affero General Public License** as published
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
<p align="center"><img width="60.0%" src="pics/qrotor.png"></p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
QRotor is a Python package used to study molecular rotations
|
|
5
|
+
based on the one-dimensional hindered-rotor model,
|
|
4
6
|
such as those of methyl and amine groups.
|
|
5
7
|
It can calculate their quantum energy levels and wavefunctions,
|
|
6
8
|
along with excitations and tunnel splittings.
|
|
7
|
-
These quantum systems are represented by the `qrotor.System()` object.
|
|
8
9
|
|
|
9
|
-
QRotor
|
|
10
|
-
|
|
10
|
+
QRotor systematically produces Quantum ESPRESSO SCF calculations to obtain
|
|
11
|
+
the rotational Potential Energy Surface (PES) of custom molecular structures.
|
|
12
|
+
This potential is used to solve the quantum hamiltonian of the hindered rotor model:
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
H = -B \frac{d^2}{d\varphi^2} + V(\varphi)
|
|
16
|
+
$$
|
|
17
|
+
|
|
18
|
+
where $B$ is the *kinetic rotational energy* constant,
|
|
19
|
+
|
|
20
|
+
$$
|
|
21
|
+
B = \frac{\hbar^2}{2I}=\frac{\hbar^2}{2\sum_{i}m_{i}r_{i}^{2}}
|
|
22
|
+
$$
|
|
23
|
+
|
|
24
|
+
Head to the [Usage](#usage) section for a quick hands-on introduction.
|
|
11
25
|
|
|
12
26
|
|
|
13
27
|
---
|
|
@@ -15,6 +29,7 @@ which are used to solve the quantum system.
|
|
|
15
29
|
|
|
16
30
|
# Installation
|
|
17
31
|
|
|
32
|
+
|
|
18
33
|
As always, it is recommended to install your packages in a virtual environment:
|
|
19
34
|
```bash
|
|
20
35
|
python3 -m venv .venv
|
|
@@ -24,6 +39,7 @@ source .venv/bin/activate
|
|
|
24
39
|
|
|
25
40
|
## With pip
|
|
26
41
|
|
|
42
|
+
|
|
27
43
|
Install or upgrade ATON with
|
|
28
44
|
```bash
|
|
29
45
|
pip install qrotor -U
|
|
@@ -32,6 +48,7 @@ pip install qrotor -U
|
|
|
32
48
|
|
|
33
49
|
## From source
|
|
34
50
|
|
|
51
|
+
|
|
35
52
|
Optionally, you can install ATON from the [GitHub repo](https://github.com/pablogila/qrotor/).
|
|
36
53
|
Clone the repository or download the [latest stable release](https://github.com/pablogila/qrotor/tags)
|
|
37
54
|
as a ZIP, unzip it, and run inside it:
|
|
@@ -45,6 +62,7 @@ pip install .
|
|
|
45
62
|
|
|
46
63
|
# Documentation
|
|
47
64
|
|
|
65
|
+
|
|
48
66
|
QRotor contains the following modules:
|
|
49
67
|
|
|
50
68
|
| | |
|
|
@@ -65,17 +83,18 @@ Check the [full documentation online](https://pablogila.github.io/qrotor/).
|
|
|
65
83
|
|
|
66
84
|
# Usage
|
|
67
85
|
|
|
68
|
-
|
|
86
|
+
|
|
87
|
+
## Solving quantum eigenvalues for one-dimensional rotor systems
|
|
88
|
+
|
|
69
89
|
|
|
70
90
|
Let's start with a basic calculation of the eigenvalues for a zero potential, corresponding to a free rotor.
|
|
71
|
-
A predefined synthetic potential can be used, see all available options in the [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) documentation.
|
|
72
91
|
Note that the default energy unit is meV unless stated otherwise.
|
|
73
92
|
|
|
74
93
|
```python
|
|
75
94
|
import qrotor as qr
|
|
76
95
|
system = qr.System()
|
|
77
96
|
system.gridsize = 200000 # Size of the potential grid
|
|
78
|
-
system.B = 1
|
|
97
|
+
system.B = 1 # Rotational inertia
|
|
79
98
|
system.potential_name = 'zero'
|
|
80
99
|
system.solve()
|
|
81
100
|
print(system.eigenvalues)
|
|
@@ -85,8 +104,10 @@ print(system.eigenvalues)
|
|
|
85
104
|
The accuracy of the calculation increases with bigger gridsizes,
|
|
86
105
|
but note that the runtime increases exponentially.
|
|
87
106
|
|
|
88
|
-
|
|
89
|
-
|
|
107
|
+
Predefined synthetic potentials can be used,
|
|
108
|
+
see all available options in the [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) documentation.
|
|
109
|
+
For example, we can solve the system for a hindered methyl group,
|
|
110
|
+
in a [cosine potential](https://pablogila.github.io/qrotor/qrotor/potential.html#cosine) of amplitude 30 meV:
|
|
90
111
|
|
|
91
112
|
```python
|
|
92
113
|
import qrotor as qr
|
|
@@ -103,10 +124,14 @@ qr.plot.wavefunction(system, levels=[0,1,2], square=True)
|
|
|
103
124
|
```
|
|
104
125
|
|
|
105
126
|
|
|
106
|
-
##
|
|
127
|
+
## Rotational PES from custom structures
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
QRotor can be used to calculate the rotational Potential Energy Surface (PES) from DFT calculations.
|
|
131
|
+
Currently only Quantum ESPRESSO is supported,
|
|
132
|
+
although other DFT codes can be easily implemented through [ATON](https://pablogila.github.io/aton).
|
|
107
133
|
|
|
108
|
-
|
|
109
|
-
To run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
134
|
+
First, run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
110
135
|
|
|
111
136
|
```python
|
|
112
137
|
import qrotor as qr
|
|
@@ -123,10 +148,13 @@ scf_files = qr.rotate.structure_qe('molecule.in', positions=atoms, angle=10, rep
|
|
|
123
148
|
api.slurm.sbatch(files=scf_files)
|
|
124
149
|
```
|
|
125
150
|
|
|
126
|
-
|
|
151
|
+
You can compile a `potential.csv` file with the calculated potential as a function of the angle,
|
|
152
|
+
and load it into a new [system](https://pablogila.github.io/qrotor/qrotor/system.html):
|
|
153
|
+
|
|
127
154
|
```python
|
|
128
|
-
# Compile a 'potential.csv' file with the calculated potential as a function of the angle, and load it into a new system
|
|
129
155
|
system = qr.potential.from_qe()
|
|
156
|
+
# Check the potential
|
|
157
|
+
qr.plot.potential(system)
|
|
130
158
|
# Solve the system, interpolating to a bigger gridsize
|
|
131
159
|
system.B = qr.B_CH3
|
|
132
160
|
system.solve(200000)
|
|
@@ -134,13 +162,15 @@ qr.plot.energies(system)
|
|
|
134
162
|
```
|
|
135
163
|
|
|
136
164
|
|
|
137
|
-
##
|
|
165
|
+
## Other quantum observables
|
|
166
|
+
|
|
138
167
|
|
|
139
|
-
|
|
140
|
-
below the potential maximum are also calculated upon solving the system:
|
|
168
|
+
The Zero-Point Energies (ZPEs), quantum tunnel splittings, excitations and energy level degeneracy
|
|
169
|
+
below the potential maximum are also calculated upon solving the [system](https://pablogila.github.io/qrotor/qrotor/system.html):
|
|
141
170
|
|
|
142
171
|
```python
|
|
143
172
|
system.solve()
|
|
173
|
+
print(system.eigenvalues[0])
|
|
144
174
|
print(system.splittings)
|
|
145
175
|
print(system.excitations)
|
|
146
176
|
print(system.deg)
|
|
@@ -149,7 +179,7 @@ print(system.deg)
|
|
|
149
179
|
An integer `System.deg` degeneracy (e.g. 3 for methyls)
|
|
150
180
|
indicates that the energy levels have been properly estimated.
|
|
151
181
|
However, if the degeneracy is a float instead,
|
|
152
|
-
|
|
182
|
+
you might want to check the splittings and excitations manually from the system eigenvalues.
|
|
153
183
|
|
|
154
184
|
To export the energies and the tunnel splittings of several calculations to a CSV file:
|
|
155
185
|
|
|
@@ -173,12 +203,14 @@ for further reference.
|
|
|
173
203
|
|
|
174
204
|
# Contributing
|
|
175
205
|
|
|
206
|
+
|
|
176
207
|
If you are interested in opening an issue or a pull request, please feel free to do so on [GitHub](https://github.com/pablogila/qrotor/).
|
|
177
208
|
For major changes, please get in touch first to discuss the details.
|
|
178
209
|
|
|
179
210
|
|
|
180
211
|
## Code style
|
|
181
212
|
|
|
213
|
+
|
|
182
214
|
Please try to follow some general guidelines:
|
|
183
215
|
- Use a code style consistent with the rest of the project.
|
|
184
216
|
- Include docstrings to document new additions.
|
|
@@ -188,6 +220,7 @@ Please try to follow some general guidelines:
|
|
|
188
220
|
|
|
189
221
|
## Automated testing
|
|
190
222
|
|
|
223
|
+
|
|
191
224
|
If you are modifying the source code, you should run the automated tests of the [`tests/`](https://github.com/pablogila/qrotor/tree/main/tests) folder to check that everything works as intended.
|
|
192
225
|
To do so, first install PyTest in your environment,
|
|
193
226
|
```bash
|
|
@@ -217,7 +250,7 @@ This runs Pdoc, updating links and pictures, and using the custom theme CSS temp
|
|
|
217
250
|
|
|
218
251
|
QRotor is currently under development.
|
|
219
252
|
Please cite it if you use it in your research,
|
|
220
|
-
>
|
|
253
|
+
> Gila-Herranz, P. (2024). QRotor: Solving one-dimensional hindered-rotor quantum systems. https://pablogila.github.io/qrotor
|
|
221
254
|
|
|
222
255
|
|
|
223
256
|
---
|
|
@@ -225,6 +258,7 @@ Please cite it if you use it in your research,
|
|
|
225
258
|
|
|
226
259
|
# License
|
|
227
260
|
|
|
261
|
+
|
|
228
262
|
Copyright (C) 2025 Pablo Gila-Herranz
|
|
229
263
|
This program is free software: you can redistribute it and/or modify
|
|
230
264
|
it under the terms of the **GNU Affero General Public License** as published
|
|
@@ -5,8 +5,6 @@ Common constants and default inertia values used in QRotor.
|
|
|
5
5
|
|
|
6
6
|
Bond lengths and angles were obtained from MAPbI3, see
|
|
7
7
|
[K. Drużbicki *et al*., Crystal Growth & Design 24, 391–404 (2024)](https://doi.org/10.1021/acs.cgd.3c01112).
|
|
8
|
-
|
|
9
|
-
---
|
|
10
8
|
"""
|
|
11
9
|
|
|
12
10
|
|
|
@@ -15,6 +13,24 @@ import periodictable
|
|
|
15
13
|
import scipy.constants as const
|
|
16
14
|
|
|
17
15
|
|
|
16
|
+
# Quick conversion factors
|
|
17
|
+
Ry_to_eV = const.physical_constants['Rydberg constant times hc in eV'][0]
|
|
18
|
+
"""Quick conversion factor from Rydberg to eV energy."""
|
|
19
|
+
Ry_to_meV = Ry_to_eV * 1000
|
|
20
|
+
"""Quick conversion factor from Rydberg to meV energy."""
|
|
21
|
+
eV_to_Ry = 1 / Ry_to_eV
|
|
22
|
+
"""Quick conversion factor from eV to Rydberg."""
|
|
23
|
+
meV_to_Ry = 1 / Ry_to_meV
|
|
24
|
+
"""Quick conversion factor from meV to Rydberg."""
|
|
25
|
+
cm1_to_meV = (const.h * const.c * 100 / const.e) * 1000
|
|
26
|
+
"""Quick conversion factor from cm$^{-1}$ to meV."""
|
|
27
|
+
meV_to_cm1 = 1/cm1_to_meV
|
|
28
|
+
"""Quick conversion factor from meV to cm$^{-1}$."""
|
|
29
|
+
amu_to_kg = const.physical_constants['atomic mass constant'][0]
|
|
30
|
+
"""Quick conversion factor from amu to kg."""
|
|
31
|
+
kg_to_amu = 1 / amu_to_kg
|
|
32
|
+
"""Quick conversion factor from kg to amu."""
|
|
33
|
+
|
|
18
34
|
# Distance between Carbon and Hydrogen atoms (measured from MAPbI3)
|
|
19
35
|
distance_CH = 1.09285 # Angstroms
|
|
20
36
|
"""Distance of the C-H bond, in Angstroms."""
|
|
@@ -38,16 +54,43 @@ r_NH = distance_NH * np.sin(np.deg2rad(angle_NH)) * 1e-10
|
|
|
38
54
|
"""Rotation radius of the amine group, in meters."""
|
|
39
55
|
|
|
40
56
|
# Inertia, SI units
|
|
41
|
-
|
|
42
|
-
I_CH3 = 3 * (periodictable.H.mass * _amu * r_CH**2)
|
|
57
|
+
I_CH3 = 3 * (periodictable.H.mass * amu_to_kg * r_CH**2)
|
|
43
58
|
"""Inertia of CH3, in kg·m^2."""
|
|
44
|
-
I_CD3 = 3 * (periodictable.D.mass *
|
|
59
|
+
I_CD3 = 3 * (periodictable.D.mass * amu_to_kg * r_CH**2)
|
|
45
60
|
"""Inertia of CD3, in kg·m^2."""
|
|
46
|
-
I_NH3 = 3 * (periodictable.H.mass *
|
|
61
|
+
I_NH3 = 3 * (periodictable.H.mass * amu_to_kg * r_NH**2)
|
|
47
62
|
"""Inertia of NH3, in kg·m^2."""
|
|
48
|
-
I_ND3 = 3 * (periodictable.D.mass *
|
|
63
|
+
I_ND3 = 3 * (periodictable.D.mass * amu_to_kg * r_NH**2)
|
|
49
64
|
"""Inertia of ND3, in kg·m^2."""
|
|
50
65
|
|
|
66
|
+
I_CH3NH3 = I_CH3 + I_NH3
|
|
67
|
+
"""Inertia of CH3NH3+, in kg·m^2."""
|
|
68
|
+
I_CD3NH3 = I_CD3 + I_NH3
|
|
69
|
+
"""Inertia of CD3NH3+, in kg·m^2."""
|
|
70
|
+
I_CH3ND3 = I_CH3 + I_ND3
|
|
71
|
+
"""Inertia of CH3ND3+, in kg·m^2."""
|
|
72
|
+
I_CD3ND3 = I_CD3 + I_ND3
|
|
73
|
+
"""Inertia of CD3ND3+, in kg·m^2."""
|
|
74
|
+
|
|
75
|
+
# Inertia, atomic units
|
|
76
|
+
I_CH3_amu = I_CH3 / (amu_to_kg * 1e-20)
|
|
77
|
+
"""Inertia of CH3, in amu·AA^2."""
|
|
78
|
+
I_CD3_amu = I_CD3 / (amu_to_kg * 1e-20)
|
|
79
|
+
"""Inertia of CD3, in amu·AA^2."""
|
|
80
|
+
I_NH3_amu = I_NH3 / (amu_to_kg * 1e-20)
|
|
81
|
+
"""Inertia of NH3, in amu·AA^2."""
|
|
82
|
+
I_ND3_amu = I_ND3 / (amu_to_kg * 1e-20)
|
|
83
|
+
"""Inertia of ND3, in amu·AA^2."""
|
|
84
|
+
|
|
85
|
+
I_CH3NH3_amu = I_CH3_amu + I_NH3_amu
|
|
86
|
+
"""Inertia of CH3NH3+, in amu·AA^2."""
|
|
87
|
+
I_CD3NH3_amu = I_CD3_amu + I_NH3_amu
|
|
88
|
+
"""Inertia of CD3NH3+, in amu·AA^2."""
|
|
89
|
+
I_CH3ND3_amu = I_CH3_amu + I_ND3_amu
|
|
90
|
+
"""Inertia of CH3ND3+, in amu·AA^2."""
|
|
91
|
+
I_CD3ND3_amu = I_CD3_amu + I_ND3_amu
|
|
92
|
+
"""Inertia of CD3ND3+, in amu·AA^2."""
|
|
93
|
+
|
|
51
94
|
# Rotational energy
|
|
52
95
|
_hbar = const.physical_constants['reduced Planck constant'][0]
|
|
53
96
|
B_CH3 = ((_hbar**2) / (2 * I_CH3)) * (1000 / const.eV)
|
|
@@ -59,6 +102,15 @@ B_NH3 = ((_hbar**2) / (2 * I_NH3)) * (1000 / const.eV)
|
|
|
59
102
|
B_ND3 = ((_hbar**2) / (2 * I_ND3)) * (1000 / const.eV)
|
|
60
103
|
"""Kinetic rotational energy of ND3, in meV·s/kg·m^2."""
|
|
61
104
|
|
|
105
|
+
B_CH3NH3 = ((_hbar**2) / (2 * I_CH3NH3)) * (1000 / const.eV)
|
|
106
|
+
"""Kinetic rotational energy of CH3NH3+, in meV·s/kg·m^2."""
|
|
107
|
+
B_CD3NH3 = ((_hbar**2) / (2 * I_CD3NH3)) * (1000 / const.eV)
|
|
108
|
+
"""Kinetic rotational energy of CD3NH3+, in meV·s/kg·m^2."""
|
|
109
|
+
B_CH3ND3 = ((_hbar**2) / (2 * I_CH3ND3)) * (1000 / const.eV)
|
|
110
|
+
"""Kinetic rotational energy of CH3ND3+, in meV·s/kg·m^2."""
|
|
111
|
+
B_CD3ND3 = ((_hbar**2) / (2 * I_CD3ND3)) * (1000 / const.eV)
|
|
112
|
+
"""Kinetic rotational energy of CD3ND3+, in meV·s/kg·m^2."""
|
|
113
|
+
|
|
62
114
|
# Potential constants from titov2023 [C1, C2, C3, C4, C5]
|
|
63
115
|
constants_titov2023 = [
|
|
64
116
|
[2.7860, 0.0130,-1.5284,-0.0037,-1.2791], # ZIF-8
|
|
@@ -73,17 +125,3 @@ for the `qrotor.potential.titov2023` potential.
|
|
|
73
125
|
In meV units.
|
|
74
126
|
"""
|
|
75
127
|
|
|
76
|
-
# Quick conversion factors
|
|
77
|
-
Ry_to_eV = const.physical_constants['Rydberg constant times hc in eV'][0]
|
|
78
|
-
"""Quick conversion factor from Rydberg to eV energy."""
|
|
79
|
-
Ry_to_meV = Ry_to_eV * 1000
|
|
80
|
-
"""Quick conversion factor from Rydberg to meV energy."""
|
|
81
|
-
eV_to_Ry = 1 / Ry_to_eV
|
|
82
|
-
"""Quick conversion factor from eV to Rydberg."""
|
|
83
|
-
meV_to_Ry = 1 / Ry_to_meV
|
|
84
|
-
"""Quick conversion factor from meV to Rydberg."""
|
|
85
|
-
cm1_to_meV = (const.h * const.c * 100 / const.e) * 1000
|
|
86
|
-
"""Quick conversion factor from cm$^{-1}$ to meV."""
|
|
87
|
-
meV_to_cm1 = 1/cm1_to_meV
|
|
88
|
-
"""Quick conversion factor from meV to cm$^{-1}$."""
|
|
89
|
-
|
|
@@ -13,7 +13,7 @@ This module provides straightforward functions to plot QRotor data.
|
|
|
13
13
|
| `reduced_energies()` | Reduced energies E/B as a function of the reduced potential V/B |
|
|
14
14
|
| `wavefunction()` | Selected wavefunctions or squared wavefunctions of a system |
|
|
15
15
|
| `splittings()` | Tunnel splitting energies of a list of systems |
|
|
16
|
-
| `convergence()` | Energy convergence |
|
|
16
|
+
| `convergence()` | Energy convergence of a list of systems calculated with different parameters |
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qrotor
|
|
3
|
-
Version: 4.1
|
|
3
|
+
Version: 4.2.1
|
|
4
4
|
Summary: QRotor
|
|
5
5
|
Author: Pablo Gila-Herranz
|
|
6
6
|
Author-email: pgila001@ikasle.ehu.eus
|
|
@@ -36,14 +36,28 @@ Dynamic: summary
|
|
|
36
36
|
|
|
37
37
|
<p align="center"><img width="60.0%" src="pics/qrotor.png"></p>
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
QRotor is a Python package used to study molecular rotations
|
|
41
|
+
based on the one-dimensional hindered-rotor model,
|
|
40
42
|
such as those of methyl and amine groups.
|
|
41
43
|
It can calculate their quantum energy levels and wavefunctions,
|
|
42
44
|
along with excitations and tunnel splittings.
|
|
43
|
-
These quantum systems are represented by the `qrotor.System()` object.
|
|
44
45
|
|
|
45
|
-
QRotor
|
|
46
|
-
|
|
46
|
+
QRotor systematically produces Quantum ESPRESSO SCF calculations to obtain
|
|
47
|
+
the rotational Potential Energy Surface (PES) of custom molecular structures.
|
|
48
|
+
This potential is used to solve the quantum hamiltonian of the hindered rotor model:
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
H = -B \frac{d^2}{d\varphi^2} + V(\varphi)
|
|
52
|
+
$$
|
|
53
|
+
|
|
54
|
+
where $B$ is the *kinetic rotational energy* constant,
|
|
55
|
+
|
|
56
|
+
$$
|
|
57
|
+
B = \frac{\hbar^2}{2I}=\frac{\hbar^2}{2\sum_{i}m_{i}r_{i}^{2}}
|
|
58
|
+
$$
|
|
59
|
+
|
|
60
|
+
Head to the [Usage](#usage) section for a quick hands-on introduction.
|
|
47
61
|
|
|
48
62
|
|
|
49
63
|
---
|
|
@@ -51,6 +65,7 @@ which are used to solve the quantum system.
|
|
|
51
65
|
|
|
52
66
|
# Installation
|
|
53
67
|
|
|
68
|
+
|
|
54
69
|
As always, it is recommended to install your packages in a virtual environment:
|
|
55
70
|
```bash
|
|
56
71
|
python3 -m venv .venv
|
|
@@ -60,6 +75,7 @@ source .venv/bin/activate
|
|
|
60
75
|
|
|
61
76
|
## With pip
|
|
62
77
|
|
|
78
|
+
|
|
63
79
|
Install or upgrade ATON with
|
|
64
80
|
```bash
|
|
65
81
|
pip install qrotor -U
|
|
@@ -68,6 +84,7 @@ pip install qrotor -U
|
|
|
68
84
|
|
|
69
85
|
## From source
|
|
70
86
|
|
|
87
|
+
|
|
71
88
|
Optionally, you can install ATON from the [GitHub repo](https://github.com/pablogila/qrotor/).
|
|
72
89
|
Clone the repository or download the [latest stable release](https://github.com/pablogila/qrotor/tags)
|
|
73
90
|
as a ZIP, unzip it, and run inside it:
|
|
@@ -81,6 +98,7 @@ pip install .
|
|
|
81
98
|
|
|
82
99
|
# Documentation
|
|
83
100
|
|
|
101
|
+
|
|
84
102
|
QRotor contains the following modules:
|
|
85
103
|
|
|
86
104
|
| | |
|
|
@@ -101,17 +119,18 @@ Check the [full documentation online](https://pablogila.github.io/qrotor/).
|
|
|
101
119
|
|
|
102
120
|
# Usage
|
|
103
121
|
|
|
104
|
-
|
|
122
|
+
|
|
123
|
+
## Solving quantum eigenvalues for one-dimensional rotor systems
|
|
124
|
+
|
|
105
125
|
|
|
106
126
|
Let's start with a basic calculation of the eigenvalues for a zero potential, corresponding to a free rotor.
|
|
107
|
-
A predefined synthetic potential can be used, see all available options in the [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) documentation.
|
|
108
127
|
Note that the default energy unit is meV unless stated otherwise.
|
|
109
128
|
|
|
110
129
|
```python
|
|
111
130
|
import qrotor as qr
|
|
112
131
|
system = qr.System()
|
|
113
132
|
system.gridsize = 200000 # Size of the potential grid
|
|
114
|
-
system.B = 1
|
|
133
|
+
system.B = 1 # Rotational inertia
|
|
115
134
|
system.potential_name = 'zero'
|
|
116
135
|
system.solve()
|
|
117
136
|
print(system.eigenvalues)
|
|
@@ -121,8 +140,10 @@ print(system.eigenvalues)
|
|
|
121
140
|
The accuracy of the calculation increases with bigger gridsizes,
|
|
122
141
|
but note that the runtime increases exponentially.
|
|
123
142
|
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
Predefined synthetic potentials can be used,
|
|
144
|
+
see all available options in the [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) documentation.
|
|
145
|
+
For example, we can solve the system for a hindered methyl group,
|
|
146
|
+
in a [cosine potential](https://pablogila.github.io/qrotor/qrotor/potential.html#cosine) of amplitude 30 meV:
|
|
126
147
|
|
|
127
148
|
```python
|
|
128
149
|
import qrotor as qr
|
|
@@ -139,10 +160,14 @@ qr.plot.wavefunction(system, levels=[0,1,2], square=True)
|
|
|
139
160
|
```
|
|
140
161
|
|
|
141
162
|
|
|
142
|
-
##
|
|
163
|
+
## Rotational PES from custom structures
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
QRotor can be used to calculate the rotational Potential Energy Surface (PES) from DFT calculations.
|
|
167
|
+
Currently only Quantum ESPRESSO is supported,
|
|
168
|
+
although other DFT codes can be easily implemented through [ATON](https://pablogila.github.io/aton).
|
|
143
169
|
|
|
144
|
-
|
|
145
|
-
To run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
170
|
+
First, run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
146
171
|
|
|
147
172
|
```python
|
|
148
173
|
import qrotor as qr
|
|
@@ -159,10 +184,13 @@ scf_files = qr.rotate.structure_qe('molecule.in', positions=atoms, angle=10, rep
|
|
|
159
184
|
api.slurm.sbatch(files=scf_files)
|
|
160
185
|
```
|
|
161
186
|
|
|
162
|
-
|
|
187
|
+
You can compile a `potential.csv` file with the calculated potential as a function of the angle,
|
|
188
|
+
and load it into a new [system](https://pablogila.github.io/qrotor/qrotor/system.html):
|
|
189
|
+
|
|
163
190
|
```python
|
|
164
|
-
# Compile a 'potential.csv' file with the calculated potential as a function of the angle, and load it into a new system
|
|
165
191
|
system = qr.potential.from_qe()
|
|
192
|
+
# Check the potential
|
|
193
|
+
qr.plot.potential(system)
|
|
166
194
|
# Solve the system, interpolating to a bigger gridsize
|
|
167
195
|
system.B = qr.B_CH3
|
|
168
196
|
system.solve(200000)
|
|
@@ -170,13 +198,15 @@ qr.plot.energies(system)
|
|
|
170
198
|
```
|
|
171
199
|
|
|
172
200
|
|
|
173
|
-
##
|
|
201
|
+
## Other quantum observables
|
|
202
|
+
|
|
174
203
|
|
|
175
|
-
|
|
176
|
-
below the potential maximum are also calculated upon solving the system:
|
|
204
|
+
The Zero-Point Energies (ZPEs), quantum tunnel splittings, excitations and energy level degeneracy
|
|
205
|
+
below the potential maximum are also calculated upon solving the [system](https://pablogila.github.io/qrotor/qrotor/system.html):
|
|
177
206
|
|
|
178
207
|
```python
|
|
179
208
|
system.solve()
|
|
209
|
+
print(system.eigenvalues[0])
|
|
180
210
|
print(system.splittings)
|
|
181
211
|
print(system.excitations)
|
|
182
212
|
print(system.deg)
|
|
@@ -185,7 +215,7 @@ print(system.deg)
|
|
|
185
215
|
An integer `System.deg` degeneracy (e.g. 3 for methyls)
|
|
186
216
|
indicates that the energy levels have been properly estimated.
|
|
187
217
|
However, if the degeneracy is a float instead,
|
|
188
|
-
|
|
218
|
+
you might want to check the splittings and excitations manually from the system eigenvalues.
|
|
189
219
|
|
|
190
220
|
To export the energies and the tunnel splittings of several calculations to a CSV file:
|
|
191
221
|
|
|
@@ -209,12 +239,14 @@ for further reference.
|
|
|
209
239
|
|
|
210
240
|
# Contributing
|
|
211
241
|
|
|
242
|
+
|
|
212
243
|
If you are interested in opening an issue or a pull request, please feel free to do so on [GitHub](https://github.com/pablogila/qrotor/).
|
|
213
244
|
For major changes, please get in touch first to discuss the details.
|
|
214
245
|
|
|
215
246
|
|
|
216
247
|
## Code style
|
|
217
248
|
|
|
249
|
+
|
|
218
250
|
Please try to follow some general guidelines:
|
|
219
251
|
- Use a code style consistent with the rest of the project.
|
|
220
252
|
- Include docstrings to document new additions.
|
|
@@ -224,6 +256,7 @@ Please try to follow some general guidelines:
|
|
|
224
256
|
|
|
225
257
|
## Automated testing
|
|
226
258
|
|
|
259
|
+
|
|
227
260
|
If you are modifying the source code, you should run the automated tests of the [`tests/`](https://github.com/pablogila/qrotor/tree/main/tests) folder to check that everything works as intended.
|
|
228
261
|
To do so, first install PyTest in your environment,
|
|
229
262
|
```bash
|
|
@@ -253,7 +286,7 @@ This runs Pdoc, updating links and pictures, and using the custom theme CSS temp
|
|
|
253
286
|
|
|
254
287
|
QRotor is currently under development.
|
|
255
288
|
Please cite it if you use it in your research,
|
|
256
|
-
>
|
|
289
|
+
> Gila-Herranz, P. (2024). QRotor: Solving one-dimensional hindered-rotor quantum systems. https://pablogila.github.io/qrotor
|
|
257
290
|
|
|
258
291
|
|
|
259
292
|
---
|
|
@@ -261,6 +294,7 @@ Please cite it if you use it in your research,
|
|
|
261
294
|
|
|
262
295
|
# License
|
|
263
296
|
|
|
297
|
+
|
|
264
298
|
Copyright (C) 2025 Pablo Gila-Herranz
|
|
265
299
|
This program is free software: you can redistribute it and/or modify
|
|
266
300
|
it under the terms of the **GNU Affero General Public License** as published
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|