qrotor 4.1.2__py3-none-any.whl → 4.2.1__py3-none-any.whl

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/_version.py CHANGED
@@ -11,5 +11,5 @@ https://semver.org/
11
11
  ---
12
12
  """
13
13
 
14
- __version__ = "v4.1.2"
14
+ __version__ = "v4.2.1"
15
15
 
qrotor/constants.py CHANGED
@@ -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
- _amu = const.physical_constants['atomic mass constant'][0]
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 * _amu * r_CH**2)
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 * _amu * r_NH**2)
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 * _amu * r_NH**2)
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
-
qrotor/plot.py CHANGED
@@ -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.2
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
- QRotor is a Python package used to study molecular rotations,
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 can obtain custom potentials from DFT,
46
- which are used to solve the quantum system.
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
- ## Solving quantum rotational systems
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 # Rotational inertia
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
- The same calculation can be performed for a methyl group,
125
- in a cosine potential of amplitude 30 meV:
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
- ## Custom potentials from DFT
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
- QRotor can be used to obtain custom rotational potentials from DFT calculations.
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
- To load the calculated potential to a QRotor System,
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
- ## Tunnel splittings and excitations
201
+ ## Other quantum observables
202
+
174
203
 
175
- Tunnel splittings, excitations and energy level degeneracy
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
- please check the splittings and excitations manually from the system eigenvalues.
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
- > Pablo Gila-Herranz, *QRotor*, https://pablogila.github.io/qrotor
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,20 +1,20 @@
1
1
  qrotor/__init__.py,sha256=rG2dH4QjsVUOMBhFnv5gXs3QnrUg7fywd5pIDmMBXcQ,246
2
- qrotor/_version.py,sha256=gtnQ4qGBlYQr4K9VzdiULHRclyxik47zCja1dRudtyk,198
3
- qrotor/constants.py,sha256=Q59CU5QrvOyCz-2TFP31GDKJYi7G7LUxbs10ZTMiKIE,3408
4
- qrotor/plot.py,sha256=s0XYMxQ7BxN_MngU-UAvX5mGk5R8c_Hznw2xFX9-8nI,14028
2
+ qrotor/_version.py,sha256=YSHr6C919Wy5fXxFzjIN6vSskUpecEZNWKepHCIAsy4,198
3
+ qrotor/constants.py,sha256=tX_mM7WmP2wN4WYaL551jPcI-0Ca5SNOHATUxiUJQCQ,4934
4
+ qrotor/plot.py,sha256=loyd-1sXvfD8_PyHCThE3VQpRC0qs1iONGY4LXjJyZ4,14086
5
5
  qrotor/potential.py,sha256=2HjSDVJWSvwplyH5pq0MMPoQsLIBJbbTwkr350u949I,18491
6
6
  qrotor/rotate.py,sha256=Wje9Q9SFhDvizz58MzNGBwsmgV-3wN9z2SnUNTIXzeg,8107
7
7
  qrotor/solve.py,sha256=YkOR1SJlpk41PCNEhslv6X3wV1TWMNztT78qX3Pngf0,10722
8
8
  qrotor/system.py,sha256=ahYurNUmVOV7B6aZSe7rhcruagj5rW9UClqG-H1vVvY,11454
9
9
  qrotor/systems.py,sha256=Hcx0QvMWpaPMfC6HWpkZPPWDyHk9rxWKdAxWNnD2NMg,8184
10
- qrotor-4.1.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
10
+ qrotor-4.2.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
11
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  tests/test_constants.py,sha256=YHKkPyZlzjchxxzON_VSNsQdKnpkknsFVoIA6TcUk70,399
13
13
  tests/test_potential.py,sha256=_Vq9t9Xm59kNbyYwXlRnvKcxwL7vntD2j14W2aUtF6I,1302
14
14
  tests/test_rotate.py,sha256=2On2d1E82hdisFC5DXpaqqYNnteX7ZP3PAnGa_oGm2M,1896
15
15
  tests/test_solve.py,sha256=tEjLUZC7oe6LCQD5b2xf2aaK9lu-zI4lzuPXOGR2GAs,861
16
16
  tests/test_system.py,sha256=36d-8AdoJdzq0O9_O3s8wwBPGa-M7A86YiHqhhAsCZ8,742
17
- qrotor-4.1.2.dist-info/METADATA,sha256=5oHcJpRWIUcYiIzE5ilaFOWfH0xVy_7klIULdL2WhH0,8719
18
- qrotor-4.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- qrotor-4.1.2.dist-info/top_level.txt,sha256=mLnYs07-amqX4TqbDV2_XvgdpHfgrYmzmYb7dwoh6EQ,13
20
- qrotor-4.1.2.dist-info/RECORD,,
17
+ qrotor-4.2.1.dist-info/METADATA,sha256=pkuA9iv1jSYiOUhxf9aYdRlKNHHyaLwJaiuWZACJyg0,9649
18
+ qrotor-4.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ qrotor-4.2.1.dist-info/top_level.txt,sha256=mLnYs07-amqX4TqbDV2_XvgdpHfgrYmzmYb7dwoh6EQ,13
20
+ qrotor-4.2.1.dist-info/RECORD,,
File without changes