qrotor 4.0.1__py3-none-any.whl → 4.0.2__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 +1 -1
- qrotor/plot.py +4 -1
- qrotor/potential.py +23 -6
- {qrotor-4.0.1.dist-info → qrotor-4.0.2.dist-info}/METADATA +15 -16
- qrotor-4.0.2.dist-info/RECORD +20 -0
- tests/test_constants.py +13 -0
- tests/test_potential.py +37 -0
- tests/{test_qrotor.py → test_rotate.py} +0 -48
- tests/test_solve.py +28 -0
- tests/test_system.py +24 -0
- qrotor-4.0.1.dist-info/RECORD +0 -16
- {qrotor-4.0.1.dist-info → qrotor-4.0.2.dist-info}/WHEEL +0 -0
- {qrotor-4.0.1.dist-info → qrotor-4.0.2.dist-info}/licenses/LICENSE +0 -0
- {qrotor-4.0.1.dist-info → qrotor-4.0.2.dist-info}/top_level.txt +0 -0
qrotor/_version.py
CHANGED
qrotor/plot.py
CHANGED
|
@@ -271,7 +271,7 @@ def splittings(
|
|
|
271
271
|
The different `System.comment` are shown in the horizontal axis.
|
|
272
272
|
An optional `title` can be specified.
|
|
273
273
|
Default units shown are $\\mu$eV (`'ueV'`).
|
|
274
|
-
Available units are: `'ueV'`, `'meV'`, `'Ry'
|
|
274
|
+
Available units are: `'ueV'`, `'meV'`, `'Ry'`, or `'B'` (free rotor units).
|
|
275
275
|
"""
|
|
276
276
|
title = title if title != None else 'Tunnel splitting energies'
|
|
277
277
|
calcs = deepcopy(data)
|
|
@@ -289,6 +289,9 @@ def splittings(
|
|
|
289
289
|
elif units.lower() in alias.units['Ry']:
|
|
290
290
|
y = [j * constants.meV_to_Ry for j in y]
|
|
291
291
|
ax.set_ylabel("Energy / Ry")
|
|
292
|
+
elif units.upper() == 'B':
|
|
293
|
+
y = [j / c.B for j, c in zip(y, calcs)]
|
|
294
|
+
ax.set_ylabel("Energy / B")
|
|
292
295
|
#else: # It's okay let's use meV
|
|
293
296
|
|
|
294
297
|
ax.bar(range(len(y)), y)
|
qrotor/potential.py
CHANGED
|
@@ -66,6 +66,7 @@ def save(
|
|
|
66
66
|
in degrees and meVs by default.
|
|
67
67
|
The units can be changed with `angle` and `energy`,
|
|
68
68
|
but only change these defaults if you know what you are doing.
|
|
69
|
+
An optional `comment` can be included in the header of the file.
|
|
69
70
|
"""
|
|
70
71
|
print('Saving potential data file...')
|
|
71
72
|
# Check if a previous potential.dat file exists, and ask to overwrite it
|
|
@@ -77,7 +78,7 @@ def save(
|
|
|
77
78
|
print("Aborted.")
|
|
78
79
|
return None
|
|
79
80
|
# Set header
|
|
80
|
-
potential_data = f'
|
|
81
|
+
potential_data = f'## {comment}\n' if comment else f'## {system.comment}\n' if system.comment else ''
|
|
81
82
|
potential_data += '# Rotational potential dataset\n'
|
|
82
83
|
potential_data += f'# Saved with QRotor {__version__}\n'
|
|
83
84
|
potential_data += '# https://pablogila.github.io/qrotor\n'
|
|
@@ -143,6 +144,11 @@ def load(
|
|
|
143
144
|
system = System() if system is None else system
|
|
144
145
|
with open(file_path, 'r') as f:
|
|
145
146
|
lines = f.readlines()
|
|
147
|
+
# Read the comment
|
|
148
|
+
loaded_comment = ''
|
|
149
|
+
if lines[0].startswith('## '):
|
|
150
|
+
loaded_comment = lines[0][3:].strip()
|
|
151
|
+
# Read data
|
|
146
152
|
positions = []
|
|
147
153
|
potentials = []
|
|
148
154
|
for line in lines:
|
|
@@ -171,8 +177,13 @@ def load(
|
|
|
171
177
|
system.grid = np.array(positions)
|
|
172
178
|
system.gridsize = len(positions)
|
|
173
179
|
system.potential_values = np.array(potentials)
|
|
174
|
-
# System comment as the parent folder name
|
|
175
|
-
|
|
180
|
+
# System comment as the loaded comment or the parent folder name
|
|
181
|
+
if comment:
|
|
182
|
+
system.comment = comment
|
|
183
|
+
elif loaded_comment:
|
|
184
|
+
system.comment = loaded_comment
|
|
185
|
+
else:
|
|
186
|
+
system.comment = os.path.basename(os.path.dirname(file_path))
|
|
176
187
|
print(f"Loaded {filepath}")
|
|
177
188
|
return system
|
|
178
189
|
|
|
@@ -184,9 +195,10 @@ def from_qe(
|
|
|
184
195
|
exclude:list=['slurm-'],
|
|
185
196
|
energy:str='meV',
|
|
186
197
|
comment:str=None,
|
|
187
|
-
) ->
|
|
198
|
+
) -> System:
|
|
188
199
|
"""Compiles a rotational potential CSV file from Quantum ESPRESSO outputs,
|
|
189
200
|
created with `qrotor.rotate.structure_qe()`.
|
|
201
|
+
Returns a `System` object with the new potential values.
|
|
190
202
|
|
|
191
203
|
The angle in degrees is extracted from the output filenames,
|
|
192
204
|
which must follow `whatever_ANGLE.out`.
|
|
@@ -213,7 +225,7 @@ def from_qe(
|
|
|
213
225
|
files = file.get_list(folder=folder, include=include, exclude=exclude, abspath=True)
|
|
214
226
|
folder_name = os.path.basename(folder)
|
|
215
227
|
# Set header
|
|
216
|
-
potential_data = f'
|
|
228
|
+
potential_data = f'## {comment}\n' if comment else f'## {folder_name}\n'
|
|
217
229
|
potential_data += '# Rotational potential dataset\n'
|
|
218
230
|
potential_data += f'# Calculated with QE using QRotor {__version__}\n'
|
|
219
231
|
potential_data += '# https://pablogila.github.io/qrotor\n'
|
|
@@ -273,7 +285,12 @@ def from_qe(
|
|
|
273
285
|
# Warn the user if not in default units
|
|
274
286
|
if energy.lower() not in alias.units['meV']:
|
|
275
287
|
print(f"WARNING: You saved the potential in '{energy}' units! Remember that QRotor works in meVs!")
|
|
276
|
-
|
|
288
|
+
new_system = None
|
|
289
|
+
try:
|
|
290
|
+
new_system = load(filepath=filepath, comment=comment, energy=energy)
|
|
291
|
+
except:
|
|
292
|
+
pass
|
|
293
|
+
return new_system
|
|
277
294
|
|
|
278
295
|
|
|
279
296
|
def merge(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qrotor
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.2
|
|
4
4
|
Summary: QRotor
|
|
5
5
|
Author: Pablo Gila-Herranz
|
|
6
6
|
Author-email: pgila001@ikasle.ehu.eus
|
|
@@ -85,13 +85,13 @@ QRotor contains the following modules:
|
|
|
85
85
|
|
|
86
86
|
| | |
|
|
87
87
|
| --- | --- |
|
|
88
|
+
| [qrotor.constants](https://pablogila.github.io/qrotor/qrotor/constants.html) | Common bond lengths and inertias |
|
|
88
89
|
| [qrotor.system](https://pablogila.github.io/qrotor/qrotor/system.html) | Definition of the quantum `System` object |
|
|
89
|
-
| [qrotor.systems](https://pablogila.github.io/qrotor/qrotor/systems.html) |
|
|
90
|
+
| [qrotor.systems](https://pablogila.github.io/qrotor/qrotor/systems.html) | Utilities to manage several System objects, such as a list of systems |
|
|
90
91
|
| [qrotor.rotate](https://pablogila.github.io/qrotor/qrotor/rotate.html) | Rotate specific atoms from structural files |
|
|
91
|
-
| [qrotor.constants](https://pablogila.github.io/qrotor/qrotor/constants.html) | Common bond lengths and inertias |
|
|
92
92
|
| [qrotor.potential](https://pablogila.github.io/qrotor/qrotor/potential.html) | Potential definitions and loading functions |
|
|
93
93
|
| [qrotor.solve](https://pablogila.github.io/qrotor/qrotor/solve.html) | Solve rotation eigenvalues and eigenvectors |
|
|
94
|
-
| [qrotor.plot](https://pablogila.github.io/qrotor/qrotor/plot.html) | Plotting
|
|
94
|
+
| [qrotor.plot](https://pablogila.github.io/qrotor/qrotor/plot.html) | Plotting utilities |
|
|
95
95
|
|
|
96
96
|
Check the [full documentation online](https://pablogila.github.io/qrotor/).
|
|
97
97
|
|
|
@@ -103,7 +103,8 @@ Check the [full documentation online](https://pablogila.github.io/qrotor/).
|
|
|
103
103
|
|
|
104
104
|
## Solving quantum rotational systems
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
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.
|
|
107
108
|
Note that the default energy unit is meV unless stated otherwise.
|
|
108
109
|
|
|
109
110
|
```python
|
|
@@ -113,7 +114,7 @@ system.gridsize = 200000 # Size of the potential grid
|
|
|
113
114
|
system.B = 1 # Rotational inertia
|
|
114
115
|
system.potential_name = 'zero'
|
|
115
116
|
system.solve()
|
|
116
|
-
system.eigenvalues
|
|
117
|
+
print(system.eigenvalues)
|
|
117
118
|
# [0.0, 1.0, 1.0, 4.0, 4.0, 9.0, 9.0, ...] # approx values
|
|
118
119
|
```
|
|
119
120
|
|
|
@@ -126,10 +127,10 @@ in a cosine potential of amplitude 30 meV:
|
|
|
126
127
|
```python
|
|
127
128
|
import qrotor as qr
|
|
128
129
|
system = qr.System()
|
|
129
|
-
system.gridsize = 200000
|
|
130
|
+
system.gridsize = 200000
|
|
130
131
|
system.B = qr.B_CH3 # Rotational inertia of a methyl group
|
|
131
132
|
system.potential_name = 'cosine'
|
|
132
|
-
system.potential_constants = [0, 30, 3, 0] # Offset, max, freq, phase (for
|
|
133
|
+
system.potential_constants = [0, 30, 3, 0] # Offset, max, freq, phase (for cosine potential)
|
|
133
134
|
system.solve()
|
|
134
135
|
# Plot potential and eigenvalues
|
|
135
136
|
qr.plot.energies(system)
|
|
@@ -141,7 +142,7 @@ qr.plot.wavefunction(system, levels=[0,1,2], square=True)
|
|
|
141
142
|
## Custom potentials from DFT
|
|
142
143
|
|
|
143
144
|
QRotor can be used to obtain custom rotational potentials from DFT calculations.
|
|
144
|
-
|
|
145
|
+
To run a Quantum ESPRESSO SCF calculation for a methyl rotation every 10 degrees:
|
|
145
146
|
|
|
146
147
|
```python
|
|
147
148
|
import qrotor as qr
|
|
@@ -160,10 +161,8 @@ api.slurm.sbatch(files=scf_files)
|
|
|
160
161
|
|
|
161
162
|
To load the calculated potential to a QRotor System,
|
|
162
163
|
```python
|
|
163
|
-
# Compile a 'potential.csv' file with the calculated potential as a function of the angle
|
|
164
|
-
qr.potential.from_qe()
|
|
165
|
-
# Load to the system
|
|
166
|
-
system = qr.potential.load()
|
|
164
|
+
# Compile a 'potential.csv' file with the calculated potential as a function of the angle, and load it into a new system
|
|
165
|
+
system = qr.potential.from_qe()
|
|
167
166
|
# Solve the system, interpolating to a bigger gridsize
|
|
168
167
|
system.B = qr.B_CH3
|
|
169
168
|
system.solve(200000)
|
|
@@ -178,9 +177,9 @@ below the potential maximum are also calculated upon solving the system:
|
|
|
178
177
|
|
|
179
178
|
```python
|
|
180
179
|
system.solve()
|
|
181
|
-
system.splittings
|
|
182
|
-
system.excitations
|
|
183
|
-
system.deg
|
|
180
|
+
print(system.splittings)
|
|
181
|
+
print(system.excitations)
|
|
182
|
+
print(system.deg)
|
|
184
183
|
```
|
|
185
184
|
|
|
186
185
|
An integer `System.deg` degeneracy (e.g. 3 for methyls)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
qrotor/__init__.py,sha256=rG2dH4QjsVUOMBhFnv5gXs3QnrUg7fywd5pIDmMBXcQ,246
|
|
2
|
+
qrotor/_version.py,sha256=WfMOkqINoRxtl94Yz6ro_Svh85CVtVc_kBhLMclRC4g,194
|
|
3
|
+
qrotor/constants.py,sha256=l25-YHxWQPr5RFGl8e0Hpdkc0E4ER03Gj-P9Jmbqelc,3203
|
|
4
|
+
qrotor/plot.py,sha256=th6eDoTB01KaVjfH2uiKMjU4VJMfdv0yK97PwCJydKI,13479
|
|
5
|
+
qrotor/potential.py,sha256=9NyekNIMbjiRtJ8G6CtCMHX5v-g7kKC8un2x3blq-2w,18320
|
|
6
|
+
qrotor/rotate.py,sha256=Wje9Q9SFhDvizz58MzNGBwsmgV-3wN9z2SnUNTIXzeg,8107
|
|
7
|
+
qrotor/solve.py,sha256=tnkE5JYT8wW85gNbOEMgHTnzOZCb8q5xPcJbDI4uOB0,10724
|
|
8
|
+
qrotor/system.py,sha256=onY3HfY2zpRLDJUjBJRX-nJu6YH_qhnPnCW6Uyam_Ws,11453
|
|
9
|
+
qrotor/systems.py,sha256=Hcx0QvMWpaPMfC6HWpkZPPWDyHk9rxWKdAxWNnD2NMg,8184
|
|
10
|
+
qrotor-4.0.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
11
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
tests/test_constants.py,sha256=YHKkPyZlzjchxxzON_VSNsQdKnpkknsFVoIA6TcUk70,399
|
|
13
|
+
tests/test_potential.py,sha256=_Vq9t9Xm59kNbyYwXlRnvKcxwL7vntD2j14W2aUtF6I,1302
|
|
14
|
+
tests/test_rotate.py,sha256=2On2d1E82hdisFC5DXpaqqYNnteX7ZP3PAnGa_oGm2M,1896
|
|
15
|
+
tests/test_solve.py,sha256=tEjLUZC7oe6LCQD5b2xf2aaK9lu-zI4lzuPXOGR2GAs,861
|
|
16
|
+
tests/test_system.py,sha256=36d-8AdoJdzq0O9_O3s8wwBPGa-M7A86YiHqhhAsCZ8,742
|
|
17
|
+
qrotor-4.0.2.dist-info/METADATA,sha256=T4uzj6bJ0bsRZ5pN5XO2i-i2SY1JoakroDGl1Za5zYU,8719
|
|
18
|
+
qrotor-4.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
qrotor-4.0.2.dist-info/top_level.txt,sha256=mLnYs07-amqX4TqbDV2_XvgdpHfgrYmzmYb7dwoh6EQ,13
|
|
20
|
+
qrotor-4.0.2.dist-info/RECORD,,
|
tests/test_constants.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import qrotor as qr
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_constants():
|
|
5
|
+
assert round(qr.B_CH3, 5) == 0.64518
|
|
6
|
+
assert round(qr.B_CD3, 5) == 0.32289
|
|
7
|
+
assert round(qr.B_NH3, 5) == 0.73569
|
|
8
|
+
assert round(qr.B_ND3, 5) == 0.36819
|
|
9
|
+
assert round(qr.Ry_to_eV, 5) == 13.60569
|
|
10
|
+
assert round(qr.Ry_to_meV, 5) == 13605.69312
|
|
11
|
+
assert round(qr.eV_to_Ry, 5) == 0.07350
|
|
12
|
+
assert round(qr.meV_to_Ry, 10) == .0000734986
|
|
13
|
+
|
tests/test_potential.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import qrotor as qr
|
|
2
|
+
import aton
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
folder = 'tests/samples/'
|
|
6
|
+
structure = folder + 'CH3NH3.in'
|
|
7
|
+
structure_120 = folder + 'CH3NH3_120.in'
|
|
8
|
+
structure_60 = folder + 'CH3NH3_60.in'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_save_and_load():
|
|
12
|
+
system = qr.System()
|
|
13
|
+
system.gridsize = 36
|
|
14
|
+
system.potential_name = 'sin'
|
|
15
|
+
system.B = 1
|
|
16
|
+
system.solve_potential()
|
|
17
|
+
potential_file = folder + '_temp_potential.csv'
|
|
18
|
+
# Remove the file if it exists
|
|
19
|
+
try:
|
|
20
|
+
aton.file.remove(potential_file)
|
|
21
|
+
except:
|
|
22
|
+
pass
|
|
23
|
+
qr.potential.save(system, comment='hi', filepath=potential_file)
|
|
24
|
+
system_new = qr.potential.load(potential_file)
|
|
25
|
+
assert system_new.gridsize == system.gridsize
|
|
26
|
+
assert round(system_new.potential_values[0], 5) == round(system.potential_values[0], 5)
|
|
27
|
+
assert round(system_new.potential_values[5], 5) == round(system.potential_values[5], 5)
|
|
28
|
+
assert round(system_new.potential_values[13], 5) == round(system.potential_values[13], 5)
|
|
29
|
+
assert system_new.comment == 'hi'
|
|
30
|
+
aton.file.remove(potential_file)
|
|
31
|
+
# If we don't provide a comment, it should be the name of the folder
|
|
32
|
+
system.comment = None
|
|
33
|
+
qr.potential.save(system, filepath=potential_file)
|
|
34
|
+
system_new = qr.potential.load(potential_file)
|
|
35
|
+
assert system_new.comment == 'samples'
|
|
36
|
+
aton.file.remove(potential_file)
|
|
37
|
+
|
|
@@ -2,7 +2,6 @@ import qrotor as qr
|
|
|
2
2
|
import aton.api as api
|
|
3
3
|
import aton.txt.extract as extract
|
|
4
4
|
import aton.file as file
|
|
5
|
-
import numpy as np
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
folder = 'tests/samples/'
|
|
@@ -52,50 +51,3 @@ def test_rotate():
|
|
|
52
51
|
assert coord_rounded == rotated_coord_rounded
|
|
53
52
|
file.remove(structure_60)
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
def test_solve_zero():
|
|
57
|
-
system = qr.System()
|
|
58
|
-
system.gridsize = 50000
|
|
59
|
-
system.potential_name = 'zero'
|
|
60
|
-
system.B = 1
|
|
61
|
-
system.solve()
|
|
62
|
-
assert round(system.eigenvalues[0], 2) == 0.0
|
|
63
|
-
assert round(system.eigenvalues[1], 2) == 1.0
|
|
64
|
-
assert round(system.eigenvalues[2], 2) == 1.0
|
|
65
|
-
assert round(system.eigenvalues[3], 2) == 4.0
|
|
66
|
-
assert round(system.eigenvalues[4], 2) == 4.0
|
|
67
|
-
assert round(system.eigenvalues[5], 2) == 9.0
|
|
68
|
-
assert round(system.eigenvalues[6], 2) == 9.0
|
|
69
|
-
assert round(system.eigenvalues[7], 2) == 16.0
|
|
70
|
-
assert round(system.eigenvalues[8], 2) == 16.0
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def test_solve_potential():
|
|
74
|
-
system = qr.System()
|
|
75
|
-
system.gridsize = 500
|
|
76
|
-
system.potential_name = 'sin'
|
|
77
|
-
system.potential_constants = [0, 1, 3, 0]
|
|
78
|
-
system.solve_potential()
|
|
79
|
-
assert round(system.potential_max, 2) == 1.0
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def test_phase():
|
|
83
|
-
sys = qr.System()
|
|
84
|
-
sys.B = 1.0
|
|
85
|
-
sys.potential_name = 'cos'
|
|
86
|
-
sys.gridsize = 10000
|
|
87
|
-
sys.solve()
|
|
88
|
-
# plus pi/2, which will be -3pi/2
|
|
89
|
-
sys.change_phase(0.5)
|
|
90
|
-
assert round(sys.grid[0], 2) == round(-np.pi * 3/2, 2)
|
|
91
|
-
# The first potential value should be 0,
|
|
92
|
-
# but remember that the potential offset is corrected
|
|
93
|
-
# so it should be half potential_max, so 1.0/2
|
|
94
|
-
assert round(sys.potential_values[0], 2) == 0.5
|
|
95
|
-
# minus pi, which will become -pi/2
|
|
96
|
-
sys.change_phase(-1)
|
|
97
|
-
assert round(sys.grid[0], 2) == round(-np.pi/2, 2)
|
|
98
|
-
assert round(sys.potential_values[0], 2) == 0.5
|
|
99
|
-
# Were eigenvalues calculated?
|
|
100
|
-
assert len(sys.eigenvalues) > 0
|
|
101
|
-
|
tests/test_solve.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import qrotor as qr
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_solve_zero():
|
|
5
|
+
system = qr.System()
|
|
6
|
+
system.gridsize = 50000
|
|
7
|
+
system.potential_name = 'zero'
|
|
8
|
+
system.B = 1
|
|
9
|
+
system.solve()
|
|
10
|
+
assert round(system.eigenvalues[0], 2) == 0.0
|
|
11
|
+
assert round(system.eigenvalues[1], 2) == 1.0
|
|
12
|
+
assert round(system.eigenvalues[2], 2) == 1.0
|
|
13
|
+
assert round(system.eigenvalues[3], 2) == 4.0
|
|
14
|
+
assert round(system.eigenvalues[4], 2) == 4.0
|
|
15
|
+
assert round(system.eigenvalues[5], 2) == 9.0
|
|
16
|
+
assert round(system.eigenvalues[6], 2) == 9.0
|
|
17
|
+
assert round(system.eigenvalues[7], 2) == 16.0
|
|
18
|
+
assert round(system.eigenvalues[8], 2) == 16.0
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_solve_potential():
|
|
22
|
+
system = qr.System()
|
|
23
|
+
system.gridsize = 500
|
|
24
|
+
system.potential_name = 'sin'
|
|
25
|
+
system.potential_constants = [0, 1, 3, 0]
|
|
26
|
+
system.solve_potential()
|
|
27
|
+
assert round(system.potential_max, 2) == 1.0
|
|
28
|
+
|
tests/test_system.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import qrotor as qr
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_phase():
|
|
6
|
+
sys = qr.System()
|
|
7
|
+
sys.B = 1.0
|
|
8
|
+
sys.potential_name = 'cos'
|
|
9
|
+
sys.gridsize = 10000
|
|
10
|
+
sys.solve()
|
|
11
|
+
# plus pi/2, which will be -3pi/2
|
|
12
|
+
sys.change_phase(0.5)
|
|
13
|
+
assert round(sys.grid[0], 2) == round(-np.pi * 3/2, 2)
|
|
14
|
+
# The first potential value should be 0,
|
|
15
|
+
# but remember that the potential offset is corrected
|
|
16
|
+
# so it should be half potential_max, so 1.0/2
|
|
17
|
+
assert round(sys.potential_values[0], 2) == 0.5
|
|
18
|
+
# minus pi, which will become -pi/2
|
|
19
|
+
sys.change_phase(-1)
|
|
20
|
+
assert round(sys.grid[0], 2) == round(-np.pi/2, 2)
|
|
21
|
+
assert round(sys.potential_values[0], 2) == 0.5
|
|
22
|
+
# Were eigenvalues calculated?
|
|
23
|
+
assert len(sys.eigenvalues) > 0
|
|
24
|
+
|
qrotor-4.0.1.dist-info/RECORD
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
qrotor/__init__.py,sha256=rG2dH4QjsVUOMBhFnv5gXs3QnrUg7fywd5pIDmMBXcQ,246
|
|
2
|
-
qrotor/_version.py,sha256=MdOgAkUR9D2frTc3Jx8g9MXBZxTyDiIlBtprpKhAfes,194
|
|
3
|
-
qrotor/constants.py,sha256=l25-YHxWQPr5RFGl8e0Hpdkc0E4ER03Gj-P9Jmbqelc,3203
|
|
4
|
-
qrotor/plot.py,sha256=SeQX8PM5qPdedmo0DzfGFbA8m_sH2mcK50aTuWXN8HA,13335
|
|
5
|
-
qrotor/potential.py,sha256=4sONrwnJkKy2zyquX6AFpNVLXrRMX9XUJUnuS6eZ9bc,17781
|
|
6
|
-
qrotor/rotate.py,sha256=Wje9Q9SFhDvizz58MzNGBwsmgV-3wN9z2SnUNTIXzeg,8107
|
|
7
|
-
qrotor/solve.py,sha256=tnkE5JYT8wW85gNbOEMgHTnzOZCb8q5xPcJbDI4uOB0,10724
|
|
8
|
-
qrotor/system.py,sha256=onY3HfY2zpRLDJUjBJRX-nJu6YH_qhnPnCW6Uyam_Ws,11453
|
|
9
|
-
qrotor/systems.py,sha256=Hcx0QvMWpaPMfC6HWpkZPPWDyHk9rxWKdAxWNnD2NMg,8184
|
|
10
|
-
qrotor-4.0.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
11
|
-
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
tests/test_qrotor.py,sha256=KL5i1YVFOB5cFc7BXCtbrbBKKMCHyGM-B20m4unz1q0,3457
|
|
13
|
-
qrotor-4.0.1.dist-info/METADATA,sha256=Z92ghlFydfpFiI1XOZ15pfRwQt69_hf9KFP9fHMuDCA,8528
|
|
14
|
-
qrotor-4.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
-
qrotor-4.0.1.dist-info/top_level.txt,sha256=mLnYs07-amqX4TqbDV2_XvgdpHfgrYmzmYb7dwoh6EQ,13
|
|
16
|
-
qrotor-4.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|