qrotor 4.1.1__tar.gz → 4.2.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.1.1
3
+ Version: 4.2.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.1.1"
14
+ __version__ = "v4.2.0"
15
15
 
@@ -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,26 +54,62 @@ 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)
54
- """Rotational energy of CH3, in meV·s/kg·m^2."""
97
+ """Kinetic rotational energy of CH3, in meV·s/kg·m^2."""
55
98
  B_CD3 = ((_hbar**2) / (2 * I_CD3)) * (1000 / const.eV)
56
- """Rotational energy of CD3, in meV·s/kg·m^2."""
99
+ """Kinetic rotational energy of CD3, in meV·s/kg·m^2."""
57
100
  B_NH3 = ((_hbar**2) / (2 * I_NH3)) * (1000 / const.eV)
58
- """Rotational energy of NH3, in meV·s/kg·m^2."""
101
+ """Kinetic rotational energy of NH3, in meV·s/kg·m^2."""
59
102
  B_ND3 = ((_hbar**2) / (2 * I_ND3)) * (1000 / const.eV)
60
- """Rotational energy of ND3, in meV·s/kg·m^2."""
103
+ """Kinetic rotational energy of ND3, in meV·s/kg·m^2."""
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."""
61
113
 
62
114
  # Potential constants from titov2023 [C1, C2, C3, C4, C5]
63
115
  constants_titov2023 = [
@@ -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
-
@@ -34,6 +34,8 @@ def potential(
34
34
  marker='',
35
35
  linestyle='-',
36
36
  cm:bool=False,
37
+ normalize:bool=False,
38
+ ylim:tuple=None,
37
39
  ) -> None:
38
40
  """Plot the potential values of `data` (System object, or list of systems).
39
41
 
@@ -42,8 +44,13 @@ def potential(
42
44
 
43
45
  `marker` and `linestyle` can be a Matplotlib string or list of strings.
44
46
  Optionally, the Viridis colormap can be used with `cm = True`.
47
+
48
+ Set `normalize = True` to normalize by their respective `qrotor.system.System.potential_max`.
49
+ This can be useful if you have performed subtractions or similar operations.
50
+ In this case, you might also want to play with `ylim` to adjust the y-axis limits.
45
51
  """
46
- system = systems.as_list(data)
52
+ data_copy = deepcopy(data)
53
+ system = systems.as_list(data_copy)
47
54
  title_str = title if title else (system[0].comment if (system[0].comment and (len(system) == 1 or not system[-1].comment)) else 'Rotational potential energy')
48
55
  # Marker as a list
49
56
  if isinstance(marker, list):
@@ -62,6 +69,15 @@ def potential(
62
69
  plt.title(title_str)
63
70
  plt.xlabel('Angle / rad')
64
71
  plt.ylabel('Potential energy / meV')
72
+
73
+ if normalize:
74
+ plt.ylabel('Energy / V$_{3}$')
75
+ for s in system:
76
+ s.potential_values = s.potential_values / s.potential_max
77
+
78
+ if ylim:
79
+ plt.ylim(ylim)
80
+
65
81
  plt.xticks([-2*np.pi, -3*np.pi/2, -np.pi, -np.pi/2, 0, np.pi/2, np.pi, 3*np.pi/2, 2*np.pi], [r'$-2\pi$', r'$-\frac{3\pi}{2}$', r'$-\pi$', r'$-\frac{\pi}{2}$', '0', r'$\frac{\pi}{2}$', r'$\pi$', r'$\frac{3\pi}{2}$', r'$2\pi$'])
66
82
 
67
83
  if cm: # Plot using a colormap
@@ -372,7 +372,10 @@ def interpolate(system:System) -> System:
372
372
  grid = system.grid
373
373
  gridsize = system.gridsize
374
374
  new_grid = np.linspace(0, 2*np.pi, gridsize)
375
- cubic_spline = CubicSpline(grid, V)
375
+ # Impose periodic boundary conditions
376
+ grid_periodic = np.append(grid, grid[0] + 2*np.pi)
377
+ V_periodic = np.append(V, V[0])
378
+ cubic_spline = CubicSpline(grid_periodic, V_periodic, bc_type='periodic')
376
379
  new_V = cubic_spline(new_grid)
377
380
  system.grid = new_grid
378
381
  system.potential_values = new_V
@@ -61,7 +61,7 @@ class System:
61
61
  if not B:
62
62
  B = self.B
63
63
  self.B: float = B
64
- """Rotational inertia, as in $B=\\frac{\\hbar^2}{2I}$.
64
+ """Kinetic rotational energy, as in $B=\\frac{\\hbar^2}{2I}$.
65
65
 
66
66
  Defaults to the value for a methyl group.
67
67
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrotor
3
- Version: 4.1.1
3
+ Version: 4.2.0
4
4
  Summary: QRotor
5
5
  Author: Pablo Gila-Herranz
6
6
  Author-email: pgila001@ikasle.ehu.eus
@@ -15,6 +15,7 @@ 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
18
19
  tests/test_constants.py
19
20
  tests/test_potential.py
20
21
  tests/test_rotate.py
@@ -1 +1,2 @@
1
1
  qrotor
2
+ tests
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