qrotor 4.2.1__tar.gz → 4.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of qrotor might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrotor
3
- Version: 4.2.1
3
+ Version: 4.3.0
4
4
  Summary: QRotor
5
5
  Author: Pablo Gila-Herranz
6
6
  Author-email: pgila001@ikasle.ehu.eus
@@ -11,5 +11,5 @@ https://semver.org/
11
11
  ---
12
12
  """
13
13
 
14
- __version__ = "v4.2.1"
14
+ __version__ = "v4.3.0"
15
15
 
@@ -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
- # Inertia, SI units
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
- # Inertia, atomic units
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
@@ -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.qe as qe
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.structure_qe()`.
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 = qe.read_out(file_path)
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
@@ -9,7 +9,7 @@ Works with Quantum ESPRESSO input files.
9
9
 
10
10
  | | |
11
11
  | --- | --- |
12
- | `structure_qe()` | Rotate specific atoms from a Quantum ESPRESSO input file |
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 structure_qe(
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.qe.get_atom(filepath, position, precision)
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.qe.to_cartesian(filepath, pos)
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.qe.from_cartesian(filepath, coord)
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.qe.add_atom(output, pos)
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.qe.read_in(output)
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.qe.set_value(output, 'prefix', prefix)
200
+ api.pwx.set_value(output, 'prefix', prefix)
201
201
  return output
202
202
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrotor
3
- Version: 4.2.1
3
+ Version: 4.3.0
4
4
  Summary: QRotor
5
5
  Author: Pablo Gila-Herranz
6
6
  Author-email: pgila001@ikasle.ehu.eus
@@ -15,7 +15,6 @@ qrotor.egg-info/SOURCES.txt
15
15
  qrotor.egg-info/dependency_links.txt
16
16
  qrotor.egg-info/requires.txt
17
17
  qrotor.egg-info/top_level.txt
18
- tests/__init__.py
19
18
  tests/test_constants.py
20
19
  tests/test_potential.py
21
20
  tests/test_rotate.py
@@ -1,2 +1 @@
1
1
  qrotor
2
- tests
@@ -17,9 +17,9 @@ def test_rotate():
17
17
  '0.118 0.816 0.277',
18
18
  ]
19
19
  # 120 degrees (it should remain the same)
20
- qr.rotate.structure_qe(filepath=structure, positions=CH3, angle=120, precision=2)
20
+ qr.rotate.input_qe(filepath=structure, positions=CH3, angle=120, precision=2)
21
21
  for coord in CH3:
22
- rotated_coord = api.qe.get_atom(filepath=structure_120, position=coord, precision=2)
22
+ rotated_coord = api.pwx.get_atom(filepath=structure_120, position=coord, precision=2)
23
23
  rotated_coord = extract.coords(rotated_coord)
24
24
  coord = extract.coords(coord)
25
25
  rotated_coord_rounded = []
@@ -37,9 +37,9 @@ def test_rotate():
37
37
  '0.095062781582172 0.488975944606740 0.115053787468686',
38
38
  '0.128156574395412 0.205890189020629 0.680672454316303',
39
39
  ]
40
- qr.rotate.structure_qe(filepath=structure, positions=CH3, angle=60, precision=2)
40
+ qr.rotate.input_qe(filepath=structure, positions=CH3, angle=60, precision=2)
41
41
  for coord in ideal:
42
- rotated_coord = api.qe.get_atom(filepath=structure_60, position=coord, precision=3)
42
+ rotated_coord = api.pwx.get_atom(filepath=structure_60, position=coord, precision=3)
43
43
  rotated_coord = extract.coords(rotated_coord)
44
44
  coord = extract.coords(coord)
45
45
  rotated_coord_rounded = []
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