pyscivr.scivr module
Semiclassical quantities and TA-SC-IVR spectra along classical trajectories.
See section II A for details.
- Notation:
T: number of time steps of the trajectory.m: number of active coordinates.n_E: number of energy grid points.
- pyscivr.scivr.get_action(lagrangian, dt)[source]
Compute the running action integral (Eq. (3) in the paper).
\[S_t = \int_0^t L(Q_\tau, P_\tau) d\tau\]- Parameters:
lagrangian (ArrayLike) –
(T,)Lagrangian along the trajectory.dt (float) – Time step.
- Returns:
(T,)running action integral along the trajectory, withS_0 = 0.- Return type:
NDArray[np.float64]
Note
At even steps, the integral is computed by Simpson’s rule. At odd steps, the last interval is added by the trapezoidal rule to the value at the previous even step.
- pyscivr.scivr.get_lagrangian(ener_tot, ener_pot, *, ener_ref=0.0)[source]
Compute the Lagrangian from the total and potential energies.
\[L = K - (V - V_{\text{ref}}) = E_{\text{tot}} - 2 V + V_{\text{ref}}\]where \(K\) is the kinetic energy and \(V\) is the potential energy.
- Parameters:
ener_tot (ArrayLike) –
(T,)total energy of the trajectory.ener_pot (ArrayLike) –
(T,)potential energy of the trajectory.ener_ref (float) – Reference potential energy for the Lagrangian.
- Returns:
(T,)Lagrangian along the trajectory.- Return type:
NDArray[np.float64]
- pyscivr.scivr.get_prefactor(mono, gamma, valid=None)[source]
Compute the Herman-Kluk pre-factor with branch tracking of the complex square root (Eq. (6) in the paper).
\[C_t = \sqrt{\det \left(\frac{1}{2} \left( M_{qq} + \Gamma^{-1} M_{pp} \Gamma - i \hbar M_{qp} \Gamma + \frac{i}{\hbar} \Gamma^{-1} M_{pq} \right)\right)}\]where \(M\) is the monodromy matrix and \(\Gamma = \text{diag}(\gamma)\) is the width parameter of the coherent state basis. The branch of the square root is chosen so that the phase of \(C_t\) is continuous along the trajectory.
- Parameters:
mono (ArrayLike) –
(T, 2m, 2m)monodromy matrices along the trajectory.gamma (ArrayLike) –
(m,)width parameters of the coherent state basis.valid (ArrayLike | None) –
(T,)bool mask. Invalid steps (e.g. near singularity) are skipped in the branch tracking. IfNone, all steps are considered valid.
- Returns:
(T,)Herman-Kluk pre-factor \(C_t\) along the trajectory, withNaNat invalid steps.- Return type:
NDArray[np.complex128]
- pyscivr.scivr.get_ta_spectrum_naive(prefactor, overlap, action, dt, ener_grid, valid=None, chunk_size=1000)[source]
Compute the TA-SC-IVR spectrum of a single trajectory by direct summation.
Deprecated since version 0.1.0: Use
get_ta_spectrum_fft()instead.Computes the same spectrum as
get_ta_spectrum_fft()on an arbitrary energy grid, at the cost of \(O(n_E T)\).- Parameters:
prefactor (ArrayLike) –
(T,)Herman-Kluk pre-factor \(C_t\).overlap (ArrayLike) –
(T,)overlap \(\langle \Psi(0) | Q_t, P_t \rangle\).action (ArrayLike) –
(T,)action integral \(S_t\).dt (float) – Time step.
ener_grid (ArrayLike) –
(n_E,)energy grid [eV] for the spectrum.valid (ArrayLike | None) –
(T,)bool. Invalid steps (near singularity) are skipped in the amplitude and contribute nothing. IfNone, all steps are considered valid.chunk_size (int) – Number of energy points to compute at once to save memory.
- Returns:
(ener_grid, spectrum), whereener_grid:(n_E,)energy grid [eV] for the spectrum.spectrum:(n_E,)spectrum, normalized by the total time t_tot = T dt.
- Return type:
tuple[NDArray[np.float64], NDArray[np.float64]]
- pyscivr.scivr.get_ta_spectrum_fft(prefactor, overlap, action, dt, n_fft, valid=None)[source]
Compute the TA-SC-IVR spectrum of a single trajectory by zero-padded FFT (Eq. (12) in the paper).
\[I(E) = \frac{1}{t_{\text{tot}}} \left| \int_0^{t_{\text{tot}}} dt \langle \Psi(0) | Q_t, P_t \rangle e^{i \left(\arg C_t + \frac{ S_t + E t}{\hbar}\right)} \right|^2\]The integral is evaluated by Simpson’s rule (see
get_action()for details), at the cost of \(O(n_{\text{fft}} \log n_{\text{fft}})\).- Parameters:
prefactor (ArrayLike) –
(T,)Herman-Kluk pre-factor \(C_t\).overlap (ArrayLike) –
(T,)overlap \(\langle \Psi(0) | Q_t, P_t \rangle\).action (ArrayLike) –
(T,)action integral \(S_t\).dt (float) – Time step.
n_fft (int) – Number of points for the FFT. Must be at least
T, and should be a power of 2.valid (ArrayLike | None) –
(T,)bool. Invalid steps (near singularity) are skipped in the amplitude and contribute nothing. IfNone, all steps are considered valid.
- Returns:
(ener_grid, spectrum), whereener_grid:(n_fft,)energy grid [eV] for the spectrum. The grid is \(E_k = \frac{2 \pi \hbar k}{n_{\text{fft}} dt}\).spectrum:(n_fft,)spectrum, normalized by the total timet_tot = T dt.
- Raises:
ValueError – If
n_fft < T.- Return type:
tuple[NDArray[np.float64], NDArray[np.float64]]
Note
The grid spacing is \(\Delta E = \frac{2 \pi \hbar}{n_{\text{fft}} dt}\), and the maximum energy is \(E_{\text{max}} = \frac{2 \pi \hbar}{dt}\). Increasing
n_fftrefines the grid by interpolation, but the intrinsic resolution \(\frac{2 \pi \hbar}{t_{\text{tot}}}\) is not improved.