qrotor 4.2.1__py3-none-any.whl → 4.3.0__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/constants.py +33 -2
- qrotor/potential.py +5 -5
- qrotor/rotate.py +8 -8
- {qrotor-4.2.1.dist-info → qrotor-4.3.0.dist-info}/METADATA +1 -1
- qrotor-4.3.0.dist-info/RECORD +14 -0
- {qrotor-4.2.1.dist-info → qrotor-4.3.0.dist-info}/top_level.txt +0 -1
- qrotor-4.2.1.dist-info/RECORD +0 -20
- tests/__init__.py +0 -0
- tests/test_constants.py +0 -13
- tests/test_potential.py +0 -37
- tests/test_rotate.py +0 -53
- tests/test_solve.py +0 -28
- tests/test_system.py +0 -24
- {qrotor-4.2.1.dist-info → qrotor-4.3.0.dist-info}/WHEEL +0 -0
- {qrotor-4.2.1.dist-info → qrotor-4.3.0.dist-info}/licenses/LICENSE +0 -0
qrotor/_version.py
CHANGED
qrotor/constants.py
CHANGED
|
@@ -53,7 +53,7 @@ r_CH = distance_CH * np.sin(np.deg2rad(angle_CH)) * 1e-10
|
|
|
53
53
|
r_NH = distance_NH * np.sin(np.deg2rad(angle_NH)) * 1e-10
|
|
54
54
|
"""Rotation radius of the amine group, in meters."""
|
|
55
55
|
|
|
56
|
-
#
|
|
56
|
+
# Inertias, SI units
|
|
57
57
|
I_CH3 = 3 * (periodictable.H.mass * amu_to_kg * r_CH**2)
|
|
58
58
|
"""Inertia of CH3, in kg·m^2."""
|
|
59
59
|
I_CD3 = 3 * (periodictable.D.mass * amu_to_kg * r_CH**2)
|
|
@@ -63,6 +63,7 @@ I_NH3 = 3 * (periodictable.H.mass * amu_to_kg * r_NH**2)
|
|
|
63
63
|
I_ND3 = 3 * (periodictable.D.mass * amu_to_kg * r_NH**2)
|
|
64
64
|
"""Inertia of ND3, in kg·m^2."""
|
|
65
65
|
|
|
66
|
+
# Inertias of the co-rotation, SI units
|
|
66
67
|
I_CH3NH3 = I_CH3 + I_NH3
|
|
67
68
|
"""Inertia of CH3NH3+, in kg·m^2."""
|
|
68
69
|
I_CD3NH3 = I_CD3 + I_NH3
|
|
@@ -72,7 +73,17 @@ I_CH3ND3 = I_CH3 + I_ND3
|
|
|
72
73
|
I_CD3ND3 = I_CD3 + I_ND3
|
|
73
74
|
"""Inertia of CD3ND3+, in kg·m^2."""
|
|
74
75
|
|
|
75
|
-
#
|
|
76
|
+
# Inertias of the dis-rotation, SI units
|
|
77
|
+
I_CH3NH3_dis = 1 / ((1/I_CH3) + (1/I_NH3))
|
|
78
|
+
"""Inertia of the disrotatory torsion of CH3NH3+, in kg·m^2."""
|
|
79
|
+
I_CD3NH3_dis = 1 / ((1/I_CD3) + (1/I_NH3))
|
|
80
|
+
"""Inertia of the disrotatory torsion of CD3NH3+, in kg·m^2."""
|
|
81
|
+
I_CH3ND3_dis = 1 / ((1/I_CH3) + (1/I_ND3))
|
|
82
|
+
"""Inertia of the disrotatory torsion of CH3ND3+, in kg·m^2."""
|
|
83
|
+
I_CD3ND3_dis = 1 / ((1/I_CD3) + (1/I_ND3))
|
|
84
|
+
"""Inertia of the disrotatory torsion of CD3ND3+, in kg·m^2."""
|
|
85
|
+
|
|
86
|
+
# Inertias, atomic units
|
|
76
87
|
I_CH3_amu = I_CH3 / (amu_to_kg * 1e-20)
|
|
77
88
|
"""Inertia of CH3, in amu·AA^2."""
|
|
78
89
|
I_CD3_amu = I_CD3 / (amu_to_kg * 1e-20)
|
|
@@ -82,6 +93,7 @@ I_NH3_amu = I_NH3 / (amu_to_kg * 1e-20)
|
|
|
82
93
|
I_ND3_amu = I_ND3 / (amu_to_kg * 1e-20)
|
|
83
94
|
"""Inertia of ND3, in amu·AA^2."""
|
|
84
95
|
|
|
96
|
+
# Inertias of the co-rotation, amu units
|
|
85
97
|
I_CH3NH3_amu = I_CH3_amu + I_NH3_amu
|
|
86
98
|
"""Inertia of CH3NH3+, in amu·AA^2."""
|
|
87
99
|
I_CD3NH3_amu = I_CD3_amu + I_NH3_amu
|
|
@@ -91,6 +103,16 @@ I_CH3ND3_amu = I_CH3_amu + I_ND3_amu
|
|
|
91
103
|
I_CD3ND3_amu = I_CD3_amu + I_ND3_amu
|
|
92
104
|
"""Inertia of CD3ND3+, in amu·AA^2."""
|
|
93
105
|
|
|
106
|
+
# Inertias of the dis-rotation, amu units
|
|
107
|
+
I_CH3NH3_dis_amu = I_CH3NH3_dis / (amu_to_kg * 1e-20)
|
|
108
|
+
"""Inertia of the disrotatory torsion of CH3NH3+, in amu·AA^2."""
|
|
109
|
+
I_CD3NH3_dis_amu = I_CD3NH3_dis / (amu_to_kg * 1e-20)
|
|
110
|
+
"""Inertia of the disrotatory torsion of CD3NH3+, in amu·AA^2."""
|
|
111
|
+
I_CH3ND3_dis_amu = I_CH3ND3_dis / (amu_to_kg * 1e-20)
|
|
112
|
+
"""Inertia of the disrotatory torsion of CH3ND3+, in amu·AA^2."""
|
|
113
|
+
I_CD3ND3_dis_amu = I_CD3ND3_dis / (amu_to_kg * 1e-20)
|
|
114
|
+
"""Inertia of the disrotatory torsion of CD3ND3+, in amu·AA^2."""
|
|
115
|
+
|
|
94
116
|
# Rotational energy
|
|
95
117
|
_hbar = const.physical_constants['reduced Planck constant'][0]
|
|
96
118
|
B_CH3 = ((_hbar**2) / (2 * I_CH3)) * (1000 / const.eV)
|
|
@@ -111,6 +133,15 @@ B_CH3ND3 = ((_hbar**2) / (2 * I_CH3ND3)) * (1000 / const.eV)
|
|
|
111
133
|
B_CD3ND3 = ((_hbar**2) / (2 * I_CD3ND3)) * (1000 / const.eV)
|
|
112
134
|
"""Kinetic rotational energy of CD3ND3+, in meV·s/kg·m^2."""
|
|
113
135
|
|
|
136
|
+
B_CH3NH3_dis = ((_hbar**2) / (2 * I_CH3NH3_dis)) * (1000 / const.eV)
|
|
137
|
+
"""Kinetic rotational energy of the disrotatory torsion of CH3NH3+, in meV·s/kg·m^2."""
|
|
138
|
+
B_CD3NH3_dis = ((_hbar**2) / (2 * I_CD3NH3_dis)) * (1000 / const.eV)
|
|
139
|
+
"""Kinetic rotational energy of the disrotatory torsion of CD3NH3+, in meV·s/kg·m^2."""
|
|
140
|
+
B_CH3ND3_dis = ((_hbar**2) / (2 * I_CH3ND3_dis)) * (1000 / const.eV)
|
|
141
|
+
"""Kinetic rotational energy of the disrotatory torsion of CH3ND3+, in meV·s/kg·m^2."""
|
|
142
|
+
B_CD3ND3_dis = ((_hbar**2) / (2 * I_CD3ND3_dis)) * (1000 / const.eV)
|
|
143
|
+
"""Kinetic rotational energy of the disrotatory torsion of CD3ND3+, in meV·s/kg·m^2."""
|
|
144
|
+
|
|
114
145
|
# Potential constants from titov2023 [C1, C2, C3, C4, C5]
|
|
115
146
|
constants_titov2023 = [
|
|
116
147
|
[2.7860, 0.0130,-1.5284,-0.0037,-1.2791], # ZIF-8
|
qrotor/potential.py
CHANGED
|
@@ -49,7 +49,7 @@ from copy import deepcopy
|
|
|
49
49
|
from scipy.interpolate import CubicSpline
|
|
50
50
|
import aton.alias as alias
|
|
51
51
|
import aton.file as file
|
|
52
|
-
import aton.api.
|
|
52
|
+
import aton.api.pwx as pwx
|
|
53
53
|
from ._version import __version__
|
|
54
54
|
|
|
55
55
|
|
|
@@ -196,8 +196,8 @@ def from_qe(
|
|
|
196
196
|
energy:str='meV',
|
|
197
197
|
comment:str=None,
|
|
198
198
|
) -> System:
|
|
199
|
-
"""Compiles a rotational potential CSV file from Quantum ESPRESSO outputs,
|
|
200
|
-
created with `qrotor.rotate.
|
|
199
|
+
"""Compiles a rotational potential CSV file from Quantum ESPRESSO pw.x outputs,
|
|
200
|
+
created with `qrotor.rotate.input_qe()`.
|
|
201
201
|
Returns a `System` object with the new potential values.
|
|
202
202
|
|
|
203
203
|
The angle in degrees is extracted from the output filenames,
|
|
@@ -227,7 +227,7 @@ def from_qe(
|
|
|
227
227
|
# Set header
|
|
228
228
|
potential_data = f'## {comment}\n' if comment else f'## {folder_name}\n'
|
|
229
229
|
potential_data += '# Rotational potential dataset\n'
|
|
230
|
-
potential_data += f'# Calculated with QE using QRotor {__version__}\n'
|
|
230
|
+
potential_data += f'# Calculated with QE pw.x using QRotor {__version__}\n'
|
|
231
231
|
potential_data += '# https://pablogila.github.io/qrotor\n'
|
|
232
232
|
potential_data += '#\n'
|
|
233
233
|
if energy.lower() in alias.units['eV']:
|
|
@@ -249,7 +249,7 @@ def from_qe(
|
|
|
249
249
|
file_path = file.get(filepath=file_path, include='.out', return_anyway=True)
|
|
250
250
|
if not file_path: # Not an output file, skip it
|
|
251
251
|
continue
|
|
252
|
-
content =
|
|
252
|
+
content = pwx.read_out(file_path)
|
|
253
253
|
if not content['Success']: # Ignore unsuccessful calculations
|
|
254
254
|
print(f'x {filename}')
|
|
255
255
|
counter_errors += 1
|
qrotor/rotate.py
CHANGED
|
@@ -9,7 +9,7 @@ Works with Quantum ESPRESSO input files.
|
|
|
9
9
|
|
|
10
10
|
| | |
|
|
11
11
|
| --- | --- |
|
|
12
|
-
| `
|
|
12
|
+
| `input_qe()` | Rotate specific atoms from a Quantum ESPRESSO input file |
|
|
13
13
|
| `rotate_coords()` | Rotate a specific list of coordinates |
|
|
14
14
|
|
|
15
15
|
---
|
|
@@ -26,7 +26,7 @@ import aton.txt.extract as extract
|
|
|
26
26
|
import aton.txt.edit as edit
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def
|
|
29
|
+
def input_qe(
|
|
30
30
|
filepath:str,
|
|
31
31
|
positions:list,
|
|
32
32
|
angle:float,
|
|
@@ -66,13 +66,13 @@ def structure_qe(
|
|
|
66
66
|
lines = []
|
|
67
67
|
full_positions = []
|
|
68
68
|
for position in positions:
|
|
69
|
-
line = api.
|
|
69
|
+
line = api.pwx.get_atom(filepath, position, precision)
|
|
70
70
|
lines.append(line)
|
|
71
71
|
pos = extract.coords(line)
|
|
72
72
|
if len(pos) > 3: # Keep only the first three coordinates
|
|
73
73
|
pos = pos[:3]
|
|
74
74
|
# Convert to cartesian
|
|
75
|
-
pos_cartesian = api.
|
|
75
|
+
pos_cartesian = api.pwx.to_cartesian(filepath, pos)
|
|
76
76
|
full_positions.append(pos_cartesian)
|
|
77
77
|
print(f'Found atom: "{line}"')
|
|
78
78
|
# Set the angles to rotate
|
|
@@ -92,7 +92,7 @@ def structure_qe(
|
|
|
92
92
|
rotated_positions_cartesian = rotate_coords(full_positions, angle, use_centroid, show_axis)
|
|
93
93
|
rotated_positions = []
|
|
94
94
|
for coord in rotated_positions_cartesian:
|
|
95
|
-
pos = api.
|
|
95
|
+
pos = api.pwx.from_cartesian(filepath, coord)
|
|
96
96
|
rotated_positions.append(pos)
|
|
97
97
|
_save_qe(filepath, output, lines, rotated_positions)
|
|
98
98
|
outputs.append(output)
|
|
@@ -184,7 +184,7 @@ def _save_qe(
|
|
|
184
184
|
additional_positions = positions[-2:]
|
|
185
185
|
for pos in additional_positions:
|
|
186
186
|
pos.insert(0, 'He')
|
|
187
|
-
api.
|
|
187
|
+
api.pwx.add_atom(output, pos)
|
|
188
188
|
elif len(lines) != len(positions):
|
|
189
189
|
raise ValueError(f"What?! len(lines)={len(lines)} and len(positions)={len(positions)}")
|
|
190
190
|
# Add angle to calculation prefix
|
|
@@ -192,11 +192,11 @@ def _save_qe(
|
|
|
192
192
|
splits = output_name.split('_')
|
|
193
193
|
angle_str = splits[-1].replace('.in', '')
|
|
194
194
|
prefix = ''
|
|
195
|
-
content = api.
|
|
195
|
+
content = api.pwx.read_in(output)
|
|
196
196
|
if 'prefix' in content.keys():
|
|
197
197
|
prefix = content['prefix']
|
|
198
198
|
prefix = prefix.strip("'")
|
|
199
199
|
prefix = "'" + prefix + angle_str + "'"
|
|
200
|
-
api.
|
|
200
|
+
api.pwx.set_value(output, 'prefix', prefix)
|
|
201
201
|
return output
|
|
202
202
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
qrotor/__init__.py,sha256=rG2dH4QjsVUOMBhFnv5gXs3QnrUg7fywd5pIDmMBXcQ,246
|
|
2
|
+
qrotor/_version.py,sha256=yUq4NMbgza_UQXUxL5adzghdHM9U2mboRIIQkw4VrwE,198
|
|
3
|
+
qrotor/constants.py,sha256=YRri136Zg5dqqDS-180sxOB5ytBJW74msUbHYbrfiMc,6655
|
|
4
|
+
qrotor/plot.py,sha256=loyd-1sXvfD8_PyHCThE3VQpRC0qs1iONGY4LXjJyZ4,14086
|
|
5
|
+
qrotor/potential.py,sha256=hKlDKA50Umwk0Tfzx4mUXHSWTcHQNqhHLA7T2XedtCY,18500
|
|
6
|
+
qrotor/rotate.py,sha256=FppTiAwE3c7JtPyOGBF4YHxq9JzE-YilN_lpaOgPm9Q,8109
|
|
7
|
+
qrotor/solve.py,sha256=YkOR1SJlpk41PCNEhslv6X3wV1TWMNztT78qX3Pngf0,10722
|
|
8
|
+
qrotor/system.py,sha256=ahYurNUmVOV7B6aZSe7rhcruagj5rW9UClqG-H1vVvY,11454
|
|
9
|
+
qrotor/systems.py,sha256=Hcx0QvMWpaPMfC6HWpkZPPWDyHk9rxWKdAxWNnD2NMg,8184
|
|
10
|
+
qrotor-4.3.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
11
|
+
qrotor-4.3.0.dist-info/METADATA,sha256=MJWzR5gyk2x4-VIWl2K7ReaJYb0uKMnRrh-iUvywBsE,9649
|
|
12
|
+
qrotor-4.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
qrotor-4.3.0.dist-info/top_level.txt,sha256=SFRMgcJiR1GiEtZ4aLo-x5TdfSCo7Igxezp2qyI0u5A,7
|
|
14
|
+
qrotor-4.3.0.dist-info/RECORD,,
|
qrotor-4.2.1.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
qrotor/__init__.py,sha256=rG2dH4QjsVUOMBhFnv5gXs3QnrUg7fywd5pIDmMBXcQ,246
|
|
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
|
-
qrotor/potential.py,sha256=2HjSDVJWSvwplyH5pq0MMPoQsLIBJbbTwkr350u949I,18491
|
|
6
|
-
qrotor/rotate.py,sha256=Wje9Q9SFhDvizz58MzNGBwsmgV-3wN9z2SnUNTIXzeg,8107
|
|
7
|
-
qrotor/solve.py,sha256=YkOR1SJlpk41PCNEhslv6X3wV1TWMNztT78qX3Pngf0,10722
|
|
8
|
-
qrotor/system.py,sha256=ahYurNUmVOV7B6aZSe7rhcruagj5rW9UClqG-H1vVvY,11454
|
|
9
|
-
qrotor/systems.py,sha256=Hcx0QvMWpaPMfC6HWpkZPPWDyHk9rxWKdAxWNnD2NMg,8184
|
|
10
|
-
qrotor-4.2.1.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.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,,
|
tests/__init__.py
DELETED
|
File without changes
|
tests/test_constants.py
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
|
tests/test_rotate.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import qrotor as qr
|
|
2
|
-
import aton.api as api
|
|
3
|
-
import aton.txt.extract as extract
|
|
4
|
-
import aton.file as file
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
folder = 'tests/samples/'
|
|
8
|
-
structure = folder + 'CH3NH3.in'
|
|
9
|
-
structure_120 = folder + 'CH3NH3_120.in'
|
|
10
|
-
structure_60 = folder + 'CH3NH3_60.in'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def test_rotate():
|
|
14
|
-
CH3 = [
|
|
15
|
-
'0.100 0.183 0.316',
|
|
16
|
-
'0.151 0.532 0.842',
|
|
17
|
-
'0.118 0.816 0.277',
|
|
18
|
-
]
|
|
19
|
-
# 120 degrees (it should remain the same)
|
|
20
|
-
qr.rotate.structure_qe(filepath=structure, positions=CH3, angle=120, precision=2)
|
|
21
|
-
for coord in CH3:
|
|
22
|
-
rotated_coord = api.qe.get_atom(filepath=structure_120, position=coord, precision=2)
|
|
23
|
-
rotated_coord = extract.coords(rotated_coord)
|
|
24
|
-
coord = extract.coords(coord)
|
|
25
|
-
rotated_coord_rounded = []
|
|
26
|
-
coord_rounded = []
|
|
27
|
-
for i in rotated_coord:
|
|
28
|
-
rotated_coord_rounded.append(round(i, 2))
|
|
29
|
-
for i in coord:
|
|
30
|
-
coord_rounded.append(round(i, 2))
|
|
31
|
-
assert coord_rounded == rotated_coord_rounded
|
|
32
|
-
file.remove(structure_120)
|
|
33
|
-
|
|
34
|
-
# 60 degrees (it should change quite a lot)
|
|
35
|
-
ideal = [
|
|
36
|
-
'0.146468644022416 0.837865866372631 0.641449758215011',
|
|
37
|
-
'0.095062781582172 0.488975944606740 0.115053787468686',
|
|
38
|
-
'0.128156574395412 0.205890189020629 0.680672454316303',
|
|
39
|
-
]
|
|
40
|
-
qr.rotate.structure_qe(filepath=structure, positions=CH3, angle=60, precision=2)
|
|
41
|
-
for coord in ideal:
|
|
42
|
-
rotated_coord = api.qe.get_atom(filepath=structure_60, position=coord, precision=3)
|
|
43
|
-
rotated_coord = extract.coords(rotated_coord)
|
|
44
|
-
coord = extract.coords(coord)
|
|
45
|
-
rotated_coord_rounded = []
|
|
46
|
-
coord_rounded = []
|
|
47
|
-
for i in rotated_coord:
|
|
48
|
-
rotated_coord_rounded.append(round(i, 2))
|
|
49
|
-
for i in coord:
|
|
50
|
-
coord_rounded.append(round(i, 2))
|
|
51
|
-
assert coord_rounded == rotated_coord_rounded
|
|
52
|
-
file.remove(structure_60)
|
|
53
|
-
|
tests/test_solve.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
|
|
File without changes
|
|
File without changes
|