qrotor 4.1.1__tar.gz → 4.1.2__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.1.2
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.1.2"
15
15
 
@@ -51,13 +51,13 @@ I_ND3 = 3 * (periodictable.D.mass * _amu * r_NH**2)
51
51
  # Rotational energy
52
52
  _hbar = const.physical_constants['reduced Planck constant'][0]
53
53
  B_CH3 = ((_hbar**2) / (2 * I_CH3)) * (1000 / const.eV)
54
- """Rotational energy of CH3, in meV·s/kg·m^2."""
54
+ """Kinetic rotational energy of CH3, in meV·s/kg·m^2."""
55
55
  B_CD3 = ((_hbar**2) / (2 * I_CD3)) * (1000 / const.eV)
56
- """Rotational energy of CD3, in meV·s/kg·m^2."""
56
+ """Kinetic rotational energy of CD3, in meV·s/kg·m^2."""
57
57
  B_NH3 = ((_hbar**2) / (2 * I_NH3)) * (1000 / const.eV)
58
- """Rotational energy of NH3, in meV·s/kg·m^2."""
58
+ """Kinetic rotational energy of NH3, in meV·s/kg·m^2."""
59
59
  B_ND3 = ((_hbar**2) / (2 * I_ND3)) * (1000 / const.eV)
60
- """Rotational energy of ND3, in meV·s/kg·m^2."""
60
+ """Kinetic rotational energy of ND3, in meV·s/kg·m^2."""
61
61
 
62
62
  # Potential constants from titov2023 [C1, C2, C3, C4, C5]
63
63
  constants_titov2023 = [
@@ -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.1.2
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